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

Commit

Permalink
fix(scripts): respect tns build/run args passed to ns-bundle (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
sis0k0 authored Feb 9, 2017
1 parent e80cbdc commit 17b9d82
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bin/ns-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,25 @@ if (!process.env.npm_config_argv) {
}

const npmArgs = JSON.parse(process.env.npm_config_argv).original;
const tnsArgs = getTnsArgs(npmArgs);
const flags = npmArgs.filter(a => a.startsWith("--")).map(a => a.substring(2));
const options = getOptions(flags);

function getTnsArgs(args) {
let other = [
"run",
"ns-bundle",
"--android",
"--ios",
"--build-app",
"--start-app",
"--uglify",
"--nobundle",
];

return args.filter(a => !other.includes(a));
}

execute(options);

function execute(options) {
Expand Down Expand Up @@ -41,7 +57,7 @@ function webpack(platform) {
function runTns(command, platform) {
console.log(`Running tns ${command}...`);
return new Promise((resolve, reject) => {
spawnChildProcess("tns", command, platform, "--bundle", "--disable-npm-install")
spawnChildProcess("tns", command, platform, "--bundle", "--disable-npm-install", ...tnsArgs)
.then(resolve)
.catch(throwError);
});
Expand Down

0 comments on commit 17b9d82

Please sign in to comment.