Skip to content

Commit a03cf30

Browse files
committed
fixed issue ehre .env.example would be in .gitingore with fix flag
1 parent 3776563 commit a03cf30

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semant
1212
### Fixed
1313
-
1414

15+
## [2.2.9] - 2025-10-01
16+
### Fixed
17+
- Fixed issue where .env.example would be ignored by git when using --fix flag.
18+
1519
## [2.2.8] - 2025-09-30
1620
### Added
1721
- Fix .env is not ignored by git when using --fix flag.

src/core/fixEnv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function updateGitignoreForEnv(envPath: string): boolean {
143143
}
144144

145145
// Need to add patterns
146-
const patterns = ['.env', '.env.*'];
146+
const patterns = ['.env'];
147147

148148
if (fs.existsSync(gitignorePath)) {
149149
const current = fs.readFileSync(gitignorePath, 'utf8');

src/ui/shared/printGitignore.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ export function printGitignoreWarning(options: GitignoreWarningOptions): void {
1919
chalk.yellow(
2020
`⚠️ No .gitignore found – your ${envFile} may be committed.\n` +
2121
` Add:\n` +
22-
` ${envFile}\n` +
23-
` ${envFile}.*\n`,
22+
` ${envFile}\n`
2423
),
2524
);
2625
} else {
2726
log(
2827
chalk.yellow(
2928
`⚠️ ${envFile} is not ignored by Git (.gitignore).\n` +
3029
` Consider adding:\n` +
31-
` ${envFile}\n` +
32-
` ${envFile}.*\n`,
30+
` ${envFile}\n`
3331
),
3432
);
3533
}

test/e2e/cli.autoscan.e2e.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,5 @@ describe('no-flag autoscan', () => {
102102

103103
const gitignore = fs.readFileSync(path.join(cwd, '.gitignore'), 'utf-8');
104104
expect(gitignore).toContain('.env');
105-
expect(gitignore).toContain('.env.*');
106105
});
107106
});

0 commit comments

Comments
 (0)