Repository: remy/nodemon
Pull request #1178 (2017-12-18 12:09:08)

chore: add .npmrc which explicitly enables package-lock; some minor doc tweaks
I also noticed that `jshint` gives a ton of errors when used with the `.jshintrc` in the repo - is still worth keeping around as it seems it is not used anyways?

remy: This npmrc file will be blown away during the Travis process. Is that expected?
dominykas: Ah. Travis writes an auth-token in it... which means Travis will be using default npm settings (and this is the default), so I guess it does no harm? Do you allow Travis to push back to the repo for semantic release (I don't know how all of that stuff works)? If so - then it might remove this file... or even worse - commit the credentials it used into the repo?
dominykas: I can update `.travis.yml` to use `>>` rather than `>`... npm ignores it by default when publishing, so as long as semantic-release does not push back to the repo - it should be fine?
remy: No, Travis doesn't push back, only deploys to npm, but yeah, if it's going to ensure the package-lock contents then it makes sense for the Travis yml file to append. 

Patch:
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index a38d9e9..aa8b7ed 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -2,7 +2,7 @@
 
 ## Commit messages
 
-Commit messages must follow the [Angular-style](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) commit format (but excluding the scope).
+Commit messages must follow the [Angular-style](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) commit format (but excluding the scope).
 
 i.e:
 
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000..cafe685
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1,1 @@
+package-lock=true
diff --git a/.travis.yml b/.travis.yml
index bb67afe..a4a7dcd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,7 @@ node_js:
   - '6'
   - '4'
 before_install:
-  - if [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]; then echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc; fi
+  - if [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]; then echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> .npmrc; fi
 after_success:
   - npm run semantic-release
 branches:
diff --git a/faq.md b/faq.md
index 1e1984f..ecb1d90 100644
--- a/faq.md
+++ b/faq.md
@@ -97,12 +97,14 @@ Now when ignoring `public`, the ignore rule results in `['.git', 'public']`, and
 
 Fedora is looking for `nodejs` rather than `node` which is the binary that nodemon kicks off.
 
-The solution is a simple workaround, Linux 101:
+A workaround is to make sure that `node` binary exists in the `PATH`:
 
 ```bash
 sudo ln -s /usr/bin/nodejs /usr/local/bin/node
 ```
 
+Alternatively the `--exec nodejs` option can be used. 
+
 Fedora and Ubuntu pakage node as nodejs, because node.dpkg is
 
 > Description-en: Amateur Packet Radio Node program
diff --git a/lib/config/exec.js b/lib/config/exec.js
index 09c15c0..852186f 100644
--- a/lib/config/exec.js
+++ b/lib/config/exec.js
@@ -97,7 +97,11 @@ function exec(nodemonOptions, execMap) {
   var script = path.basename(options.script || '');
 
   var scriptExt = path.extname(script).slice(1);
-  var extension = options.ext || (scriptExt ? scriptExt + ',json' : 'js,json');
+
+  var extension = options.ext !== undefined ?
+      options.ext :
+      (scriptExt ? scriptExt + ',json' : 'js,json');
+
   var execDefined = !!options.exec;
 
   // allows the user to simplify cli usage:
@@ -164,7 +168,7 @@ function exec(nodemonOptions, execMap) {
 
   if (options.exec === 'coffee') {
     // don't override user specified extension tracking
-    if (!options.ext) {
+    if (options.ext === undefined) {
       extension = 'coffee,litcoffee,js,json,mjs';
     }
 
@@ -186,8 +190,8 @@ function exec(nodemonOptions, execMap) {
   options.ext = extension;
 
   if (options.script) {
-    options.script = expandScript(options.script, '.' +
-      extension.split(',')[0]);
+    options.script = expandScript(options.script,
+      extension && ('.' + extension.split(',')[0]));
   }
 
   options.env = {};
diff --git a/lib/nodemon.js b/lib/nodemon.js
index 5e5f4e8..c2f8973 100644
--- a/lib/nodemon.js
+++ b/lib/nodemon.js
@@ -150,7 +150,7 @@ function nodemon(settings) {
       return rule.slice(0, 1) !== '!' ? rule : false;
     }).filter(Boolean).join(' '));
 
-    utils.log.detail('watching extensions: ' + config.options.execOptions.ext);
+    utils.log.detail('watching extensions: ' + (config.options.execOptions.ext || '(all)'));
 
     if (config.options.dump) {
       utils.log._log('log', '--------------');


Test patch:
diff --git a/test/cli/exec.test.js b/test/cli/exec.test.js
index d66ea34..6765b8b 100644
--- a/test/cli/exec.test.js
+++ b/test/cli/exec.test.js
@@ -93,6 +93,20 @@ describe('nodemon exec', function () {
     assert(options.ext.indexOf('jade') !== -1, 'pipe separated string');
   });
 
+  it('should support watching all extensions', function () {
+    var options = exec({ script: 'app.js', ext: '' });
+    assert.equal(options.ext, '', 'does not set default extensions when empty extension requested');
+
+    options = exec({ script: 'app.js', ext: '.' });
+    assert.equal(options.ext, '', 'treats `.` as wildcard extension');
+
+    options = exec({ script: 'app.js', ext: '*' });
+    assert.equal(options.ext, '', 'treats `*` as wildcard extension');
+
+    options = exec({ script: 'app.coffee', exec: 'coffee', ext: '' });
+    assert.equal(options.ext, '', 'does not set default extensions when empty extension requested');
+  });
+
   it('should replace {{filename}}', function () {
     var options = exec({ script: 'app.js', exec: 'node {{filename}}.tmp --somethingElse' });
 
@@ -182,6 +196,10 @@ describe('nodemon exec', function () {
     var options = exec({ script: 'app' });
     var cmd = toCmd(options);
     assert(cmd.string === 'node app.js', cmd.string);
+
+    options = exec({ script: 'app', ext: '' });
+    cmd = toCmd(options);
+    assert(cmd.string === 'node app.js', cmd.string);
   });
 
   it('should expand based on custom extensions to hello.py', function () {