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

chore(docs): Fixed example typo & code style in npm-scripts.md #1089

Closed
wants to merge 1 commit into from

Conversation

NNNaix
Copy link
Contributor

@NNNaix NNNaix commented Apr 1, 2020

Fixed example typo & code style in npm-scripts.md

First of all, thanks for your works.
When I read npm docs about using npm/scripts, I find a typo in the "Examples" section.
the scripts code example is as follows:

{ 
    "scripts" : { 
        "install" : "scripts/install.js", 
        "postinstall" : "scripts/postinstall.js", 
        "uninstall" : "scripts/uninstall.js"
    }
}

Considering the context:

then scripts/install.js will be called for the install and post-install stages of the lifecycle, and scripts/uninstall.js will be called when the package is uninstalled. Since scripts/install.js is running for two different phases, it would be wise in this case to look at the npm_lifecycle_event environment variable.

I think the postinstall script command should be "scripts/install.js", and the official website documentation also verified my idea.

By the way also beautify the code style of the JSON example :P

@NNNaix NNNaix requested a review from a team as a code owner April 1, 2020 02:43
@ruyadorno ruyadorno added Release 6.x work is associated with a specific npm 6 release semver:patch semver patch level for changes labels Apr 3, 2020
@ruyadorno ruyadorno closed this in d16a34f May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release 6.x work is associated with a specific npm 6 release semver:patch semver patch level for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants