Skip to content

Commit ca587e4

Browse files
committed
fix(scripts): remove duplicate colors declaration in pre-publish-validate
The colors variable was both imported from yoctocolors-cjs and redeclared as a manual ANSI codes object, causing a SyntaxError at runtime. Updated all color helper functions to use the imported yoctocolors-cjs methods instead of manual ANSI escape codes.
1 parent 10a6a0e commit ca587e4

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

scripts/pre-publish-validate.mjs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,32 @@ const __filename = fileURLToPath(import.meta.url)
1111
const __dirname = path.dirname(__filename)
1212
const projectRoot = path.resolve(__dirname, '..')
1313

14-
/**
15-
* Colors for terminal output.
16-
*/
17-
const colors = {
18-
red: '\x1b[31m',
19-
green: '\x1b[32m',
20-
yellow: '\x1b[33m',
21-
blue: '\x1b[34m',
22-
reset: '\x1b[0m',
23-
}
24-
2514
/**
2615
* Format a success message.
2716
*/
2817
function success(msg) {
29-
return `${colors.green}${colors.reset} ${msg}`
18+
return `${colors.green('✓')} ${msg}`
3019
}
3120

3221
/**
3322
* Format an error message.
3423
*/
3524
function error(msg) {
36-
return `${colors.red}${colors.reset} ${msg}`
25+
return `${colors.red('✗')} ${msg}`
3726
}
3827

3928
/**
4029
* Format a warning message.
4130
*/
4231
function warning(msg) {
43-
return `${colors.yellow}${colors.reset} ${msg}`
32+
return `${colors.yellow('⚠')} ${msg}`
4433
}
4534

4635
/**
4736
* Format an info message.
4837
*/
4938
function info(msg) {
50-
return `${colors.blue}${colors.reset} ${msg}`
39+
return `${colors.blue('ℹ')} ${msg}`
5140
}
5241

5342
/**

0 commit comments

Comments
 (0)