Skip to content

Commit 44ddd26

Browse files
committed
[mercury][migration-script] Fix bug due to "update" argument being used for the directory
1 parent c641623 commit 44ddd26

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/mercury/src/cli/migrate-mercury-tokens.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
* Version: 1.0.0
99
*
1010
* USAGE:
11-
* 1. Download this file to your project root
12-
* 2. Run: node migrate-mercury-tokens.js
11+
* 1. Run from your project root: bunx mercury update
12+
* 2. Or with a specific directory: bunx mercury update ./src
13+
* 3. Legacy: node migrate-mercury-tokens.js [directory]
1314
*
1415
* The script will:
1516
* - Find all CSS, SCSS, JS, TS, JSX, TSX files
@@ -361,7 +362,18 @@ export function migrateMercuryTokens() {
361362
printHeader();
362363
console.log("═".repeat(80));
363364

364-
const targetDir = process.argv[2] || process.cwd();
365+
// Handle command parsing
366+
const args = process.argv.slice(2);
367+
const command = args[0];
368+
369+
// If first arg is "update", use current directory
370+
// Otherwise treat first arg as the target directory
371+
let targetDir;
372+
if (command === "update") {
373+
targetDir = args[1] || process.cwd();
374+
} else {
375+
targetDir = command || process.cwd();
376+
}
365377

366378
if (!fs.existsSync(targetDir)) {
367379
console.error(`\n❌ Error: Directory "${targetDir}" does not exist`);

0 commit comments

Comments
 (0)