remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.22k stars 1.72k forks source link

Changes to directories outside cwd are not detected on Win10/powershell #1998

Closed martinsik closed 2 years ago

martinsik commented 2 years ago

Expected behaviour

Script will restart after making changes in a watched directory that is specified usign a relative path from cwd.

Actual behaviour

Changes are not detected. Only changes to subdirectories from cwd ./ are detected. While using "legacyWatch: true" changes are properly detected.

This issue seems to be similar: https://github.com/remy/nodemon/issues/909

Steps to reproduce

I have the following nodemon.json:

{
  "execMap": {
    "ts": "node --inspect=9230 -r ts-node/register -r tsconfig-paths/register"
  },
  "delay": 1000,
  "watch": [
    "./src",
    "./environment",
    "../backend/src",
    "../core/.build",
    "../utils/.build",
    "../export-module/.build",
    "../file-storage/.build"
  ],
}

When I make a change (recompile) file in any directory starting with ../ (outside cwd) for example in ../utils/.build the change is not detected while making changes in ./src or ./environments is detected properly.

When I add "legacyWatch": true then changes in any directory are detected as expected.


--------------
node: v16.13.0
nodemon: 2.0.15
command: <>\nodemon\bin\nodemon.js src/main.ts --dump
cwd: dir
OS: win32 x64
--------------
{
  run: false,
  system: { cwd: 'dir\\jobs-server' },
  required: false,
  dirs: [
    'dir\\jobs-server\\src',
    'dir\\jobs-server\\environment',
    'dir\\backend\\src',
    'dir\\core\\.build',
    'dir\\utils\\.build',
    'dir\\translations-export-module\\.build',
    'dir\\file-storage\\.build'
  ],
  timeout: 1000,
  options: {
    dump: true,
    execMap: {
      ts: 'node --inspect=9230 -r ts-node/register -r tsconfig-paths/register',
      py: 'python',
      rb: 'ruby'
    },
    delay: 1000,
    watch: [
      './src',
      './environment',
      '../backend/src',
      '../core/.build',
      '../utils/.build',
      '../export-module/.build',
      '../file-storage/.build',
      re: /\.\/src|\.\/environment|\.\.\/backend\/src|\.\.\/core\/\.build|\.\.\/utils\/\.build|\.\.\/translations\-export\-module\/\.build|\.\.\/file\-storage\/\.build/
    ],
    legacyWatch: true,
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    monitor: [
      'dir\\jobs-server\\src/**/*',
      'dir\\jobs-server\\environment/**/*',
      'dir\\backend\\src/**/*',
      'dir\\core\\.build/**/*',
      'dir\\utils\\.build/**/*',
      'dir\\export-module\\.build/**/*',
      'dir\\file-storage\\.build/**/*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: 'src/main.ts',
      exec: 'node --inspect=9230 -r ts-node/register -r tsconfig-paths/register',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'ts,json',
      env: {}
    }
  },
  load: [Function (anonymous)],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [
    'dir\\jobs-server\\nodemon.json'
  ],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: {
      executable: 'node --inspect=9230 -r ts-node/register -r tsconfig-paths/register',
      args: [ 'src/main.ts' ]
    },
    string: 'node --inspect=9230 -r ts-node/register -r tsconfig-paths/register src/main.ts'
  }
}
--------------
github-actions[bot] commented 2 years ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

github-actions[bot] commented 2 years ago

Automatically closing this issue due to lack of activity