Merge pull request #636 from buster-so/fix-env-copy-script

Fix-env-copy-script
This commit is contained in:
dal 2025-07-25 19:38:48 -06:00 committed by GitHub
commit 645cadd7c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 6 deletions

View File

@ -95,17 +95,22 @@ async function findEnvFiles(dir: string, baseDir: string = dir): Promise<string[
const fullPath = join(currentDir, entry.name);
const relativePath = relative(baseDir, fullPath);
// Check if this path is ignored
if (isIgnored(fullPath, gitignoreStack)) {
continue;
}
if (entry.isDirectory()) {
// Always skip .git directory
if (entry.name === '.git') continue;
// Check if directory is ignored
if (isIgnored(fullPath, gitignoreStack)) {
continue;
}
await walkDir(fullPath, gitignoreStack);
} else if (entry.name.startsWith('.env')) {
} else if (entry.name.startsWith('.env') && !entry.name.endsWith('.example')) {
// Always include .env files (but not .env.example), regardless of gitignore rules
envFiles.push(relativePath);
} else {
// For non-.env files, check if they're ignored
if (isIgnored(fullPath, gitignoreStack)) {
continue;
}
}
}
} catch (error) {