cli
cli copied to clipboard
`netlify serve` modifying incorrect .gitignore
Describe the bug
In a pnpm workspace, if a subdirectory is a package acting as a Netlify app, then running netlify serve should:
- create a
.netlifydirectory within that subdirectory ✅ - add
.netlifyto that subdirectory's.gitignoreif not already present ❌
Instead of modifying <package>/.gitignore, the root .gitignore gets modified with:
# Local Netlify folder
.netlify
netlify serve is already figuring out where to write .netlify to, so it should start there and look for a .gitignore that contains .netlify. If none is found, then go ahead and modify the root .gitignore or add a .gitignore for that package.
Steps to reproduce
git clone remix-run/react-router-templatesgit checkout ff303a5bd4c742104c601dc5eda4f825d10739b8(known commit that has this issue)pnpm installcd netlifypnpm buildpnpm start(you may need to updatenetlify.tomlwithpnpminstead ofnpm run)- After successful startup, exit
netlify serveand rungit status
Configuration
[build]
command = "npm run build"
publish = "build/client"
[dev]
command = "npm run dev"
framework = "vite"
# Set immutable caching for static files, because they have fingerprinted filenames
[[headers]]
for = "/assets/*"
[headers.values]
"Cache-Control" = "public, max-age=31560000, immutable"
Environment
System:
OS: macOS 15.1.1
CPU: (8) arm64 Apple M1 Pro
Memory: 928.36 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
pnpm: 9.14.4 - ~/.nvm/versions/node/v20.11.0/bin/pnpm
npmPackages:
netlify-cli: ^17.38.0 => 17.38.0