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

Commit 6ca2e92

Browse files
committed
fix(ns-bundle): allow installing snapshot artefacts when using
env.snapshot (#261)
1 parent e4148bb commit 6ca2e92

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

bin/ns-bundle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ const escapeWithQuotes = arg => `"${arg}"`;
1919
const isTnsCommand = flag => flag.endsWith("-app");
2020
const isEnvCommand = flag => flag.indexOf("env.") > -1;
2121
const shouldUglify = () => process.env.npm_config_uglify;
22-
const shouldSnapshot = platform => platform == "android" &&
23-
require("os").type() != "Windows_NT" &&
24-
process.env.npm_config_snapshot;
22+
23+
const platformSupportsSnapshot = platform => platform === "android";
24+
const osSupportsSnapshot = () => require("os").type() != "Windows_NT";
25+
const snapshotOption = env =>
26+
process.env.npm_config_snapshot || (env && env.includes("env.snapshot"));
27+
28+
const shouldSnapshot = (platform, env) =>
29+
platformSupportsSnapshot(platform) &&
30+
osSupportsSnapshot() &&
31+
snapshotOption(env);
2532

2633
const npmArgs = JSON.parse(process.env.npm_config_argv).original;
2734
const tnsArgs = getTnsArgs(npmArgs);
@@ -60,7 +67,7 @@ function execute(options) {
6067
];
6168
}
6269

63-
if (shouldSnapshot(platform)) {
70+
if (shouldSnapshot(platform, options.env)) {
6471
commands.push(() => installSnapshotArtefacts());
6572
}
6673

0 commit comments

Comments
 (0)