fix: Replace jade references by pug

close #1595
This commit is contained in:
Aurélio A. Heckert
2019-10-15 15:40:28 -03:00
committed by Remy Sharp
parent 74c8749bb5
commit 7d6c1a88a1
12 changed files with 61 additions and 61 deletions

View File

@@ -178,10 +178,10 @@ Don't use unix globbing to pass multiple directories, e.g `--watch ./lib/*`, it
By default, nodemon looks for files with the `.js`, `.mjs`, `.coffee`, `.litcoffee`, and `.json` extensions. If you use the `--exec` option and monitor `app.py` nodemon will monitor files with the extension of `.py`. However, you can specify your own list with the `-e` (or `--ext`) switch like so:
```bash
nodemon -e js,jade
nodemon -e js,pug
```
Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.jade`.
Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.pug`.
## Ignoring files

View File

@@ -3,7 +3,7 @@
Options:
--config file ............ alternate nodemon.json config file to use
-e, --ext ................ extensions to look for, ie. js,jade,hbs.
-e, --ext ................ extensions to look for, ie. js,pug,hbs.
-x, --exec app ........... execute script with "app", ie. -x "python -v".
-w, --watch path.......... watch directory "path" or files. use once for
each directory or file to watch.

View File

@@ -12,7 +12,7 @@ Configuration
Execution
-C, --on-change-only ..... execute script on change only, not startup
--cwd <dir> .............. change into <dir> before running the script
-e, --ext ................ extensions to look for, ie. "js,jade,hbs"
-e, --ext ................ extensions to look for, ie. "js,pug,hbs"
-I, --no-stdin ........... nodemon passes stdin directly to child process
--spawn .................. force nodemon to use spawn (over fork) [node only]
-x, --exec app ........... execute script with "app", ie. -x "python -v"

View File

@@ -198,7 +198,7 @@ function exec(nodemonOptions, execMap) {
}
// allow users to make a mistake on the extension to monitor
// converts .js, jade => js,jade
// converts .js, pug => js,pug
// BIG NOTE: user can't do this: nodemon -e *.js
// because the terminal will automatically expand the glob against
// the file system :(

70
package-lock.json generated
View File

