{ "name": "npm-scripts-example", "scripts": { "prepublish": "# Run BEFORE the package is packed and published, as well as on local npm install without any arguments.", "prepare": "# Run both BEFORE the package is packed and published, and on local npm install without any arguments (See below). This is run AFTER prepublish, but BEFORE prepublishOnly.", "prepublishOnly": "# Run BEFORE the package is prepared and packed, ONLY on npm publish.", "prepack": "# Run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies).", "postpack": "# Run AFTER the tarball has been generated and moved to its final destination.", "publish": "# Run AFTER the package is published.", "postpublish": "# Run AFTER the package is published.",
... }, }
在 npm@3(3.10.8)环境运行 npm publish 结果如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
> npm-scripts-example@0.0.4 prepublish /path/to/npm-scripts-example > # Run BEFORE the package is packed and published, as well as on local npm install without any arguments.
# 上传到 npm 的进度条出现在这里
+ npm-scripts-example@0.0.4
> npm-scripts-example@0.0.4 publish . > # Run AFTER the package is published.
> npm-scripts-example@0.0.4 postpublish . > # Run AFTER the package is published.
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated. npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only. npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
> npm-scripts-example@0.0.5 prepublish . > # Run BEFORE the package is packed and published, as well as on local npm install without any arguments.
> npm-scripts-example@0.0.5 prepare . > # Run both BEFORE the package is packed and published, and on local npm install without any arguments (See below). This is run AFTER prepublish, but BEFORE prepublishOnly.
> npm-scripts-example@0.0.5 prepublishOnly . > # Run BEFORE the package is prepared and packed, ONLY on npm publish.
> npm-scripts-example@0.0.5 prepack . > # Run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies).
> npm-scripts-example@0.0.5 postpack . > # Run AFTER the tarball has been generated and moved to its final destination.
# 上传到 npm 的进度条出现在这里
> npm-scripts-example@0.0.5 publish . > # Run AFTER the package is published.
> npm-scripts-example@0.0.5 postpublish . > # Run AFTER the package is published.
"preinstall": "# Run BEFORE the package is installed.", "install": "# Run AFTER the package is installed.", "postinstall": "# Run AFTER the package is installed.",
> npm-scripts-example@0.0.5 preinstall /path/to/npm-scripts-example > # Run BEFORE the package is installed.
# extract node modules 的进度条出现在这里
> npm-scripts-example@0.0.5 install /path/to/npm-scripts-example > # Run AFTER the package is installed.
> npm-scripts-example@0.0.5 postinstall /path/to/npm-scripts-example > # Run AFTER the package is installed.
> npm-scripts-example@0.0.5 prepublish /path/to/npm-scripts-example > # Run BEFORE the package is packed and published, as well as on local npm install without any arguments.
> npm-scripts-example@0.0.5 preinstall /path/to/npm-scripts-example > # Run BEFORE the package is installed.
# extract node modules 的进度条出现在这里
> npm-scripts-example@0.0.5 install /path/to/npm-scripts-example > # Run AFTER the package is installed.
> npm-scripts-example@0.0.5 postinstall /path/to/npm-scripts-example > # Run AFTER the package is installed.
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated. npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only. npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
> npm-scripts-example@0.0.5 prepublish /path/to/npm-scripts-example > # Run BEFORE the package is packed and published, as well as on local npm install without any arguments.
> npm-scripts-example@0.0.5 prepare /path/to/npm-scripts-example > # Run both BEFORE the package is packed and published, and on local npm install without any arguments (See below). This is run AFTER prepublish, but BEFORE prepublishOnly.