Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/lib/content/commands/npm-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ The exact order of execution is as follows:
6. Run the `postversion` script.
Use it to clean up the file system or automatically push the commit and/or tag.

For the `preversion`, `version` and `postversion` scripts, npm also sets the [environment variables](/using-npm/scripts#environment) `npm_old_version` and `npm_new_version`.

Take the following example:

```json
Expand Down
7 changes: 7 additions & 0 deletions docs/lib/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ For example, if you had `{"name":"foo", "version":"1.2.5"}` in your package.json

See [`package.json`](/configuring-npm/package-json) for more on package configs.

#### versioning variables

For versioning scripts (`preversion`, `version`, `postversion`), npm sets these environment variables:

* `npm_old_version` - The version before being bumped
* `npm_new_version` – The version after being bumped

#### current lifecycle event

Lastly, the `npm_lifecycle_event` environment variable is set to whichever stage of the cycle is being executed.
Expand Down
3 changes: 3 additions & 0 deletions workspaces/libnpmversion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ The exact order of execution is as follows:
6. Run the `postversion` script. Use it to clean up the file system or
automatically push the commit and/or tag.

For the `preversion`, `version` and `postversion` scripts, npm also sets the
environment variables `npm_old_version` and `npm_new_version`.

Take the following example:

```json
Expand Down
Loading