Skip to content

Commit 9ab8234

Browse files
committed
properly add chalk as deps + esbuild.mjs update + new scripts in package.json
1 parent 0d48b66 commit 9ab8234

4 files changed

Lines changed: 92 additions & 36 deletions

File tree

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
npm run types
12
npx eslint
23
cd docs && npm run check

esbuild.mjs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const modeArgIndex = process.argv.indexOf('--mode');
4848
const mode = modeArgIndex !== -1 && process.argv[modeArgIndex + 1] ? process.argv[modeArgIndex + 1] : 'default';
4949

5050
// Log the build configuration
51-
console.log(chalk.bold(`🧰 Build mode: ${production ? chalk.green('🏭 Production') : chalk.yellow('🛠️ Development')}`));
51+
console.log(chalk.bold(`🏗️ Build mode: ${production ? chalk.green('🏭 Production') : chalk.yellow('🛠️ Development')}`));
5252
if (process.env.NODE_ENV) {
5353
console.log(chalk.cyan(`🌍 NODE_ENV: ${process.env.NODE_ENV}`));
5454
}
@@ -68,7 +68,7 @@ if (fs.existsSync(outDir)) {
6868
console.log(chalk.yellow(`🗑️ Output directory ${outDir} already exists, removing dir...`));
6969
fs.rmSync(outDir, {recursive: true});
7070
} else {
71-
console.log(chalk.dim(`📁 Output directory ${outDir} doesn't exist, skipping removal step.`));
71+
console.log(chalk.dim(`📁 Output directory ${outDir} doesn't exist, skipping removal step.`));
7272
}
7373

7474
(async () => {
@@ -77,43 +77,43 @@ if (fs.existsSync(outDir)) {
7777
case 'web':
7878
console.log(chalk.blue(`🌐 ${watch ? 'Watching' : 'Running'} web build...`));
7979
await web(production, watch).catch(erm => {
80-
console.error(chalk.red.bold(` Web build failed: ${erm}`));
80+
console.error(chalk.red.bold(`💥 Web build failed: ${erm}`));
8181
process.exit(1);
8282
});
83-
console.log(chalk.green.bold('✅ Web build completed successfully!'));
83+
console.log(chalk.green.bold.underline('🧰 Web build completed successfully!'));
8484
break;
8585
case 'desktop':
8686
console.log(chalk.blue(`🖥️ ${watch ? 'Watching' : 'Running'} desktop build...`));
8787
await desktop(production, watch).catch(erm => {
88-
console.error(chalk.red.bold(` Desktop build failed: ${erm}`));
88+
console.error(chalk.red.bold(`💥 Desktop build failed: ${erm}`));
8989
process.exit(1);
9090
});
91-
console.log(chalk.green.bold('✅ Desktop build completed successfully!'));
91+
console.log(chalk.green.bold.underline('🧰 Desktop build completed successfully!'));
9292
break;
9393
case 'default':
9494
// Can't use watch while building both.
9595
if (watch) {
96-
console.error(chalk.red.bold(' Cannot use flag --watch while building both desktop and web'));
97-
process.exit(1);
96+
console.error(chalk.yellow.bold('⚠️ Cannot use flag --watch while building both desktop and web'));
97+
//process.exit(1); we'll just continue building it normally ig
9898
}
9999
console.log(chalk.blue('🖥️ Running desktop build...'));
100100
await desktop(production, false).catch(erm => {
101-
console.error(chalk.red.bold(` Desktop build failed: ${erm}`));
101+
console.error(chalk.red.bold(`💥 Desktop build failed: ${erm}`));
102102
process.exit(1);
103103
});
104104
console.log(chalk.blue('🌐 Running web build...'));
105105
await web(production, false).catch(erm => {
106-
console.error(chalk.red.bold(` Web build failed: ${erm}`));
106+
console.error(chalk.red.bold(`💥 Web build failed: ${erm}`));
107107
process.exit(1);
108108
});
109109
console.log(chalk.green.bold.underline('🎉 Builds completed successfully!'));
110110
break;
111111
default:
112-
console.error(chalk.red.bold(`❌ Unknown mode: ${mode}`));
112+
console.error(chalk.red.bold(`❌ Unknown mode: ${mode}`));
113113
process.exit(1);
114114
}
115115
} catch (erm) {
116-
console.error(chalk.bgRed.white.bold(`💥 Build failed: ${erm}`));
116+
console.error(chalk.bgRed.white.bold(`💥 Build failed: ${erm}`));
117117
process.exit(1);
118118
}
119119
})();

package-lock.json

Lines changed: 74 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,18 +600,19 @@
600600
},
601601
"scripts": {
602602
"vscode:prepublish": "npm run build",
603-
"build": "npm run check-types && node esbuild.mjs",
603+
"build": "npm run types && node esbuild.mjs",
604604
"compile": "cross-env NODE_ENV=0 npm run build",
605605
"package": "cross-env NODE_ENV=1 npm run build",
606606
"lint": "eslint --fix",
607607
"test": "vscode-test",
608608
"prepare": "husky",
609-
"check-types": "tsc --noEmit",
609+
"types": "npm-run-all -p build:*:tsc",
610+
"types:watch": "npm-run-all -p watch:*:tsc",
610611
"build:web": "npm-run-all -p build:web:*",
611612
"build:desktop": "npm-run-all -p build:desktop:*",
612613
"build:web:esbuild": "node esbuild.mjs --mode web",
613614
"build:web:tsc": "tsc --noEmit --project tsconfig.web.json",
614-
"buils:desktop:esbuild": "node esbuild.mjs --mode desktop",
615+
"build:desktop:esbuild": "node esbuild.mjs --mode desktop",
615616
"build:desktop:tsc": "tsc --noEmit --project tsconfig.json",
616617
"watch:web": "npm-run-all -p watch:web:*",
617618
"watch:desktop": "npm-run-all -p watch:desktop:*",
@@ -629,6 +630,7 @@
629630
"@types/vscode": "^1.95.0",
630631
"@types/ws": "^8.18.0",
631632
"@vscode/vsce": "^3.6.0",
633+
"chalk": "^5.4.1",
632634
"cross-env": "^7.0.3",
633635
"esbuild": "^0.25.5",
634636
"esbuild-plugin-polyfill-node": "^0.3.0",

0 commit comments

Comments
 (0)