Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDaijiro Wachi <daijiro.wachi@gmail.com>2015-05-20 10:55:11 +0300
committerRebecca Turner <me@re-becca.org>2015-05-21 00:30:20 +0300
commitb07f7c7c1e5021730b3c320f1b3a46e70f8a21ff (patch)
treec3a7f58c47aae6b337853bf61b186cf44b7a0d67 /doc
parentab4e902f20554983c6ccc7aa233fbb8be0f42544 (diff)
version: add lifecycle scripts around the version command
Fixes #7906. This was requested to allow authors to require scripts to be true prior to bumping the version number for release. For instance, by running the test suite. As bumping the version number is a typical action immediately prior to releasing a new version, this acts as a `prepublish` that ties to the actual act of publication, versus the `prepublish` lifecycle, which is run under some install-time circumstances as well.
Diffstat (limited to 'doc')
-rw-r--r--doc/cli/npm-version.md10
-rw-r--r--doc/misc/npm-scripts.md4
2 files changed, 14 insertions, 0 deletions
diff --git a/doc/cli/npm-version.md b/doc/cli/npm-version.md
index 545bce6b6..63a5e9512 100644
--- a/doc/cli/npm-version.md
+++ b/doc/cli/npm-version.md
@@ -40,6 +40,14 @@ in your git config for this to work properly. For example:
Enter passphrase:
+If "preversion", "version", "postversion" in the "scripts" property of
+the package.json, it will execute by running `npm version`. preversion
+and version ware executed before bump the package version, postversion
+was executed after bump the package version. For example to run `npm version`
+after passed all test:
+
+ "scripts": { "preversion": "npm test" }
+
## CONFIGURATION
### git-tag-version
@@ -52,6 +60,8 @@ Commit and tag the version change.
## SEE ALSO
* npm-init(1)
+* npm-run-script(1)
+* npm-scripts(7)
* package.json(5)
* semver(7)
* config(7)
diff --git a/doc/misc/npm-scripts.md b/doc/misc/npm-scripts.md
index e1380d1ed..1594d3c41 100644
--- a/doc/misc/npm-scripts.md
+++ b/doc/misc/npm-scripts.md
@@ -19,6 +19,10 @@ following scripts:
Run BEFORE the package is uninstalled.
* postuninstall:
Run AFTER the package is uninstalled.
+* preversion, version:
+ Run BEFORE bump the package version.
+* postversion:
+ Run AFTER bump the package version.
* pretest, test, posttest:
Run by the `npm test` command.
* prestop, stop, poststop: