You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`verifyConditions`| Verify the presence of the `NPM_TOKEN` environment variable, create or update the `.npmrc` file with the token and verify the token is valid. |
15
+
|`prepare`| Update the `package.json` version and [create](https://docs.npmjs.com/cli/pack) the npm package tarball. |
16
+
|`publish`|[Publish the npm package](https://docs.npmjs.com/cli/publish) to the registry. |
13
17
14
-
Verify the presence of the `NPM_TOKEN` environment variable, create or update the `.npmrc` file with the token and verify the token is valid.
18
+
## Install
15
19
16
-
## prepare
20
+
```bash
21
+
$ npm install @semantic-release/npm -D
22
+
```
23
+
24
+
## Usage
17
25
18
-
Update the `package.json` version and [create](https://docs.npmjs.com/cli/pack) the `npm` package tarball.
26
+
The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration):
19
27
20
-
## publish
21
-
[Publish](https://docs.npmjs.com/cli/publish) to the `npm` registry.
28
+
```json
29
+
{
30
+
"plugins": [
31
+
"@semantic-release/commit-analyzer",
32
+
"@semantic-release/release-notes-generator",
33
+
"@semantic-release/npm",
34
+
]
35
+
}
36
+
```
22
37
23
38
## Configuration
24
39
25
40
### Npm registry authentication
26
41
27
-
The `npm` authentication configuration is **required** and can be set via [environment variables](#environment-variables).
42
+
The npm authentication configuration is **required** and can be set via [environment variables](#environment-variables).
28
43
29
-
Both the [token](https://docs.npmjs.com/getting-started/working_with_tokens) and the legacy (`username`, `password` and `email`) authentication are supported. It is recommended to use the [token](https://docs.npmjs.com/getting-started/working_with_tokens) authentication. The legacy authentication is supported as the alternative npm registries [Artifactory](https://www.jfrog.com/open-source/#os-arti) and [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp) only supports that form of authentication at this point.
44
+
Both the [token](https://docs.npmjs.com/getting-started/working_with_tokens) and the legacy (`username`, `password` and `email`) authentication are supported. It is recommended to use the [token](https://docs.npmjs.com/getting-started/working_with_tokens) authentication. The legacy authentication is supported as the alternative npm registries [Artifactory](https://www.jfrog.com/open-source/#os-arti) and [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp) only supports that form of authentication.
30
45
31
-
**Note**: Only the `auth-only`[level of npm two-factor authentication](https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) is supported, semantic-release will not work with the default `auth-and-writes` level.
46
+
**Note**: Only the `auth-only`[level of npm two-factor authentication](https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) is supported, **semantic-release** will not work with the default `auth-and-writes` level.
32
47
33
48
### Environment variables
34
49
@@ -55,7 +70,7 @@ Use either `NPM_TOKEN` for token authentication or `NPM_USERNAME`, `NPM_PASSWORD
55
70
56
71
### Npm configuration
57
72
58
-
The plugins are based on `npm`and will use the configuration from [`.npmrc`](https://docs.npmjs.com/files/npmrc). See [npm config](https://docs.npmjs.com/misc/config) for the option list.
73
+
The plugin uses the [`npm`CLI](https://github.com/npm/cli) which will read the configuration from [`.npmrc`](https://docs.npmjs.com/files/npmrc). See [`npm config`](https://docs.npmjs.com/misc/config) for the option list.
59
74
60
75
The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://docs.npmjs.com/cli/dist-tag) can be configured in the `package.json` and will take precedence over the configuration in `.npmrc`:
61
76
```json
@@ -67,48 +82,44 @@ The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://
67
82
}
68
83
```
69
84
70
-
### Usage
85
+
### Examples
71
86
72
-
The plugins are used by default by [semantic-release](https://github.com/semantic-release/semantic-release) so no specific configuration is required to use them.
73
-
74
-
Each individual plugin can be disabled, replaced or used with other plugins in the `package.json`:
87
+
The `npmPublish` and `tarballDir` option can be used to skip the publishing to the `npm` registry and instead, release the package tarball with another plugin. For example with the [@semantic-release/github](https://github.com/semantic-release/github) plugin:
The `npmPublish` and `tarballDir` option can be used to skip the publishing to the `npm` registry and instead, release the package tarball with another plugin. For example with the [github](https://github.com/semantic-release/github) plugin:
105
+
When publishing from a sub-directory with the `pkgRoot` option, the `package.json` and `npm-shrinkwrap.json` updated with the new version can be moved to another directory with a `postpublish`[npm script](https://docs.npmjs.com/misc/scripts). For example with the [@semantic-release/git](https://github.com/semantic-release/git) plugin:
When publishing from a sub-directory with the `pkgRoot` option, the `package.json` and `npm-shrinkwrap.json` updated with the new version can be moved to another directory with a `postpublish`[npm script](https://docs.npmjs.com/misc/scripts). For example with the [git](https://github.com/semantic-release/git) plugin:
0 commit comments