Skip to content

Commit

Permalink
fix: Replace jade references by pug
Browse files Browse the repository at this point in the history
close remy#1595
  • Loading branch information
aurium authored and remy committed Oct 15, 2019
1 parent 74c8749 commit 7d6c1a8
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 61 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/cli/help.txt
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/cli/options.txt
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/config/exec.js
Expand Up @@ -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 :(
Expand Down
70 changes: 33 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions test/cli/exec.test.js
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down
8 changes: 4 additions & 4 deletions test/cli/parse.test.js
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
});
Expand Down
4 changes: 2 additions & 2 deletions test/config/load.test.js
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/global/nodemon.json
Expand Up @@ -2,6 +2,6 @@
"verbose": true,
"ignore": ["one", "two"],
"execMap": {
"jade": "bin/jade {{filename}} --out /tmp"
"pug": "bin/pug {{filename}} --out /tmp"
}
}
}
3 changes: 2 additions & 1 deletion test/fixtures/packages/express4/package.json
Expand Up @@ -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"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/monitor/match.test.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 7d6c1a8

Please sign in to comment.