forked from poulad/MEAN-TS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
29 lines (22 loc) · 797 Bytes
/
build.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
'use strict';
((mode) => {
mode = mode.toLowerCase() == 'prod' ? 'prod' : 'dev';
const $ = require('shelljs');
const fs = require('fs');
const path = require('path');
const pkg = require('root-require')('package.json');
$.config.fatal = true;
const rootDir = __dirname;
console.log(`# Building ${pkg.name} : ${pkg.version}`);
if (pgk.author) {
console.log(`## Author: ${pkg.author}`);
}
$.cd(rootDir);
console.log('## Restoring packages...');
$.exec('npm install');
console.log('## Packages restored.');
console.log(`## Running ${mode} build...`);
$.exec(`npm run "build:${mode == 'prod' ? 'prod' : ''}"`);
console.log('## Build finished.');
$.cd(rootDir);
})(process.argv[2] || 'dev');