Skip to content

Commit

Permalink
fix(build): Tweaks to bundle script for error reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
himerus committed Mar 8, 2024
1 parent ba06d38 commit 2fcf43d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const { exec } = require('child_process');
const fs = require('fs');

series([
// This callback removes any prior build assets. This is done to ensure a clean
// build environment. The 'rm -rf ./dist' command deletes the 'dist' directory and
// all its contents. This is a common practice in build processes to avoid conflicts
// with previous builds. More about 'rm' command can be found here:
// https://www.geeksforgeeks.org/rm-command-linux-examples/
callback => exec('rm -rf ./dist', callback),
// This callback removes any prior build assets to ensure a clean build environment.
// The 'npx rimraf ./dist' command deletes the 'dist' directory and all its contents.
// This is a common practice in build processes to avoid conflicts with previous builds.
// 'rimraf' is a cross-platform Node.js deletion module. More about 'rimraf' can be found here:
// https://www.npmjs.com/package/rimraf
callback => exec('npx rimraf ./dist', callback),

// This callback runs the Vite build process. Vite is a modern front-end build
// tool that provides faster and leaner development experience. The 'vite build'
Expand All @@ -29,9 +29,15 @@ series([
// This callback runs the TypeScript compiler. This is done to transpile
// TypeScript code into JavaScript code that can be run in the browser. The
// '--project tsconfig.build.json' option tells the compiler to use the settings
// specified in the 'tsconfig.build.json' file. More about TypeScript compiler
// specified in the 'tsconfig.build.json' file. The output of the `tsc` command
// is logged to the console. More about TypeScript compiler
// options can be found here: https://www.typescriptlang.org/docs/handbook/compiler-options.html
callback => exec('npx tsc --project tsconfig.build.json', callback),
callback =>
exec('npx tsc --project tsconfig.build.json', (error, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
callback(error);
}),

// This callback copies the styles to the 'dist' directory after the build.
// This is done to ensure that the styles are included in the final build. The
Expand Down

0 comments on commit 2fcf43d

Please sign in to comment.