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

fix: clean android build artifacts when using with uglify #175

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/ns-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (!process.env.npm_config_argv) {

const escape = arg => `"${arg}"`;
const isTnsCommand = flag => flag.endsWith("-app");
const shouldUglify = () => process.env.npm_config_uglify;

const npmArgs = JSON.parse(process.env.npm_config_argv).original;
const tnsArgs = getTnsArgs(npmArgs).map(escape);
Expand Down Expand Up @@ -67,9 +68,9 @@ function cleanBuildArtifacts(platform) {
getTnsVersion().then(versionString => {
const version = versionToNumber(versionString);

// for nativescript-cli v3.0.1 and below
// the android build artifacts should be cleaned manually
if (version <= 301) {
// for nativescript-cli v3.0.1 and below or if using uglify
if (version <= 301 || shouldUglify()) {
gradlewClean().then(resolve).catch(throwError);
} else {
return resolve();
Expand Down Expand Up @@ -133,7 +134,7 @@ function webpack(platform) {
`--config=webpack.config.js`,
`--progress`,
`--env.${platform}`,
process.env.npm_config_uglify && `--env.uglify`,
shouldUglify() && `--env.uglify`,
];

spawnChildProcess(...args)
Expand Down