envsyncer
Version:
Sync your root .env files into monorepo subfolders with ease
28 lines (20 loc) ⢠735 B
text/typescript
import { scanTargetDirs } from './scanner';
import { promptTargetDirs } from './prompt';
import { syncEnvToTargets } from './sync';
import chalk from 'chalk';
async function main() {
console.log(chalk.green.bold('\nš± EnvSync ā syncing envs into your monorepo like magic\n'));
const dirs = await scanTargetDirs();
const selectedDirs = await promptTargetDirs(dirs);
if (!selectedDirs.length) {
console.log(chalk.yellow('No folders selected. Exiting.'));
process.exit(0);
}
await syncEnvToTargets(selectedDirs);
console.log(chalk.green('\nā
Done syncing env files!\n'));
}
main().catch((err) => {
console.error(chalk.red('ā Something went wrong:'), err);
process.exit(1);
});