Skip to content

Commit

Permalink
Work
Browse files Browse the repository at this point in the history
  • Loading branch information
qligier committed Nov 3, 2024
1 parent 609edeb commit bb554be
Show file tree
Hide file tree
Showing 47 changed files with 895 additions and 412 deletions.
28 changes: 15 additions & 13 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@ import {spawn} from 'child_process';
import fs from 'fs';

const spawnProcess = (command, args) => {
return new Promise((resolve, reject) => {
const process = spawn(command, args, { stdio: 'inherit', shell: true });
process.on('exit', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Process exited with code ${code}`));
}
});
return new Promise((resolve, reject) => {
const process = spawn(command, args, {stdio: 'inherit', shell: true});
process.on('exit', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Process exited with code ${code}`));
}
});
});
}

// 1. Prepare the 'dist' directory
if (fs.existsSync('./dist')) {
fs.rmSync('./dist', { recursive: true, force: true });
fs.rmSync('./dist', {recursive: true, force: true});
}
fs.mkdirSync('./dist');

// 2. Run the build steps
const npmCommand = /^win/.test(process.platform) ? 'npm.cmd' : 'npm';
const isWindows = /^win/.test(process.platform);
const npmCommand = isWindows ? 'npm.cmd' : 'npm';
const cssBuildPromise = spawnProcess(npmCommand, ['run', 'build-css']);
const jsBuildPromise = spawnProcess(npmCommand, ['run', 'build-js']);
const jsCopyStatic = spawnProcess(npmCommand, ['run', 'build-static']);
const jsCopyStatic = spawnProcess(npmCommand, ['run', isWindows ? 'build-static:windows' : 'build-static']);

Promise.all([cssBuildPromise, jsBuildPromise, jsCopyStatic]).then(() => {});
Promise.all([cssBuildPromise, jsBuildPromise, jsCopyStatic]).then(() => {
});
Loading

0 comments on commit bb554be

Please sign in to comment.