@@ -296,6 +296,7 @@
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
"dev": true,
"optional": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
@@ -1885,7 +1886,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -1903,11 +1905,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -1920,15 +1924,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -2031,7 +2038,8 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@@ -2041,6 +2049,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -2053,17 +2062,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -2080,6 +2092,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -2152,7 +2165,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -2162,6 +2176,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -2237,7 +2252,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -2267,6 +2283,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -2284,6 +2301,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -2322,11 +2340,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@@ -3300,30 +3320,6 @@
"is-object": "^1.0.1"
}
},
"jade": {
"version": "0.26.3",
"resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz",
"integrity": "sha1-jxDXl32NefL2/4YqgbBRPMslaGw=",
"dev": true,
"requires": {
"commander": "0.6.1",
"mkdirp": "0.3.0"
},
"dependencies": {
"commander": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz",
"integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=",
"dev": true
},
"mkdirp": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz",
"integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=",
"dev": true
}
}
},
"js-yaml": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
@@ -3746,7 +3742,8 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true
"dev": true,
"optional": true
},
"loud-rejection": {
"version": "1.6.0",
@@ -3937,7 +3934,6 @@
"escape-string-regexp": "1.0.2",
"glob": "3.2.11",
"growl": "1.9.2",
"jade": "0.26.3",
"mkdirp": "0.5.1",
"supports-color": "1.2.0",
"to-iso-string": "0.0.2"

View File

@@ -83,14 +83,14 @@ describe('nodemon exec', function () {
});
it('should support multiple extensions', function () {
var options = exec({ script: 'app.js', ext: 'js, jade, hbs' });
var options = exec({ script: 'app.js', ext: 'js, pug, hbs' });
var cmd = toCmd(options);
assert(cmd.string === 'node app.js', cmd.string);
assert(options.ext.indexOf('jade') !== -1, 'comma separated string');
assert(options.ext.indexOf('pug') !== -1, 'comma separated string');
options = exec({ script: 'app.js', ext: 'js|jade|hbs' });
options = exec({ script: 'app.js', ext: 'js|pug|hbs' });
assert(options.exec === 'node');
assert(options.ext.indexOf('jade') !== -1, 'pipe separated string');
assert(options.ext.indexOf('pug') !== -1, 'pipe separated string');
});
it('should support watching all extensions', function () {
@@ -123,14 +123,14 @@ describe('nodemon exec', function () {
});
it('should support extension maps', function () {
var options = exec({ script: 'template.jade' }, { 'jade': 'jade {{filename}} --out /tmp' });
var options = exec({ script: 'template.pug' }, { 'pug': 'pug {{filename}} --out /tmp' });
var cmd = toCmd(options);
assert(cmd.string === 'jade template.jade --out /tmp', cmd.string);
assert(cmd.string === 'pug template.pug --out /tmp', cmd.string);
});
it('should support input from argv#parse', function () {
var parse = require('../../lib/cli/parse');
parse('node /usr/local/bin/nodemon.js --debug -e js,jade,hbs app.js'.split(' '));
parse('node /usr/local/bin/nodemon.js --debug -e js,pug,hbs app.js'.split(' '));
});
it('should use coffeescript on .coffee', function () {
@@ -186,10 +186,10 @@ describe('nodemon exec', function () {
});
it('should support single-level file extensions', function () {
var options = exec({ ext: '.js, jade' });
var options = exec({ ext: '.js, pug' });
assert(options.ext.indexOf('js') !== -1);
assert(options.ext.indexOf('jade') !== -1);
assert(options.ext.indexOf('pug') !== -1);
});
it('should expand app to app.js', function () {

View File

@@ -229,7 +229,7 @@ describe('nodemon argument parser', function () {
});
it('should support short versions of flags', function () {
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e jade -s SIGHUP');
var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e pug -s SIGHUP');
assert(settings.version, 'version');
assert(settings.verbose, 'verbose');
assert(settings.exec === 'java', 'exec');
@@ -239,13 +239,13 @@ describe('nodemon argument parser', function () {
assert(settings.ignore[0] === 'fixtures', 'ignore');
assert(settings.delay === 5000, 'delay 5 seconds');
assert(settings.runOnChangeOnly, 'run on change only');
assert(settings.ext === 'jade', 'extension is jade');
assert(settings.ext === 'pug', 'extension is pug');
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
});
it('should support long versions of flags', function () {
var settings = cli.parse('node nodemon --version --exec java --verbose --quiet --watch fixtures --ignore fixtures --no-stdin --delay 5 --legacy-watch --exitcrash --on-change-only --ext jade --config my/.nodemon.json --signal SIGHUP');
var settings = cli.parse('node nodemon --version --exec java --verbose --quiet --watch fixtures --ignore fixtures --no-stdin --delay 5 --legacy-watch --exitcrash --on-change-only --ext pug --config my/.nodemon.json --signal SIGHUP');
assert(settings.version, 'version');
assert(settings.verbose, 'verbose');
assert(settings.exec === 'java', 'exec');
@@ -256,7 +256,7 @@ describe('nodemon argument parser', function () {
assert(settings.ignore[0] === 'fixtures', 'ignore');
assert(settings.delay === 5000, 'delay 5 seconds');
assert(settings.runOnChangeOnly, 'run on change only');
assert(settings.ext === 'jade', 'extension is jade');
assert(settings.ext === 'pug', 'extension is pug');
assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json');
assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');
});

View File

@@ -97,8 +97,8 @@ describe('config load', function () {
assert(config.verbose, 'we are verbose');
// ensure global mapping works too
var options = exec({ script: 'template.jade' }, config.execMap);
assert(options.exec === 'bin/jade template.jade --out /tmp', 'exec used, should be "bin/jade": ' + options.exec);
var options = exec({ script: 'template.pug' }, config.execMap);
assert(options.exec === 'bin/pug template.pug --out /tmp', 'exec used, should be "bin/pug": ' + options.exec);
done();

View File

@@ -2,6 +2,6 @@
"verbose": true,
"ignore": ["one", "two"],
"execMap": {
"jade": "bin/jade {{filename}} --out /tmp"
"pug": "bin/pug {{filename}} --out /tmp"
}
}
}

View File

@@ -12,6 +12,7 @@
"cookie-parser": "~1.0.1",
"body-parser": "~1.0.0",
"debug": "~0.7.4",
"jade": "~1.3.0"
"pug": "~2.0.4",
"pug-cli": "~1.0.0"
}
}

View File

@@ -5719,6 +5719,9 @@
"text/jade": {
"extensions": ["jade"]
},
"text/pug": {
"extensions": ["pug"]
},
"text/javascript": {
"source": "iana",
"compressible": true

View File

@@ -222,7 +222,7 @@ describe('match', function() {
it('should be specific about directories', function(done) {
config.load(
{
ext: 'js md jade',
ext: 'js md pug',
watch: ['lib'],
},
function(config) {