Eva
Eva15h ago

`npx convex dev` always adds `.env.local` to `.gitignore`?

Hey team! I'm working on an open source repo that requires contributors to initialize Convex on their local machines. I've noticed a few contributors push code that adds .env.local at the bottom of .gitignore, even though it's already listed above. I think this is being added automatically during the initialization process. Is there a way to disable this, or to improve the .gitignore pattern matching so it doesn't get added?
No description
8 Replies
erquhart
erquhart13h ago
GitHub
convex-js/src/cli/lib/deployment.ts at 84314db1f591306faf2cab9b46a4...
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
erquhart
erquhart13h ago
Maybe there's some unexpected whitespace getting into the lines array
lee
lee13h ago
Are you on windows? I wonder if the split("\n") isn't accounting for the \r in windows line endings
Eva
EvaOP8h ago
I’m on Mac, but the contributors may have been on Windows, I’m not sure. Would the check work using line.includes(“.env.local”) instead of line === “.env.local”? And if so would a PR be welcome?
erquhart
erquhart8h ago
could still give (unlikely) false positives - maybe str.split(/\r?\n/)
Eva
EvaOP8h ago
I’m just imagining cases where there’s an extra space after the line, or an inline comment like .env.local # convex local env variables startsWith could be more forgiving than === but less than contains
erquhart
erquhart8h ago
ah good point Given the failure case is zero impact, your first approach makes sense. Pretty sure they'd take a PR.
Eva
EvaOP8h ago
I will give it a stab!