build.js (913B)
1 /** 2 * React Starter Kit (https://www.reactstarterkit.com/) 3 * 4 * Copyright © 2014-present Kriasoft, LLC. All rights reserved. 5 * 6 * This source code is licensed under the MIT license found in the 7 * LICENSE.txt file in the root directory of this source tree. 8 */ 9 10 import cp from 'child_process'; 11 import run from './run'; 12 import clean from './clean'; 13 import copy from './copy'; 14 import bundle from './bundle'; 15 import render from './render'; 16 import pkg from '../package.json'; 17 18 /** 19 * Compiles the project from source files into a distributable 20 * format and copies it to the output (build) folder. 21 */ 22 async function build() { 23 await run(clean); 24 await run(copy); 25 await run(bundle); 26 27 if (process.argv.includes('--static')) { 28 await run(render); 29 } 30 31 if (process.argv.includes('--docker')) { 32 cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], { stdio: 'inherit' }); 33 } 34 } 35 36 export default build;