Series scripts execution breaks, when using underscored command names
SleepWalker opened this issue · comments
nps
version: 5.8.1node
version: 8.0.0npm
version: 5.6.0
Scripts file (or at least the relevant bits):
foo: {
bar: 'nps foo._bar foo._baz',
// bar: 'nps foo._baz foo._bar foo._baz foo._bar',
_bar: {
script: 'echo "bar"',
hiddenFromHelp: true,
},
_baz: {
script: 'echo "baz"',
hiddenFromHelp: true,
},
},
The command executed:
nps foo.bar
The output:
$ nps foo.bar
nps is executing `foo.bar` : echo "bar"
bar
Expected output:
$ nps foo.bar
nps is executing `foo.bar` : nps foo._baz foo._bar
nps is executing `foo._baz` : echo "baz"
baz
nps is executing `foo._bar` : echo "bar"
bar
Problem description:
If you run commands in series and one of the commands has the same name as a parent, but with underscore (at the beginning or at the end or both. no matter), it will execute only that command ignoring all other scripts in the series.
Suggested solution:
Looks like there are no special syntax around underscores, so I can assume, that this was due to case conversion during command parsing. I haven't looked at the source code, to provide an actual solution. But I can prepare a fix if this issue will be considered a bug.
Weird. Seems like a bug. Feel free to dig deeper and make a pull request if you find what's going on. Thanks!