cli icon indicating copy to clipboard operation
cli copied to clipboard

In a monorepo with custom dev command, `ntl dev` runs with root cwd

Open ascorbic opened this issue 2 years ago • 0 comments

Describe the bug

In a monorepo with the following structure:

  • package.json
  • packages
    • test
      • package.json
      • netlify.toml
    • vite-project
      • package.json
      • netlify.toml

..running ntl dev always has the cwd as the root of the repo. This happens whether it is run from inside packages/test or at the root, choosing test from the menu. This is confusing behaviour, and is different from the case where the framework is detected.

The only workaround is to add --cwd . to every command.

Steps to reproduce

  1. Clone https://github.com/ascorbic/monorepo-repro
  2. Run pnpm i
  3. cd to packages/test and run ntl dev. Observe pwd output
  4. cd to packages/vite-project and run ntl dev. Observe that it runs correctly: running vite inside packages/vite-project.
  5. Uncomment the command in projects/vite-project/netlify.toml
  6. Run ntl dev again. Observe that build fails

Configuration

[dev]
command = "vite"

Environment

System: OS: macOS 13.4.1 CPU: (8) arm64 Apple M1 Memory: 115.97 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm pnpm: 8.9.0 - ~/Library/pnpm/pnpm npmGlobalPackages:

ascorbic avatar Oct 31 '23 08:10 ascorbic