Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netlify serve modifying incorrect .gitignore #6958

Open
pcattori opened this issue Dec 10, 2024 · 0 comments
Open

netlify serve modifying incorrect .gitignore #6958

pcattori opened this issue Dec 10, 2024 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@pcattori
Copy link

pcattori commented Dec 10, 2024

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 .netlify directory within that subdirectory ✅
  • add .netlify to that subdirectory's .gitignore if 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

  1. git clone remix-run/react-router-templates
  2. git checkout ff303a5bd4c742104c601dc5eda4f825d10739b8 (known commit that has this issue)
  3. pnpm install
  4. cd netlify
  5. pnpm build
  6. pnpm start (you may need to update netlify.toml with pnpm instead of npm run)
  7. After successful startup, exit netlify serve and run git 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
@pcattori pcattori added the type: bug code to address defects in shipped code label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant