-
Notifications
You must be signed in to change notification settings - Fork 20
/
build-ci.js
34 lines (25 loc) · 917 Bytes
/
build-ci.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { execSync } = require('child_process')
const rimraf = require('rimraf');
const fs = require('fs-extra');
const cleanup = () => {
console.log('====> PRE: Cleaning up `build` directory');
rimraf.sync('build');
}
const buildApp = () => {
console.log('====> Starting application build: `yarn run build`.');
execSync('yarn run build', { stdio: 'inherit' });
}
const buildStoryBook = () => {
const enabled = process.env.STORYBOOK_RELEASE_ENABLED;
if (enabled !== 'true') {
console.log(`====> Storybook build disabled. (${enabled})`);
return;
}
console.log('====> Starting storybook build: `yarn run build-storybook`.');
execSync('yarn run build-storybook', { stdio: 'inherit' });
console.log('====> Copying storybook assets');
fs.copySync('storybook-static', 'build/storybook', { recursive: true });
}
cleanup();
buildApp();
buildStoryBook();