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

feat: forward cli args #233

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat: forward cli args #233

wants to merge 2 commits into from

Conversation

OBannon37
Copy link

What:
Follows the format specified in #139 to forward command line arguments to scripts. Notably, this disables running scripts in parallel from the command line.

Why:
See discussion in #139

How:
By changing the parsing of command line args in src/bin/nps.js.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

I'd like to confirm the approach here. Specifically, I'm not sure if we should also be considering programatic use here. I thought no: I left the implementation of runPackageScript as is, so folks can still run scripts in parallel from the function call if they'd like to. I am assuming if someone is calling that function, they can already pass arbitrary command line args to each command just with string concatenation after a space, which is not possible from the CLI using the previous yargs parsing.

This would be a breaking change if released.

If the approach looks good, I can add documentation.

@@ -18,6 +24,7 @@ if (argv && psConfig) {
logLevel: argv.logLevel,
prefix: argv.prefix,
scripts: argv.scripts,
args: postCommandFlags,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another alternative to this new flag would be to just concatenate all the args as space separated strings to argv._[0].

It would be the same functionality either way, since we can run a maximum of one script from the cli now.

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

Successfully merging this pull request may close these issues.

None yet

1 participant