initial commit

This commit is contained in:
2017-05-20 16:42:43 -04:00
commit e6530a1fa6
2106 changed files with 206258 additions and 0 deletions

21
node_modules/update-notifier/check.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
var updateNotifier = require('./');
var options = JSON.parse(process.argv[2]);
var updateNotifier = new updateNotifier.UpdateNotifier(options);
updateNotifier.checkNpm(function (err, update) {
if (err) {
process.exit(1);
}
// only update the last update check time on success
updateNotifier.config.set('lastUpdateCheck', Date.now());
if (update.type && update.type !== 'latest') {
updateNotifier.config.set('update', update);
}
// Call process exit explicitly to terminate the child process
// Otherwise the child process will run forever (according to nodejs docs)
process.exit();
});

128
node_modules/update-notifier/index.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
'use strict';
var spawn = require('child_process').spawn;
var path = require('path');
var Configstore = require('configstore');
var chalk = require('chalk');
var semverDiff = require('semver-diff');
var latestVersion = require('latest-version');
var stringLength = require('string-length');
var isNpm = require('is-npm');
var repeating = require('repeating');
function UpdateNotifier(options) {
this.options = options = options || {};
options.pkg = options.pkg || {};
// deprecated options
// TODO: remove this at some point far into the future
if (options.packageName && options.packageVersion) {
options.pkg.name = options.packageName;
options.pkg.version = options.packageVersion;
}
if (!options.pkg.name || !options.pkg.version) {
throw new Error('pkg.name and pkg.version required');
}
this.packageName = options.pkg.name;
this.packageVersion = options.pkg.version;
this.updateCheckInterval = typeof options.updateCheckInterval === 'number' ? options.updateCheckInterval : 1000 * 60 * 60 * 24; // 1 day
this.hasCallback = typeof options.callback === 'function';
this.callback = options.callback || function () {};
if (!this.hasCallback) {
this.config = new Configstore('update-notifier-' + this.packageName, {
optOut: false,
// init with the current time so the first check is only
// after the set interval, so not to bother users right away
lastUpdateCheck: Date.now()
});
}
}
UpdateNotifier.prototype.check = function () {
if (this.hasCallback) {
return this.checkNpm(this.callback);
}
if (this.config.get('optOut') || 'NO_UPDATE_NOTIFIER' in process.env || process.argv.indexOf('--no-update-notifier') !== -1) {
return;
}
this.update = this.config.get('update');
if (this.update) {
this.config.del('update');
}
// Only check for updates on a set interval
if (Date.now() - this.config.get('lastUpdateCheck') < this.updateCheckInterval) {
return;
}
// Spawn a detached process, passing the options as an environment property
spawn(process.execPath, [path.join(__dirname, 'check.js'), JSON.stringify(this.options)], {
detached: true,
stdio: 'ignore'
}).unref();
};
UpdateNotifier.prototype.checkNpm = function (cb) {
latestVersion(this.packageName, function (err, latestVersion) {
if (err) {
return cb(err);
}
cb(null, {
latest: latestVersion,
current: this.packageVersion,
type: semverDiff(this.packageVersion, latestVersion) || 'latest',
name: this.packageName
});
}.bind(this));
};
UpdateNotifier.prototype.notify = function (opts) {
if (!process.stdout.isTTY || isNpm || !this.update) {
return this;
}
opts = opts || {};
opts.defer = opts.defer === undefined ? true : false;
var line1 = ' Update available: ' + chalk.green.bold(this.update.latest) +
chalk.dim(' (current: ' + this.update.current + ')') + ' ';
var line2 = ' Run ' + chalk.blue('npm install -g ' + this.packageName) +
' to update. ';
var contentWidth = Math.max(stringLength(line1), stringLength(line2));
var line1rest = contentWidth - stringLength(line1);
var line2rest = contentWidth - stringLength(line2);
var top = chalk.yellow('┌' + repeating('─', contentWidth) + '┐');
var bottom = chalk.yellow('└' + repeating('─', contentWidth) + '┘');
var side = chalk.yellow('│');
var message =
'\n\n' +
top + '\n' +
side + line1 + repeating(' ', line1rest) + side + '\n' +
side + line2 + repeating(' ', line2rest) + side + '\n' +
bottom + '\n';
if (opts.defer) {
process.on('exit', function () {
console.error(message);
});
} else {
console.error(message);
}
return this;
};
module.exports = function (options) {
var updateNotifier = new UpdateNotifier(options);
updateNotifier.check();
return updateNotifier;
};
module.exports.UpdateNotifier = UpdateNotifier;

126
node_modules/update-notifier/package.json generated vendored Normal file
View File

