-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Copy example files recursively to work on mono repos
- Loading branch information
1 parent
ad2a143
commit d9219be
Showing
2 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { join } from 'node:path' | ||
import { Command } from 'commander' | ||
import { projectConfig } from '../../config/project.config' | ||
import { copyFile } from '../../utils/file-system' | ||
import { copyFile, readPathMatchingFiles } from '../../utils/file-system' | ||
|
||
export function copyExampleFilesCommand() { | ||
return new Command() | ||
.name('copy-example-files') | ||
.summary('Copy example files from the ') | ||
.summary('Copy example dotenv files on each repo path') | ||
.action(() => { | ||
for (const path of projectConfig.reposPaths()) { | ||
copyFile({ | ||
source: join(path, '.env.example'), | ||
target: join(path, '.env'), | ||
}) | ||
const exampleEnvFiles = readPathMatchingFiles(path, '.env.example') | ||
|
||
if (exampleEnvFiles.length > 0) { | ||
for (const file of exampleEnvFiles) { | ||
copyFile({ | ||
source: file, | ||
target: file.replace('.example', ''), | ||
}) | ||
} | ||
} | ||
} | ||
}) | ||
} |
This file contains 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