-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
40 lines (36 loc) · 1021 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
30
31
32
33
34
35
36
37
38
39
40
const fs = require('fs');
const path = require("path");
let webpack = null;
try {
webpack = require('webpack');
} catch (e) {
}
const execFile = require('child_process').execFile;
webpack(require(`${__dirname}/webpack.config`), function (err, stats) {
if(err){
console.error(err);
}
console.log("Webpack done");
});
let cordovaPath = `${__dirname}/node_modules/.bin/cordova`;
if(process.platform === "win32"){
cordovaPath += ".cmd";
}
execFile(path.resolve(cordovaPath), ["prepare"], (error, stdout, stderr) => {
if(error){
return;
}
console.log("Cordova prepared");
execFile("node", ["copyIcon.js"], (error, stdout, stderr) =>{
if(error){
return console.error(error, stderr.toString());
}
console.log("Icon copied");
execFile(path.resolve(cordovaPath), ["build"], (error, stdout, stderr) => {
if(error){
return;
}
console.log("Application build successful");
});
});
});