fix(create): ignore dotenv files in new projects#2095
Merged
fengmk2 merged 1 commit intoJul 9, 2026
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Vite+ project scaffolding to ignore dotenv environment files by default, aligning generated projects and the built-in monorepo template with common .env handling expectations.
Changes:
- Add
.env/.env.*ignores (while keeping!.env.exampletrackable) to the built-in monorepo template.gitignore. - Extend
vp create’s post-scaffold.gitignoreenforcement to include dotenv patterns in addition tonode_modules. - Add unit tests covering the new default
.gitignorebehavior, including partial/mixed existing entries and CRLF handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/cli/templates/monorepo/_gitignore | Ignores dotenv files by default while keeping .env.example trackable. |
| packages/cli/src/create/utils.ts | Renames and expands the helper to append default .gitignore entries (node_modules + dotenv). |
| packages/cli/src/create/bin.ts | Wires the new helper into create flows after successful git initialization. |
| packages/cli/src/create/tests/utils.spec.ts | Adds focused unit tests for default .gitignore entry enforcement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
02d7bc7 to
dc30af2
Compare
fengmk2
reviewed
Jul 8, 2026
a499c71 to
cec231b
Compare
fengmk2
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.gitignore..gitignoredefaults so generated projects also ignore.envand.env.*while keeping!.env.exampletrackable..gitignorecontent.Closes #2086
Validation
git diff --check -- packages/cli/src/create/utils.ts packages/cli/src/create/bin.ts packages/cli/src/create/__tests__/utils.spec.ts packages/cli/templates/monorepo/_gitignore crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/create_org_bundled_monorepo/snapshots/create_org_bundled_monorepo.md/tmp/vp-issue-2086-test/node_modules/.bin/vitest run src/create/__tests__/utils.spec.ts --config <temp config>Note: the normal workspace install is still not available in this worktree because the checkout lacks
vite/patches/*files referenced bypnpm-workspace.yaml, so the focused test used a temporary dependency install.