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

[DOCS] --prefix not documented for npm run, npm install, etc. #1368

Open
devuxer opened this issue Jun 1, 2020 · 7 comments
Open

[DOCS] --prefix not documented for npm run, npm install, etc. #1368

devuxer opened this issue Jun 1, 2020 · 7 comments

Comments

@devuxer
Copy link

@devuxer devuxer commented Jun 1, 2020

Under npm-run-scripts, it says npm run-script <command> [--silent] [-- <args>...], but it doesn't say anything about --prefix.

The only place I've seen so far that mentions --prefix is shorthands and other CLI niceties, but this is not likely to be seen, so many developers will not realize the feature exists.

I would propose something like this for npm-run-script:


SYNOPSIS

npm run-script <command> [--silent] [--if-present] [--prefix <path>] [--scripts-prepend-node-path | --scripts-prepend-node-path=auto] [-- <args>...]

[...]

Options:

  • --silent - prevents npm ERR! from showing in the output on error
  • --if-present - avoids exiting with a non-zero exit code when the script is undefined, letting potentially undefined scripts to be run without breaking the execution chain
  • --prefix <path> - forces non-global commands to run in the specified folder, letting scripts contained in other project folders be run without needing to switch to them first (as might occur with a monorepo)
  • --scripts-prepend-node-path - add the directory within which node resides to the PATH
    • --scripts-prepend-node-path=auto - only adds the directory to the path if it is not already there (this has been the default since npm v3)

@darcyclarke
Copy link
Member

@darcyclarke darcyclarke commented Jun 2, 2021

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Loading

@darcyclarke darcyclarke closed this Jun 2, 2021
@devuxer
Copy link
Author

@devuxer devuxer commented Jun 3, 2021

@darcyclarke , This was just a documentation issue that nobody noticed for a full year, so I'm not interesting in re-filing. If you have the power to change the label to Release 7.x, though, that would be great.

Loading

@KishkinJ10
Copy link

@KishkinJ10 KishkinJ10 commented Aug 7, 2021

@wraithgar Sir can I work on this ??

Loading

@wraithgar
Copy link
Contributor

@wraithgar wraithgar commented Aug 10, 2021

Prefix is one of those 'core' concepts that doesn't make a lot of sense to call out for every command, but may benefit from mentioning in the full docs.

Prefix is mentioned in the npm install docs for example, but briefly and only in relation to the global flag.

If you want to try adding examples to the commands where you think it makes sense start with the .md files that power those pages, for example: https://github.com/npm/cli/blob/latest/docs/content/commands/npm-install.md

Loading

@devuxer
Copy link
Author

@devuxer devuxer commented Aug 11, 2021

@wraithgar,

I respectfully disagree. The prefix flag has extremely poor discoverability in my experience, and it's not really a "core concept" if most people are unaware it exists. I could see an argument for putting an "other flags" link that points to a page with flags that are common to many commands, but the way the docs are now, it' tricks developers into thinking they are seeing all the flags when in fact, they are only see a subset.

Loading

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Aug 11, 2021

The prefix config can cause all sorts of problems; it’s best if it’s not discoverable.

Loading

@devuxer
Copy link
Author

@devuxer devuxer commented Aug 11, 2021

@ljharb, If that's the case, then why aren't the problems it can cause also documented?

Loading

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

Successfully merging a pull request may close this issue.

None yet
5 participants