-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-lib.js
24 lines (21 loc) · 953 Bytes
/
build-lib.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
const fs = require('fs');
const os = require("os");
const child_process = require('child_process');
const rimraf = require('rimraf');
const ncp = require('ncp');
console.log('clean publish directory');
if(fs.existsSync('publish')){
rimraf.sync('publish');
}
console.log('copy files to publish directory');
const copyOptions = {
filter: filename => !filename.endsWith('.spec.ts')
};
ncp('src/app/component-wrapper/','publish/', copyOptions, error => {
console.log('inline templates and styles');
const ngInlineCmd = os.platform() === 'win32' ? 'node_modules\\.bin\\ng2-inline' : './node_modules/.bin/ng2-inline';
child_process.execSync(ngInlineCmd + ' --flatten --relative publish/**/*.component.ts', {stdio:[0,1,2]});
console.log('compile typescript');
const ngcCmd = os.platform() === 'win32' ? 'node_modules\\.bin\\ngc' : './node_modules/.bin/ngc';
child_process.execSync(ngcCmd + ' -p publish/tsconfig.json', {stdio:[0,1,2]});
});