forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-core.js
More file actions
49 lines (39 loc) · 1.16 KB
/
build-core.js
File metadata and controls
49 lines (39 loc) · 1.16 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const fs = require('fs-extra');
const path = require('path');
const spawn = require('child_process').spawn;
const stencilPath = path.join(__dirname, '..', '..', 'core', 'node_modules', '.bin');
function buildIonicAngular() {
return new Promise((resolve, reject) => {
const cmd = 'stencil';
const args = [
'build',
'--config',
path.join(__dirname, '..', 'stencil.config.js'),
...process.argv.slice(2)
];
const p = spawn('./stencil', args, { cwd: stencilPath, stdio: 'inherit' });
p.on('close', (code) => {
if (code > 0) {
console.log(`@ionic/angular build exited with ${code}`);
reject();
} else {
resolve();
}
});
});
}
function copyIonicons() {
const src = path.join(__dirname, '..', '..', 'core', 'node_modules', 'ionicons');
const dst = path.join(__dirname, '..', 'node_modules', 'ionicons');
fs.removeSync(dst);
fs.copySync(src, dst);
}
function copyCSS() {
const src = path.join(__dirname, '..', '..', 'core', 'css');
const dst = path.join(__dirname, '..', 'css');
fs.removeSync(dst);
fs.copySync(src, dst);
}
copyIonicons();
copyCSS();
buildIonicAngular();