--watch a single file #299

endquote opened this Issue Feb 20, 2014 · 4 comments


3 participants

I'd like to watch all the files in a given directory and a single file in another. It looks like this isn't supported.

C:\Stimulant\Source\ampm>nodemon --dump --watch . --watch ../ampm-test/WPF-test/
config.json server.js ../ampm-test/WPF-test/config.json
20 Feb 11:33:38 - [nodemon] v1.0.15
20 Feb 11:33:38 - [nodemon] to restart at any time, enter `rs`
20 Feb 11:33:38 - [nodemon] watching: *.* ../ampm-test/WPF-test/config.json
{ run: false,
   { cwd: 'C:\\Stimulant\\Source\\ampm',
     useFind: false,
     useWatch: true,
     useWatchFile: false },
  required: false,
  dirs: [ 'C:\\Stimulant\\Source\\ampm' ],
  timeout: 1000,
   { scriptPosition: 0,
     dump: true,
      [ '.',
        re: /\.|\.\./ampm\-test/WPF\-test/config\.json/ ],
     script: 'server.js',
     args: [ '../ampm-test/WPF-test/config.json' ],
     restartable: 'rs',
      [ '.git',
        re: /\.git|node_modules/.*.*/node_modules|view|samples|logs|app|content/
     verbose: false,
     ext: 'js,json',
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     stdout: true,
      { script: 'server.js',
        exec: 'node',
        nodeArgs: undefined,
        ext: 'js,json',
        env: {},
        execArgs: [] },
      [ '*.*',
        '!content' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ 'C:\\Stimulant\\Source\\ampm\\nodemon.json' ],
   { raw:
      { executable: 'node',
        args: [ 'server.js', '../ampm-test/WPF-test/config.json' ] },
     string: 'node server.js ../ampm-test/WPF-test/config.json' } }
OS: win32 x64
node: v0.10.26
nodemon: v1.0.15
cwd: C:\Stimulant\Source\ampm
command: node C:\Users\josh.STIMULANT\AppData\Roaming\npm\node_modules\nodemon\b
in\nodemon.js --dump --watch . --watch ../ampm-test/WPF-test/config.json server.
js ../ampm-test/WPF-test/config.json

remy commented Feb 20, 2014

Hmm, the output from the monitor setting looks right. I'll have to create a test that has this layout to check it and debug myself.

endquote commented Mar 1, 2014

Simpler repro...

C:\Stimulant\Source\ampm>nodemon server.js --watch ../ampm-test/WPF-test/config.json ../ampm-test/WPF-test/config.json
1 Mar 12:01:33 - [nodemon] v1.0.15
1 Mar 12:01:33 - [nodemon] to restart at any time, enter `rs`
1 Mar 12:01:33 - [nodemon] watching: ../ampm-test/WPF-test/config.json
1 Mar 12:01:33 - [nodemon] starting `node server.js ../ampm-test/WPF-test/config.json`

Now I'm telling it to just watch the one file. The output looks like it's doing the right thing, but nothing happens when the json file changes.

endquote commented Mar 1, 2014

Even with an absolute path, nothing happens when the file changes.

C:\Stimulant\Source\ampm>nodemon server.js --watch C:\Stimulant\Source\ampm-test\WPF-test\config.json ../ampm-test/WPF-test/config.json
1 Mar 12:03:03 - [nodemon] v1.0.15
1 Mar 12:03:03 - [nodemon] to restart at any time, enter `rs`
1 Mar 12:03:03 - [nodemon] watching: C:\Stimulant\Source\ampm-test\WPF-test\config.json
1 Mar 12:03:03 - [nodemon] starting `node server.js ../ampm-test/WPF-test/config.json`

Have you tried specifying the extension? See #308.

@remy remy added a commit that referenced this issue Mar 19, 2014

@remy remy -w <single file> ignores extension filter
Fixes #299 and fixes #308.

This means if you use nodemon to monitor a .js script, but explicitly watch another file (that isn't .js) then nodemon *will* restart as expected.

remy closed this in #314 Mar 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment