find-deps

授权协议 Readme
开发语言 JavaScript
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 段干靖
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

find-deps

What?

find-deps helps you quickly find dependencies via the Clojars and Maven search APIs. Use it via the command line, or from the REPL.

find-deps utilizes clj-fuzzy to refine the search results returned from repository APIs. It also factors in the freshness of the dependencies, and the popularity of the dependency’s group ID. We hope this results in a near-perfect suggestion every time!

See the Future section below for some ideas around where this can be taken. In particular, it would be great to enable searching for deps.edn files on github …

TL;DR

Add a dependency to your current deps.edn as easily as this:

clj -A:find-deps -F:save priority-map

Changelog

  • Note taken on [2018-06-25 Mon 10:39]
  • 2018-06-25
    • hide snapshot versions by default in clojars (fixes #2)
  • 2018-06-24
    • merged @pesterhazy’s README fix
  • 2018-06-23
    • fixed bug wherein it wasn’t possible to save deps without a preexisting deps.edn
    • added -F:cli format flag to print deps as command line option to `clojure` binary
  • 2018-06-17
    • change -S flag to -s to avoid conflict with tools.deps cli
    • enable piping of invocations together to produced merged deps.edn map
    • enable saving of deps.edn map with format :save
    • renamed :merged to :merge
  • 2018-06-16
    • Initial commit

CLI Usage

To use find-deps from the command line, create an alias in your ~/.clojure/deps.edn map:

{:aliases {:find-deps {:extra-deps
                         {find-deps
                            {:git/url "https://github.com/hagmonk/find-deps",
                             :sha "6fc73813aafdd2288260abb2160ce0d4cdbac8be"}},
                       :main-opts ["-m" "find-deps.core"]}}}

You can invoke find-deps with -h to see the supported options:

% clj -A:find-deps -h
find-deps

Usage: [options*] [search-strings*]

Options:
  -s, --sources SOURCES  :clojars:mvn  Concatenated source types
  -R, --rank METHOD      :fuzzy        Ranking method - :fuzzy, :regex
  -F, --format FORMAT    :deps         Format for printing results - :deps, :merge, :table, :save, :cli
  -l, --limit NUM        1             Limit per-search results to NUM
  -h, --help

Examples

Search for a dependency like http-kit:

clj -A:find-deps http-kit
{:deps {http-kit/http-kit {:mvn/version "2.3.0"}}}

Search for multiple dependencies:

clj -A:find-deps http-kit tools.logging priority-map
{:deps
 {http-kit/http-kit {:mvn/version "2.3.0"},
  org.clojure/tools.logging {:mvn/version "0.5.0-alpha"},
  org.clojure/data.priority-map {:mvn/version "0.0.9"}}}

Chain together multiple invocations using different query arguments:

clj -A:find-deps -s:mvn roaringbitmap | clj -A:find-deps -s:clojars -R:regex -l 5 io.pedestal
{:deps
 {org.roaringbitmap/RoaringBitmap  {:mvn/version "0.7.13"},
  io.pedestal/pedestal.jetty       {:mvn/version "0.5.3"},
  io.pedestal/pedestal.tomcat      {:mvn/version "0.5.3"},
  io.pedestal/pedestal.log         {:mvn/version "0.5.3"},
  io.pedestal/pedestal.service     {:mvn/version "0.5.3"},
  io.pedestal/pedestal.interceptor {:mvn/version "0.5.3"}}}

Merge the search results into the current project’s deps.edn. You can also save these results to deps.edn by specifying :save instead.

clj -A:find-deps -F:merge http-kit tools.logging priority-map
{:paths ["src"],
 :deps
 {org.clojure/clojure           {:mvn/version "1.9.0"},
  org.clojure/tools.logging     {:mvn/version "0.5.0-alpha"},
  org.clojure/spec.alpha        {:mvn/version "0.1.143"},
  clj-fuzzy                     {:mvn/version "0.4.1"},
  http-kit                      {:mvn/version "2.3.0"},
  tools.deps.alpha
  {:git/url "https://github.com/clojure/tools.deps.alpha",
   :sha     "884d7ae5b9c228ff795e4385291708102f1cd46d"},
  metosin/jsonista              {:mvn/version "0.1.1"},
  org.clojure/data.priority-map {:mvn/version "0.0.9"},
  inflections                   {:mvn/version "0.13.0"},
  http-kit/http-kit             {:mvn/version "2.3.0"}}
;; ... snip
 }

String search returning multiple matches in a table:

clj -A:find-deps -F:table -l 10 "apache kafka"

|                              :lib | :version |
|-----------------------------------+----------|
|      org.apache.kafka/kafka-tools |    1.1.0 |
|      org.apache.kafka/kafka_2.9.2 |  0.8.2.2 |
|      org.apache.kafka/kafka_2.9.1 |  0.8.2.2 |
|      org.apache.kafka/kafka_2.8.0 |  0.8.1.1 |
|      org.apache.kafka/kafka_2.8.2 |    0.8.1 |
|    org.apache.hadoop/hadoop-kafka |    3.1.0 |
|    org.apache.kafka/kafka-streams |    1.1.0 |
|    org.apache.kafka/kafka-clients |    1.1.0 |
|   org.apache.kafka/kafka-examples |    1.1.0 |
| org.apache.kafka/kafka-perf_2.8.0 |  0.8.1.1 |

Print out a command line invocation of the deps:

clj -A:find-deps -F:cli http-kit jsonista
clojure -Sdeps '{:deps {http-kit/http-kit {:mvn/version "2.3.0"}, metosin/jsonista {:mvn/version "0.2.1"}}}'

API

The find-deps.core namespace contains a number of helpers you can use from the REPL. Assuming you have an alias for rebel-readline:

clj -A:rebel
[Rebel readline] Type :repl/help for online help info
user=> (use 'find-deps.core)
nil
user=> (print-deps "http-kit")

|              :lib | :version |
|-------------------+----------|
| http-kit/http-kit |    2.3.0 |
nil
user=> (deps "http-kit")
{:deps #:http-kit{http-kit #:mvn{:version "2.3.0"}}}

See the find-deps.core namespace for more helpers.

Future

  • [ ] search github for deps.edn files
  • [ ] search github for project.clj files
    • [ ] page rank deps based on dependency graph
    • [ ] recommended other dependencies based on clustering
  • [ ] incorporate download counts into weighting factor
  • [x] support writing directly into deps.edn
  • [ ] support add-lib
  • [ ] add validation support to cli parser
  • 1. 官网下载4.5.0.tar.gz; 地址:https://github.com/jemalloc/jemalloc/archive/4.5.0.tar.gz 2. 解压到指定目录; tar -zxvf 4.5.0.tar.gz  note:tar -zxvf 为解压指令 例如: tar -zcvf 4.5.0.tar.gz  ./ (解压到当前文件夹)             tar -zc

  • 我的原因是Cmake版本太低,我的是2.8,换成3.0以上就可以,cmake升级的教程 -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for work

  • 先说原因 这是nodejs版本太低导致的,查看electron-builder的代码可以发现,里面都是require("fs/promises") 这样的引用,但是旧版nodejs是require("fs").promises的引用方式 解决方法 1、可以通过升级nodejs的方式解决,本人在win10系统下升级为nodejs14,可以正常打包,但是公司的电脑使用的是win7,不支持nodejs的

 相关资料
  • 此方法用于搜索另一个字符串中第一次出现的字符串。 语法 (Syntax) find(string, phrase) 参数 (Parameters) string - 需要搜索的字符串值。 phrase - 这是需要在字符串中搜索的值。 返回值 (Return Value) 该方法返回字符串中第一个短语单词的单词编号。 例子 (Example) /* Main program */ option

  • 返回键的映射条目。 语法 (Syntax) 以下是语法。 (find hmap key) Parameters - 'hmap'是散列键和值的映射。 'key'是需要在地图中搜索的键。 Return Value - 返回所需键的键值对,否则返回nil。 例子 (Example) 以下是Clojure中的find示例。 (ns clojure.examples.example (:gen-c

  • 此方法用于查找地图中是否存在特定键。 语法 (Syntax) find(key,map) 参数 (Parameters) key - 这是需要转换为地图的列表。 map - 这是需要搜索密钥的映射。 返回值 (Return Value) 如果在地图中找到键,则返回该值。 例如 (For example) -module(helloworld). -export([start/0]). sta

  • find方法在集合中查找与某个条件匹配的第一个值。 语法 (Syntax) Object find(Closure closure) 参数 (Parameters) collection元素要满足的条件在闭包中指定,该闭包必须是一些布尔表达式。 Return Value - find方法返回find的第一个值,如果不存在此类元素,则返回null。 例子 (Example) 以下是此方法的使用示例

  • A version of Sequence#find which returns an AsyncHandle. Signature AsyncSequence.find = function(predicate) { /*...*/ } AsyncSequence.find = function find(predicate) { var found; var handle = thi

  • Seaches for the first element in the sequence satisfying a given predicate. Signature Sequence.find = function(predicate) { /*...*/ } Sequence.find = function find(predicate) { return this.filter(pr