mysticatea / npm-run-all

A CLI tool to run multiple npm-scripts in parallel or sequential.

Repository from Github https://github.commysticatea/npm-run-allRepository from Github https://github.commysticatea/npm-run-all

Allow default values when args is empty

piranna opened this issue · comments

npm-run-all/lib/index.js

Lines 51 to 56 in bf91f94

if (id === "@") {
return shellQuote.quote(args)
}
if (id === "*") {
return shellQuote.quote([args.join(" ")])
}

If we have a variable expansion with @ or *, we are expanding it unconditionally to the provided args, also if they are empty (no elements array or empty string, respectively), while in that case POSIX variable expansion take the provided default values, if any.

In addition to that, maybe we should allow to define the placeholders with a $ prefix too, to make it more similar to shell variable expansions, and don't have two different sintaxis (with and without npm-run-all). In the regexp is as easy as allowing an optional $ leading character.