chore(env): rename test environment to staging

This commit is contained in:
dahyeon committed 2026-06-07 01:01:13 -07:00
1 parent d0d578b2b0
commit eadae789c8
17 files changed
+160 -107

No files matched your search

@@ -71,7 +71,7 @@ function parseArgs(argv: string[]): CliOptions {
}
if (arg === '--env') {
const value = argv[index + 1];
if (!value) throw new Error('--env requires dev, test, or prod.');
if (!value) throw new Error('--env requires dev, staging, or prod.');
nodeEnv = value;
index += 1;
continue;
@@ -104,8 +104,8 @@ function parseArgs(argv: string[]): CliOptions {
throw new Error(`Unknown argument: ${arg}`);
}
if (!['dev', 'test', 'prod'].includes(nodeEnv)) {
throw new Error('--env must be dev, test, or prod.');
if (!['dev', 'staging', 'prod'].includes(nodeEnv)) {
throw new Error('--env must be dev, staging, or prod.');
}
return { dryRun, limit, nodeEnv };
@@ -119,7 +119,7 @@ function printHelp() {
Options:
--dry-run Print affected counts without writing. Default.
--apply Apply updates to MongoDB.
--env <env> dev | test | prod. Default: NODE_ENV or dev.
--env <env> dev | staging | prod. Default: NODE_ENV or dev.
--limit <n> Only scan first n documents per collection.
`);
}
@@ -130,7 +130,9 @@ async function main() {
await loadMachineEnvFile();
const app = await NestFactory.createApplicationContext(MigrationModule, {
logger: options.dryRun ? ['log', 'warn', 'error'] : ['log', 'warn', 'error'],
logger: options.dryRun
? ['log', 'warn', 'error']
: ['log', 'warn', 'error'],
});
try {
@@ -145,14 +147,19 @@ async function main() {
`[team-index migration] mode=${options.dryRun ? 'dry-run' : 'apply'} env=${options.nodeEnv} db=${dbName}`,
);
const stats = await migrateTeamIndex(connection.db as Parameters<typeof migrateTeamIndex>[0], {
dryRun: options.dryRun,
limit: options.limit,
});
const stats = await migrateTeamIndex(
connection.db as Parameters<typeof migrateTeamIndex>[0],
{
dryRun: options.dryRun,
limit: options.limit,
},
);
console.table(stats);
if (options.dryRun) {
console.log('No writes were made. Re-run with --apply to update documents.');
console.log(
'No writes were made. Re-run with --apply to update documents.',
);
} else {
console.log('Migration applied.');
}