Npm-explore, npm-help and npm-help-search cli options
In the previous tutorial we looked at the npm-docs, npm-doctor and npm-edit cli options, the tutorial you are about to read will examine npm's explore, help and help-search cli options.
The npm-explore command will browse an installed package.
npm explore <pkg> [ -- <command>]
This cli option will spawn a subshell in the directory of the installed package specified. If there is a command that is specified, then it will run in the subshell, which will immediately terminate.
It is particularly handy in the case of git submodules in the node_modules folder:
npm explore some-dependency -- git pull origin master
it should be noted that the package will not be automatically rebuilt afterwards, so ensure that you use npm rebuild <pkg> if you make any changes.
This is the shell command used to run the npm explore command.
- Default: SHELL environment variable, or "cmd" on Windows, or "bash" on Posix.
- Type: path
When you need to get help on npm, you should run this command.
npm help <term> [<terms..>]
When a topic is supplied to this option, it will show the appropriate documentation page.
If the topic doesn't exist, or if you provide multiple terms, then you have to run the help-search command to find a match. It should be noted that if a single subject is found by help-search, it will run help on that topic, hence, unique matches are equivalent to specifying a topic name.
This indicates the program that will be used to view the help content.
You should set this to "browser" to view html content in the default web browser.
This CLI option is used to search the npm help documentation.
npm help-search <text>
This npm-help-search command will search the npm markdown documentation files for the terms provided, and then it will list the results, sorted by relevance.
In the case where only one result is found, then it shows that help topic.
Where the argument to npm help is not a known help topic, then it calls help-search. It is rarely ever necessary to call this command directly, as it will be triggered when npm help fails.
If this is true, then the long flag causes help-search to output context around where the terms were found in the documentation.
In the case where it is false, then help-search will just list out the help topic that it found.
- Type: Boolean
- Default: false
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework