]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/doc/cli/npm-version.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / doc / cli / npm-version.md
1 npm-version(1) -- Bump a package version
2 ========================================
3
4 ## SYNOPSIS
5
6     npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
7
8 ## DESCRIPTION
9
10 Run this in a package directory to bump the version and write the new
11 data back to `package.json` and, if present, `npm-shrinkwrap.json`.
12
13 The `newversion` argument should be a valid semver string, *or* a
14 valid second argument to semver.inc (one of `patch`, `minor`, `major`,
15 `prepatch`, `preminor`, `premajor`, `prerelease`). In the second case,
16 the existing version will be incremented by 1 in the specified field.
17
18 If run in a git repo, it will also create a version commit and tag.
19 This behavior is controlled by `git-tag-version` (see below), and can
20 be disabled on the command line by running `npm --no-git-tag-version version`.
21 It will fail if the working directory is not clean, unless the `--force`
22 flag is set.
23
24 If supplied with `--message` (shorthand: `-m`) config option, npm will
25 use it as a commit message when creating a version commit.  If the
26 `message` config contains `%s` then that will be replaced with the
27 resulting version number.  For example:
28
29     npm version patch -m "Upgrade to %s for reasons"
30
31 If the `sign-git-tag` config is set, then the tag will be signed using
32 the `-s` flag to git.  Note that you must have a default GPG key set up
33 in your git config for this to work properly.  For example:
34
35     $ npm config set sign-git-tag true
36     $ npm version patch
37
38     You need a passphrase to unlock the secret key for
39     user: "isaacs (http://blog.izs.me/) <i@izs.me>"
40     2048-bit RSA key, ID 6C481CF6, created 2010-08-31
41
42     Enter passphrase:
43
44 If `preversion`, `version`, or `postversion` are in the `scripts` property of
45 the package.json, they will be executed as part of running `npm version`.
46
47 The exact order of execution is as follows:
48   1. Check to make sure the git working directory is clean before we get started.
49      Your scripts may add files to the commit in future steps.
50      This step is skipped if the `--force` flag is set.
51   2. Run the `preversion` script. These scripts have access to the old `version` in package.json.
52      A typical use would be running your full test suite before deploying.
53      Any files you want added to the commit should be explicitly added using `git add`.
54   3. Bump `version` in `package.json` as requested (`patch`, `minor`, `major`, etc).
55   4. Run the `version` script. These scripts have access to the new `version` in package.json
56      (so they can incorporate it into file headers in generated files for example).
57      Again, scripts should explicitly add generated files to the commit using `git add`.
58   5. Commit and tag.
59   6. Run the `postversion` script. Use it to clean up the file system or automatically push
60      the commit and/or tag.
61
62 Take the following example:
63
64     "scripts": {
65       "preversion": "npm test",
66       "version": "npm run build && git add -A dist",
67       "postversion": "git push && git push --tags && rm -rf build/temp"
68     }
69
70 This runs all your tests, and proceeds only if they pass. Then runs your `build` script, and
71 adds everything in the `dist` directory to the commit. After the commit, it pushes the new commit
72 and tag up to the server, and deletes the `build/temp` directory.
73
74 ## CONFIGURATION
75
76 ### git-tag-version
77
78 * Default: true
79 * Type: Boolean
80
81 Commit and tag the version change.
82
83 ## SEE ALSO
84
85 * npm-init(1)
86 * npm-run-script(1)
87 * npm-scripts(7)
88 * package.json(5)
89 * semver(7)
90 * config(7)