Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 8f1c88e

Browse files
committed
enable webpack builds in debug and optional snapshot
1 parent 9374e25 commit 8f1c88e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Diff for: lib/after-prepare.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const snapshotGenerator = require("../snapshot/android/project-snapshot-generato
22
const utils = require("./utils");
33

44
module.exports = function ($mobileHelper, $projectData, hookArgs) {
5-
if (utils.shouldSnapshot($mobileHelper, hookArgs.platform, hookArgs.appFilesUpdaterOptions.bundle)) {
5+
const env = hookArgs.env || {};
6+
7+
if (env["snapshot"] && utils.shouldSnapshot($mobileHelper, hookArgs.platform, hookArgs.appFilesUpdaterOptions.bundle)) {
68
snapshotGenerator.installSnapshotArtefacts($projectData.projectDir);
79
}
810
}

Diff for: lib/before-prepareJS.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ function throwError(error) {
3636
}
3737

3838
function prepareJSWebpack(config, $mobileHelper, $projectData, originalArgs, originalMethod) {
39-
if (config.bundle && config.release) {
39+
if (config.bundle) {
4040
return new Promise(function (resolve, reject) {
4141
console.log(`Running webpack for ${config.platform}...`);
4242
const envFlagNames = Object.keys(config.env).concat([config.platform.toLowerCase()]);
43-
if (utils.shouldSnapshot($mobileHelper, config.platform, config.bundle)) {
44-
envFlagNames.push("snapshot");
43+
44+
const snapshotEnvIndex = envFlagNames.indexOf("snapshot");
45+
if (snapshotEnvIndex !== -1 && !utils.shouldSnapshot($mobileHelper, config.platform, config.bundle)) {
46+
envFlagNames.splice(snapshotEnvIndex, 1);
4547
}
4648

4749
const args = [
@@ -69,9 +71,8 @@ module.exports = function ($mobileHelper, $projectData, hookArgs) {
6971
const config = {
7072
env,
7173
platform,
72-
release: appFilesUpdaterOptions.release,
7374
bundle: appFilesUpdaterOptions.bundle
7475
};
7576

76-
return config.release && config.bundle && prepareJSWebpack.bind(prepareJSWebpack, config, $mobileHelper, $projectData);
77+
return config.bundle && prepareJSWebpack.bind(prepareJSWebpack, config, $mobileHelper, $projectData);
7778
}

0 commit comments

Comments
 (0)