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, or an `.npmrc` file, and verify the authentication method is valid. |
12
-
|`prepare`| Update the `package.json` version and [create](https://docs.npmjs.com/cli/pack) the npm package tarball. |
13
-
|`addChannel`|[Add a release to a dist-tag](https://docs.npmjs.com/cli/dist-tag). |
14
-
|`publish`|[Publish the npm package](https://docs.npmjs.com/cli/publish) to the registry. |
12
+
|`prepare`| Update the `package.json` version and [create](https://docs.npmjs.com/cli/pack) the npm package tarball. |
13
+
|`addChannel`|[Add a release to a dist-tag](https://docs.npmjs.com/cli/dist-tag). |
14
+
|`publish`|[Publish the npm package](https://docs.npmjs.com/cli/publish) to the registry. |
15
15
16
16
## Install
17
17
@@ -25,11 +25,7 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
@@ -42,6 +38,7 @@ The npm authentication configuration is **required** and can be set via [environ
42
38
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.
43
39
44
40
**Notes**:
41
+
45
42
- 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
43
- The presence of an `.npmrc` file will override any specified environment variables.
47
44
@@ -53,17 +50,17 @@ Both the [token](https://docs.npmjs.com/getting-started/working_with_tokens) and
53
50
|`NPM_USERNAME`| Npm username created via [npm adduser](https://docs.npmjs.com/cli/adduser) or on [npmjs.com](https://www.npmjs.com)|
54
51
|`NPM_PASSWORD`| Password of the npm user. |
55
52
|`NPM_EMAIL`| Email address associated with the npm user |
56
-
|`NPM_CONFIG_USERCONFIG`| Path to non-default .npmrc file |
53
+
|`NPM_CONFIG_USERCONFIG`| Path to non-default .npmrc file |
57
54
58
55
Use either `NPM_TOKEN` for token authentication or `NPM_USERNAME`, `NPM_PASSWORD` and `NPM_EMAIL` for legacy authentication
|`npmPublish`| Whether to publish the `npm` package to the registry. If `false` the `package.json` version will still be updated. |`false` if the `package.json`[private](https://docs.npmjs.com/files/package.json#private) property is `true`, `true` otherwise. |
65
-
|`pkgRoot`| Directory path to publish. |`.`|
66
-
|`tarballDir`| Directory path in which to write the package tarball. If `false` the tarball is not be kept on the file system. |`false`|
|`npmPublish`| Whether to publish the `npm` package to the registry. If `false` the `package.json` version will still be updated. |`false` if the `package.json`[private](https://docs.npmjs.com/files/package.json#private) property is `true`, `true` otherwise. |
62
+
|`pkgRoot`| Directory path to publish. |`.`|
63
+
|`tarballDir`| Directory path in which to write the package tarball. If `false` the tarball is not be kept on the file system. |`false`|
67
64
68
65
**Note**: The `pkgRoot` directory must contain a `package.json`. The version will be updated only in the `package.json` and `npm-shrinkwrap.json` within the `pkgRoot` directory.
69
66
@@ -76,6 +73,7 @@ The plugin uses the [`npm` CLI](https://github.com/npm/cli) which will read the
76
73
The [`registry`](https://docs.npmjs.com/misc/registry) can be configured via the npm environment variable `NPM_CONFIG_REGISTRY` and will take precedence over the configuration in `.npmrc`.
77
74
78
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` and `NPM_CONFIG_REGISTRY`:
76
+
79
77
```json
80
78
{
81
79
"publishConfig": {
@@ -94,13 +92,19 @@ The `npmPublish` and `tarballDir` option can be used to skip the publishing to t
94
92
"plugins": [
95
93
"@semantic-release/commit-analyzer",
96
94
"@semantic-release/release-notes-generator",
97
-
["@semantic-release/npm", {
98
-
"npmPublish": false,
99
-
"tarballDir": "dist",
100
-
}],
101
-
["@semantic-release/github", {
102
-
"assets": "dist/*.tgz"
103
-
}]
95
+
[
96
+
"@semantic-release/npm",
97
+
{
98
+
"npmPublish": false,
99
+
"tarballDir": "dist"
100
+
}
101
+
],
102
+
[
103
+
"@semantic-release/github",
104
+
{
105
+
"assets": "dist/*.tgz"
106
+
}
107
+
]
104
108
]
105
109
}
106
110
```
@@ -112,15 +116,22 @@ When publishing from a sub-directory with the `pkgRoot` option, the `package.jso
// If the npm publish plugin is used and has `npmPublish`, `tarballDir` or `pkgRoot` configured, validate them now in order to prevent any release if the configuration is wrong
details: `The [npmPublish option](${linkify('README.md#npmpublish')}) option, if defined, must be a \`Boolean\`.
12
+
message: "Invalid `npmPublish` option.",
13
+
details: `The [npmPublish option](${linkify("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
14
14
15
15
Your configuration for the \`npmPublish\` option is \`${npmPublish}\`.`,
16
16
};
17
17
}
18
18
19
19
exportfunctionEINVALIDTARBALLDIR({ tarballDir }){
20
20
return{
21
-
message: 'Invalid `tarballDir` option.',
22
-
details: `The [tarballDir option](${linkify('README.md#tarballdir')}) option, if defined, must be a \`String\`.
21
+
message: "Invalid `tarballDir` option.",
22
+
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
23
23
24
24
Your configuration for the \`tarballDir\` option is \`${tarballDir}\`.`,
25
25
};
26
26
}
27
27
28
28
exportfunctionEINVALIDPKGROOT({ pkgRoot }){
29
29
return{
30
-
message: 'Invalid `pkgRoot` option.',
31
-
details: `The [pkgRoot option](${linkify('README.md#pkgroot')}) option, if defined, must be a \`String\`.
30
+
message: "Invalid `pkgRoot` option.",
31
+
details: `The [pkgRoot option](${linkify("README.md#pkgroot")}) option, if defined, must be a \`String\`.
32
32
33
33
Your configuration for the \`pkgRoot\` option is \`${pkgRoot}\`.`,
34
34
};
35
35
}
36
36
37
37
exportfunctionENONPMTOKEN({ registry }){
38
38
return{
39
-
message: 'No npm token specified.',
39
+
message: "No npm token specified.",
40
40
details: `An [npm token](${linkify(
41
-
'README.md#npm-registry-authentication'
41
+
"README.md#npm-registry-authentication"
42
42
)}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
43
43
44
44
Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and to set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow to publish to the registry \`${registry}\`.`,
@@ -47,9 +47,9 @@ Please make sure to create an [npm token](https://docs.npmjs.com/getting-started
47
47
48
48
exportfunctionEINVALIDNPMTOKEN({ registry }){
49
49
return{
50
-
message: 'Invalid npm token.',
50
+
message: "Invalid npm token.",
51
51
details: `The [npm token](${linkify(
52
-
'README.md#npm-registry-authentication'
52
+
"README.md#npm-registry-authentication"
53
53
)}) configured in the \`NPM_TOKEN\` environment variable must be a valid [token](https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry \`${registry}\`.
54
54
55
55
If you are using Two Factor Authentication for your account, set its level to ["Authorization only"](https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) in your account settings. **semantic-release** cannot publish with the default "
@@ -61,7 +61,7 @@ Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with t
61
61
62
62
exportfunctionENOPKGNAME(){
63
63
return{
64
-
message: 'Missing `name` property in `package.json`.',
64
+
message: "Missing `name` property in `package.json`.",
65
65
details: `The \`package.json\`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry.
66
66
67
67
Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
@@ -70,7 +70,7 @@ Please make sure to add a valid \`name\` for your package in your \`package.json
70
70
71
71
exportfunctionENOPKG(){
72
72
return{
73
-
message: 'Missing `package.json` file.',
73
+
message: "Missing `package.json` file.",
74
74
details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.
75
75
76
76
Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
0 commit comments