+17
-11
@@ -10,2 +10,3 @@ /*! | ||
| var ora = require('ora'); | ||
| var utils = require('./utils'); | ||
@@ -32,14 +33,18 @@ | ||
| var log = utils.log; | ||
| var name = options.spinnerName || 'reflinks'; | ||
| var start = options.spinnerStart || 'creating reference links from npm data'; | ||
| var stop = options.spinnerStop || 'created reference links from npm data'; | ||
| var color = options.color || 'green'; | ||
| var start = options.starting || 'creating reference links from npm data'; | ||
| var stop = options.finished || 'created reference links from npm data'; | ||
| // start spinner | ||
| log.spinner.startTimer(time, name, start, options); | ||
| var spinner = ora(start).start(); | ||
| utils.pkgs(names, options, function(err, arr) { | ||
| if (err) return cb(err); | ||
| spinner.color = color; | ||
| spinner.text = stop; | ||
| spinner.stop(); | ||
| // stop spinner | ||
| log.spinner.stopTimer(time, name, stop, options); | ||
| if (err) { | ||
| // let the implementor decide what to do when a package doesn't exist | ||
| cb(err, arr); | ||
| return; | ||
| } | ||
| cb(null, linkify(arr, options)); | ||
@@ -54,5 +59,6 @@ }); | ||
| function linkify(arr, options) { | ||
| return arr.reduce(function(acc, pkg) { | ||
| return utils.arrayify(arr).reduce(function(acc, pkg) { | ||
| if (!pkg.name) return acc; | ||
| pkg.homepage = utils.homepage(pkg); | ||
| var link = typeof options.template !== 'function' | ||
@@ -59,0 +65,0 @@ ? utils.reference(pkg.name, pkg.homepage) |
+6
-5
| { | ||
| "name": "reflinks", | ||
| "description": "Generate (relative) reference links for a glob of markdown files, allowing you to more easily create references from one file to another.", | ||
| "version": "0.2.6", | ||
| "version": "0.2.7", | ||
| "homepage": "https://github.com/jonschlinkert/reflinks", | ||
@@ -24,8 +24,9 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
| "dependencies": { | ||
| "lazy-cache": "^1.0.3", | ||
| "log-utils": "^0.1.2", | ||
| "lazy-cache": "^2.0.1", | ||
| "log-utils": "^0.1.4", | ||
| "markdown-reference": "^0.1.0", | ||
| "pkg-cache": "^0.1.3", | ||
| "ora": "^0.2.3", | ||
| "pkg-cache": "^0.1.4", | ||
| "pkg-homepage": "^0.1.1", | ||
| "time-diff": "^0.2.1" | ||
| "time-diff": "^0.3.1" | ||
| }, | ||
@@ -32,0 +33,0 @@ "devDependencies": { |
+4
-0
@@ -14,2 +14,6 @@ 'use strict'; | ||
| utils.arrayify = function(val) { | ||
| return val ? (Array.isArray(val) ? val : [val]) : []; | ||
| }; | ||
| /** | ||
@@ -16,0 +20,0 @@ * Expose utils |
-81
| # reflinks [](https://www.npmjs.com/package/reflinks) [](https://npmjs.org/package/reflinks) [](https://travis-ci.org/jonschlinkert/reflinks) | ||
| Generate (relative) reference links for a glob of markdown files, allowing you to more easily create references from one file to another. | ||
| ## Install | ||
| Install with [npm](https://www.npmjs.com/): | ||
| ```sh | ||
| $ npm install reflinks --save | ||
| ``` | ||
| **HEADS UP!** | ||
| The API was completely changed in v0.2. The main export is now an async function that expects a callback, and instead of globbing local files, reflinks are created from npm package names. | ||
| ## Usage | ||
| ```js | ||
| var reflinks = require('reflinks'); | ||
| reflinks(['base', 'verb', 'generate'], function(err, links) { | ||
| if (err) throw err; | ||
| console.log(links); | ||
| // results in: | ||
| // [ '[generate]: https://github.com/generate/generate', | ||
| // '[verb]: https://github.com/verbose/verb', | ||
| // '[base]: https://github.com/node-base/base' ] | ||
| }); | ||
| ``` | ||
| By default results are cached for 7 days. See [pkg-cache](https://github.com/jonschlinkert/pkg-cache) for more details and API documentation related to caching packages. | ||
| ## Related projects | ||
| You might also be interested in these projects: | ||
| * [markdown-utils](https://www.npmjs.com/package/markdown-utils): Micro-utils for creating markdown snippets. | [homepage](https://github.com/jonschlinkert/markdown-utils) | ||
| * [remarkable](https://www.npmjs.com/package/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://www.npmjs.com/package/remarkable) | [homepage](https://github.com/jonschlinkert/remarkable) | ||
| ## Contributing | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/reflinks/issues/new). | ||
| ## Building docs | ||
| Generate readme and API documentation with [verb](https://github.com/verbose/verb): | ||
| ```sh | ||
| $ npm install verb && npm run docs | ||
| ``` | ||
| Or, if [verb](https://github.com/verbose/verb) is installed globally: | ||
| ```sh | ||
| $ verb | ||
| ``` | ||
| ## Running tests | ||
| Install dev dependencies: | ||
| ```sh | ||
| $ npm install -d && npm test | ||
| ``` | ||
| ## Author | ||
| **Jon Schlinkert** | ||
| * [github/jonschlinkert](https://github.com/jonschlinkert) | ||
| * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
| ## License | ||
| Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
| Released under the [MIT license](https://github.com/jonschlinkert/reflinks/blob/master/LICENSE). | ||
| *** | ||
| _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 02, 2016._ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
75
13.64%4784
-34.59%7
16.67%4
-20%2
100%0
-100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated
Updated
Updated
Updated