forked from BearToCode/carta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
23 lines (18 loc) · 650 Bytes
/
build.js
File metadata and controls
23 lines (18 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { packages, execAsync } from './packages.js';
import ora from 'ora';
import process from 'process';
const spinner = ora().start();
spinner.color = 'red';
// Include docs in the build process
const buildTargets = [...packages, 'docs'];
for (const [index, target] of buildTargets.entries()) {
spinner.text = `Building ${target} [${index + 1}/${buildTargets.length}]`;
try {
const buildPath = target === 'docs' ? './docs' : `./packages/${target}`;
await execAsync(`pnpm run build`, buildPath);
} catch (e) {
spinner.fail(`Failed to build ${target}: \n ${e}`);
process.exit(1);
}
}
spinner.succeed(`All packages and docs built`);