Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Series scripts execution breaks, when using underscored command names #172

Closed
SleepWalker opened this issue Mar 9, 2018 · 1 comment
Closed

Comments

@SleepWalker
Copy link
Contributor

  • nps version: 5.8.1
  • node version: 8.0.0
  • npm 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.

@kentcdodds
Copy link
Collaborator

Weird. Seems like a bug. Feel free to dig deeper and make a pull request if you find what's going on. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants