refactor: remove libraries over native es6 support

This commit is contained in:
Remy Sharp
2017-12-16 11:01:44 +00:00
parent 35b86a92e1
commit 67d146637e
5 changed files with 51 additions and 59 deletions

View File

@@ -9,9 +9,8 @@ nodemon(options);
var fs = require('fs');
// checks for available update and returns an instance
var defaults = require('lodash.defaults');
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
require('update-notifier')({
pkg: defaults(pkg, { version: '0.0.0' }),
pkg: Object.assign(pkg, { version: '0.0.0' }),
}).notify();

View File

@@ -3,7 +3,6 @@ module.exports.resetWatchers = resetWatchers;
var debug = require('debug')('nodemon:watch');
var debugRoot = require('debug')('nodemon');
var Promise = require('es6-promise').Promise; // jshint ignore:line
var chokidar = require('chokidar');
var undefsafe = require('undefsafe');
var config = require('../config');
@@ -149,7 +148,7 @@ function filterAndRestart(files) {
files.find(file => {
if (file.substr(-length, length) === script) {
matched = {
result: [ file ],
result: [file],
total: 1,
}
return true;

View File

@@ -4,7 +4,6 @@ module.exports.pin = pin;
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
var Promise = require('es6-promise').Promise; // jshint ignore:line
var root = null;
function pin() {
@@ -17,39 +16,39 @@ function version(callback) {
// first find the package.json as this will be our root
var promise = findPackage(path.dirname(module.parent.filename))
.then(function (dir) {
// now try to load the package
var v = require(path.resolve(dir, 'package.json')).version;
// now try to load the package
var v = require(path.resolve(dir, 'package.json')).version;
if (v && v !== '0.0.0') {
return v;
}
root = dir;
// else we're in development, give the commit out
// get the last commit and whether the working dir is dirty
var promises = [
branch().catch(function () { return 'master'; }),
commit().catch(function () { return '<none>'; }),
dirty().catch(function () { return 0; }),
];
// use the cached result as the export
return Promise.all(promises).then(function (res) {
var branch = res[0];
var commit = res[1];
var dirtyCount = parseInt(res[2], 10);
var curr = branch + ': ' + commit;
if (dirtyCount !== 0) {
curr += ' (' + dirtyCount + ' dirty files)';
if (v && v !== '0.0.0-development') {
return v;
}
return curr;
root = dir;
// else we're in development, give the commit out
// get the last commit and whether the working dir is dirty
var promises = [
branch().catch(function () { return 'master'; }),
commit().catch(function () { return '<none>'; }),
dirty().catch(function () { return 0; }),
];
// use the cached result as the export
return Promise.all(promises).then(function (res) {
var branch = res[0];
var commit = res[1];
var dirtyCount = parseInt(res[2], 10);
var curr = branch + ': ' + commit;
if (dirtyCount !== 0) {
curr += ' (' + dirtyCount + ' dirty files)';
}
return curr;
});
}).catch(function (error) {
console.log(error.stack);
throw error;
});
}).catch(function (error) {
console.log(error.stack);
throw error;
});
if (callback) {
promise.then(function (res) {
@@ -97,5 +96,5 @@ function branch() {
function dirty() {
return command('expr $(git status --porcelain 2>/dev/null| ' +
'egrep "^(M| M)" | wc -l)');
}
'egrep "^(M| M)" | wc -l)');
}

39
package-lock.json generated
View File

@@ -1061,11 +1061,6 @@
"is-arrayish": "0.2.1"
}
},
"es6-promise": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
"integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM="
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
@@ -3329,6 +3324,7 @@
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz",
"integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=",
"dev": true,
"requires": {
"lodash._basecopy": "3.0.1",
"lodash.keys": "3.1.2"
@@ -3337,17 +3333,20 @@
"lodash._basecopy": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
"integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY="
"integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=",
"dev": true
},
"lodash._bindcallback": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz",
"integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4="
"integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=",
"dev": true
},
"lodash._createassigner": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz",
"integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=",
"dev": true,
"requires": {
"lodash._bindcallback": "3.0.1",
"lodash._isiterateecall": "3.0.9",
@@ -3357,12 +3356,14 @@
"lodash._getnative": {
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U="
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=",
"dev": true
},
"lodash._isiterateecall": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
"integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw="
"integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=",
"dev": true
},
"lodash._reinterpolate": {
"version": "3.0.0",
@@ -3374,35 +3375,30 @@
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz",
"integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=",
"dev": true,
"requires": {
"lodash._baseassign": "3.2.0",
"lodash._createassigner": "3.1.1",
"lodash.keys": "3.1.2"
}
},
"lodash.defaults": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-3.1.2.tgz",
"integrity": "sha1-xzCLGNv4vJNy1wGnNJPGEZK9Liw=",
"requires": {
"lodash.assign": "3.2.0",
"lodash.restparam": "3.6.1"
}
},
"lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
"integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo="
"integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=",
"dev": true
},
"lodash.isarray": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
"integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U="
"integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=",
"dev": true
},
"lodash.keys": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz",
"integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=",
"dev": true,
"requires": {
"lodash._getnative": "3.9.1",
"lodash.isarguments": "3.1.0",
@@ -3412,7 +3408,8 @@
"lodash.restparam": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz",
"integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU="
"integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=",
"dev": true
},
"lodash.template": {
"version": "4.4.0",

View File

@@ -55,9 +55,7 @@
"@remy/pstree": "^1.1.0",
"chokidar": "^1.7.0",
"debug": "^2.6.8",
"es6-promise": "^3.3.1",
"ignore-by-default": "^1.0.1",
"lodash.defaults": "^3.1.2",
"minimatch": "^3.0.4",
"touch": "^3.1.0",
"undefsafe": "0.0.3",