@@ -0,0 +1,126 @@
{
"_args": [
[
{
"raw": "update-notifier@0.5.0",
"scope": null,
"escapedName": "update-notifier",
"name": "update-notifier",
"rawSpec": "0.5.0",
"spec": "0.5.0",
"type": "version"
},
"C:\\Users\\chvra\\Documents\\angular-play\\nodeRest\\node_modules\\nodemon"
]
],
"_from": "update-notifier@0.5.0",
"_id": "update-notifier@0.5.0",
"_inCache": true,
"_location": "/update-notifier",
"_nodeVersion": "0.12.2",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.9.0",
"_phantomChildren": {},
"_requested": {
"raw": "update-notifier@0.5.0",
"scope": null,
"escapedName": "update-notifier",
"name": "update-notifier",
"rawSpec": "0.5.0",
"spec": "0.5.0",
"type": "version"
},
"_requiredBy": [
"/nodemon"
],
"_resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-0.5.0.tgz",
"_shasum": "07b5dc2066b3627ab3b4f530130f7eddda07a4cc",
"_shrinkwrap": null,
"_spec": "update-notifier@0.5.0",
"_where": "C:\\Users\\chvra\\Documents\\angular-play\\nodeRest\\node_modules\\nodemon",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/yeoman/update-notifier/issues"
},
"dependencies": {
"chalk": "^1.0.0",
"configstore": "^1.0.0",
"is-npm": "^1.0.0",
"latest-version": "^1.0.0",
"repeating": "^1.1.2",
"semver-diff": "^2.0.0",
"string-length": "^1.0.0"
},
"description": "Update notifications for your CLI app",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "07b5dc2066b3627ab3b4f530130f7eddda07a4cc",
"tarball": "https://registry.npmjs.org/update-notifier/-/update-notifier-0.5.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"check.js"
],
"gitHead": "ec4323d700f65cca27bf6e101ea44c2f918ac2bc",
"homepage": "https://github.com/yeoman/update-notifier#readme",
"keywords": [
"npm",
"update",
"updater",
"notify",
"notifier",
"check",
"checker",
"cli",
"module",
"package",
"version"
],
"license": "BSD-2-Clause",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "addyosmani",
"email": "addyosmani@gmail.com"
},
{
"name": "passy",
"email": "phartig@rdrei.net"
},
{
"name": "sboudrias",
"email": "admin@simonboudrias.com"
},
{
"name": "eddiemonge",
"email": "eddie+npm@eddiemonge.com"
}
],
"name": "update-notifier",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/yeoman/update-notifier.git"
},
"scripts": {
"test": "mocha --timeout 20000"
},
"version": "0.5.0"
}

152
node_modules/update-notifier/readme.md generated vendored Normal file
View File

@@ -0,0 +1,152 @@
# update-notifier [![Build Status](https://travis-ci.org/yeoman/update-notifier.svg?branch=master)](https://travis-ci.org/yeoman/update-notifier)
> Update notifications for your CLI app
![](screenshot.png)
Inform users of your package of updates in a non-intrusive way.
#### Table of Contents
- [Examples](#examples)
- [How](#how)
- [API](#api)
- [About](#about)
## Examples
### Simple example
```js
var updateNotifier = require('update-notifier');
var pkg = require('./package.json');
updateNotifier({pkg: pkg}).notify();
```
### Comprehensive example
```js
var updateNotifier = require('update-notifier');
var pkg = require('./package.json');
// Checks for available update and returns an instance
var notifier = updateNotifier({pkg: pkg});
// Notify using the built-in convenience method
notifier.notify();
// `notifier.update` contains some useful info about the update
console.log(notifier.update);
/*
{
latest: '1.0.1',
current: '1.0.0',
type: 'patch', // possible values: latest, major, minor, patch, prerelease, build
name: 'pageres'
}
*/
```
### Example with settings and custom message
```js
var notifier = updateNotifier({
pkg: pkg,
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
});
console.log('Update available: ' + notifier.update.latest);
```
## How
Whenever you initiate the update notifier and it's not within the interval threshold, it will asynchronously check with npm in the background for available updates, then persist the result. The next time the notifier is initiated the result will be loaded into the `.update` property. This prevents any impact on your package startup performance.
The check process is done in a unref'ed [child process](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). This means that if you call `process.exit`, the check will still be performed in its own process.
## API
### updateNotifier(options)
Checks if there is an available update. Accepts settings defined below. Returns an object with update info if there is an available update, otherwise `undefined`.
### options
#### pkg
Type: `object`
##### name
*Required*
Type: `string`
##### version
*Required*
Type: `string`
#### updateCheckInterval
Type: `number`
Default: `1000 * 60 * 60 * 24` (1 day)
How often to check for updates.
#### callback(error, update)
Type: `function`
Passing a callback here will make it check for an update directly and report right away. Not recommended as you won't get the benefits explained in [`How`](#how).
`update` is equal to `notifier.update`
### updateNotifier.notify([options])
Convenience method to display a notification message *(see screenshot)*.
Only notifies if there is an update and the process is [TTY](http://nodejs.org/api/tty.html).
#### options.defer
Type: `boolean`
Default: `true`
Defer showing the notication to after the process has exited.
### User settings
Users of your module have the ability to opt-out of the update notifier by changing the `optOut` property to `true` in `~/.config/configstore/update-notifier-[your-module-name].yml`. The path is available in `notifier.config.path`.
Users can also opt-out by [setting the environment variable](https://github.com/sindresorhus/guides/blob/master/set-environment-variables.md) `NO_UPDATE_NOTIFIER` with any value or by using the `--no-update-notifier` flag on a per run basis.
## About
The idea for this module came from the desire to apply the browser update strategy to CLI tools, where everyone is always on the latest version. We first tried automatic updating, which we discovered wasn't popular. This is the second iteration of that idea, but limited to just update notifications.
There are a bunch projects using it:
- [Yeoman](http://yeoman.io) - modern workflows for modern webapps
- [Bower](http://bower.io) - a package manager for the web
- [Pageres](https://github.com/sindresorhus/pageres) - responsive website screenshots
- [Node GH](http://nodegh.io) - GitHub command line tool
- [Hoodie CLI](http://hood.ie) - Hoodie command line tool
- [Roots](http://roots.cx) - a toolkit for advanced front-end development
[And 100+ more...](https://www.npmjs.org/browse/depended/update-notifier)
## License
[BSD license](http://opensource.org/licenses/bsd-license.php) and copyright Google