Skip to content

fix(create): ignore dotenv files in new projects#2095

Merged
fengmk2 merged 1 commit into
voidzero-dev:mainfrom
forehalo:codex/issue-2086-gitignore-env
Jul 9, 2026
Merged

fix(create): ignore dotenv files in new projects#2095
fengmk2 merged 1 commit into
voidzero-dev:mainfrom
forehalo:codex/issue-2086-gitignore-env

Conversation

@forehalo

@forehalo forehalo commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add dotenv environment files to the built-in monorepo template .gitignore.
  • Extend create-time .gitignore defaults so generated projects also ignore .env and .env.* while keeping !.env.example trackable.
  • Update focused unit coverage and the migrated PTY snapshot for generated .gitignore content.

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 by pnpm-workspace.yaml, so the focused test used a temporary dependency install.

@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit cec231b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a4f24742ce74200087a056a

@forehalo forehalo marked this pull request as ready for review July 8, 2026 09:04
Copilot AI review requested due to automatic review settings July 8, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.example trackable) to the built-in monorepo template .gitignore.
  • Extend vp create’s post-scaffold .gitignore enforcement to include dotenv patterns in addition to node_modules.
  • Add unit tests covering the new default .gitignore behavior, 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.

@forehalo forehalo force-pushed the codex/issue-2086-gitignore-env branch from 02d7bc7 to dc30af2 Compare July 8, 2026 12:01
Comment thread crates/vite_js_runtime/src/providers/node.rs Outdated
@forehalo forehalo force-pushed the codex/issue-2086-gitignore-env branch from a499c71 to cec231b Compare July 9, 2026 04:32
@fengmk2 fengmk2 merged commit 9f43d67 into voidzero-dev:main Jul 9, 2026
66 checks passed
@forehalo forehalo deleted the codex/issue-2086-gitignore-env branch July 9, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add environment files to .gitignore

3 participants