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

fix(scripts): respect tns build/run args passed to ns-bundle #71

Merged
merged 1 commit into from
Feb 9, 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
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