Skip to content

Commit

Permalink
fix(build): recognize lb-tsc bool options with a value
Browse files Browse the repository at this point in the history
Before this change, `lb-tsc -b --pretty false` would discard
`--pretty false` arguments.

With this change in place, boolean arguments with values are preserved.

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
  • Loading branch information
bajtos committed May 12, 2020
1 parent 8501116 commit 015df04
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ function validArgsForBuild(args) {
});
let validArgs = args;
if (args.includes('-b') || args.includes('--build')) {
validArgs = filterArgs(args, arg => {
if (validBooleanOptions.includes(arg)) return 1;
validArgs = filterArgs(args, (arg, next) => {
if (validBooleanOptions.includes(arg)) {
return next === 'false' || next === 'true' ? 2 : 1;
}
if (validValueOptions.includes(arg)) return 2;
return 0;
});
Expand All @@ -185,7 +187,7 @@ function filterArgs(args, filter) {
const validArgs = [];
let i = 0;
while (i < args.length) {
const length = filter(args[i]);
const length = filter(args[i], args[i + 1]);
if (length === 0) {
i++;
} else if (length === 1) {
Expand Down

0 comments on commit 015df04

Please sign in to comment.