Skip to content

Commit 3b117bb

Browse files
Made successive builds faster
(This should reduce overall time of build action)
1 parent 6a8d1de commit 3b117bb

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

_scripts/cordova-build.js

+4-34
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ const archiver = require('archiver');
5050
console.log("Installed Media Controls Plugin");
5151
await exec("cd " + __dirname + "/../build/"+ DIST_FOLDER_NAME + " && npx cordova plugin add cordova-plugin-android-permissions" );
5252
console.log("Installed File Permissions Plugin");
53-
53+
await exec(" cd " + __dirname + "/../build/" + DIST_FOLDER_NAME + " && npm install browserify --save-dev");
54+
console.log("Installed browserify");
55+
await exec(" cd " + __dirname + "/../build/" + DIST_FOLDER_NAME + " && npm install https://github.com/jvilk/BrowserFS.git");
56+
console.log("Installed browserfs");
5457
if (await fsExists(__dirname + "/../build/" + DIST_FOLDER_NAME + "/www/")) {
5558
await fsRm(__dirname + "/../build/" + DIST_FOLDER_NAME + "/www/", { recursive: true, force: true });
5659
}
@@ -80,24 +83,7 @@ const archiver = require('archiver');
8083
if (process.argv.length > 3) {
8184
exportType = process.argv[3];
8285
}
83-
84-
console.log("Installing browserify");
85-
if (await fsExists(__dirname + "/../node_modules/browserify")) {
86-
try {
87-
await fsCopy(__dirname + "/../node_modules/browserify", __dirname + "/../build/" + DIST_FOLDER_NAME + "/node_modules/browserify", { recursive: true, force: true });
88-
console.log("Was able to recycle module from last build");
89-
} catch (exception) {
90-
console.log(exception);
91-
// just ignore these errors for now
92-
}
93-
} else {
94-
await exec(" cd " + __dirname + "/../build/" + DIST_FOLDER_NAME + " && npm install browserify --save-dev");
95-
/*if (!await fsExists(__dirname + "/../node_modules/browserify")) {
96-
await fsCopy(__dirname + "/../build/" + DIST_FOLDER_NAME + "/node_modules/browserify", __dirname + "/../node_modules/browserify", { recursive: true, force: true });
97-
}*/
98-
}
9986

100-
10187
var browserfsPath = __dirname + "/../build/" + DIST_FOLDER_NAME + "/www/browserfs";
10288
// Copy dist folder into cordova project;
10389
console.log("Copying dist output to cordova outline");
@@ -119,22 +105,6 @@ const archiver = require('archiver');
119105
})
120106
});
121107

122-
// Adding browserfs to the dist
123-
console.log("Installing browserfs");
124-
if (await fsExists(__dirname + "/../node_modules/browserfs")) {
125-
try {
126-
await fsCopy(__dirname + "/../node_modules/browserfs", __dirname + "/../build/" + DIST_FOLDER_NAME + "/node_modules/browserfs", { recursive: true, force: true });
127-
console.log("Was able to recycle module from last build");
128-
} catch (exception) {
129-
console.log(exception);
130-
// just ignore these errors for now
131-
}
132-
} else {
133-
await exec(" cd " + __dirname + "/../build/" + DIST_FOLDER_NAME + " && npm install https://github.com/jvilk/BrowserFS.git");
134-
/*if (!await fsExists(__dirname + "/../node_modules/browserfs")) {
135-
await fsCopy(__dirname + "/../build/" + DIST_FOLDER_NAME + "/node_modules/browserfs", __dirname + "/../node_modules/browserfs", { recursive: true, force: true });
136-
}*/
137-
}
138108
console.log("Copying browserfs dist to cordova www folder")
139109
await fsCopy(__dirname + "/../build/" + DIST_FOLDER_NAME + "/node_modules/browserfs", __dirname + "/../build/" + DIST_FOLDER_NAME + "/www/browserfs", { recursive: true, force: true });
140110
var browserifyConfig = {

0 commit comments

Comments
 (0)