Nodemon: --watch a single file

Created on 20 Feb 2014  ·  4Comments  ·  Source: remy/nodemon

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,
  system:
   { cwd: 'C:\\Stimulant\\Source\\ampm',
     useFind: false,
     useWatch: true,
     useWatchFile: false },
  required: false,
  dirs: [ 'C:\\Stimulant\\Source\\ampm' ],
  timeout: 1000,
  options:
   { scriptPosition: 0,
     dump: true,
     watch:
      [ '.',
        '../ampm-test/WPF-test/config.json',
        re: /\.|\.\./ampm\-test/WPF\-test/config\.json/ ],
     script: 'server.js',
     args: [ '../ampm-test/WPF-test/config.json' ],
     restartable: 'rs',
     ignore:
      [ '.git',
        'node_modules/**/node_modules',
        'view',
        'samples',
        'logs',
        'app',
        'content',
        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,
     execOptions:
      { script: 'server.js',
        exec: 'node',
        nodeArgs: undefined,
        ext: 'js,json',
        env: {},
        execArgs: [] },
     monitor:
      [ '*.*',
        '../ampm-test/WPF-test/config.json',
        '!C:\\Stimulant\\Source\\ampm\\.git/**/*',
        '!node_modules/**/node_modules',
        '!C:\\Stimulant\\Source\\ampm\\view/**/*',
        '!C:\\Stimulant\\Source\\ampm\\samples/**/*',
        '!logs',
        '!app',
        '!content' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ 'C:\\Stimulant\\Source\\ampm\\nodemon.json' ],
  command:
   { 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
--------------

Most helpful comment

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.

All 4 comments

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings