Skip to content

Commit 124aca1

Browse files
committed
docs: harmonize docs with other plugins
1 parent 98fc020 commit 124aca1

File tree

2 files changed

+51
-40
lines changed

2 files changed

+51
-40
lines changed

README.md

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @semantic-release/npm
22

3-
Set of [semantic-release](https://github.com/semantic-release/semantic-release) plugins for publishing to a [npm](https://www.npmjs.com/) registry.
3+
[**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to publish a [npm](https://www.npmjs.com) package.
44

55
[![Travis](https://img.shields.io/travis/semantic-release/npm.svg)](https://travis-ci.org/semantic-release/npm)
66
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/npm.svg)](https://codecov.io/gh/semantic-release/npm)
@@ -9,26 +9,41 @@ Set of [semantic-release](https://github.com/semantic-release/semantic-release)
99
[![npm latest version](https://img.shields.io/npm/v/@semantic-release/npm/latest.svg)](https://www.npmjs.com/package/@semantic-release/npm)
1010
[![npm next version](https://img.shields.io/npm/v/@semantic-release/npm/next.svg)](https://www.npmjs.com/package/@semantic-release/npm)
1111

12-
## verifyConditions
12+
| Step | Description |
13+
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
14+
| `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. |
1317

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
1519

16-
## prepare
20+
```bash
21+
$ npm install @semantic-release/npm -D
22+
```
23+
24+
## Usage
1725

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):
1927

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+
```
2237

2338
## Configuration
2439

2540
### Npm registry authentication
2641

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).
2843

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.
3045

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.
3247

3348
### Environment variables
3449

@@ -55,7 +70,7 @@ Use either `NPM_TOKEN` for token authentication or `NPM_USERNAME`, `NPM_PASSWORD
5570

5671
### Npm configuration
5772

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.
5974

6075
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`:
6176
```json
@@ -67,48 +82,44 @@ The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://
6782
}
6883
```
6984

70-
### Usage
85+
### Examples
7186

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:
7588

7689
```json
7790
{
78-
"release": {
79-
"verifyConditions": ["@semantic-release/npm", "verify-other-condition"],
80-
"prepare": ["@semantic-release/npm", "custom-prepare"],
81-
"publish": ["@semantic-release/npm", "custom-publish"]
82-
}
91+
"plugins": [
92+
"@semantic-release/commit-analyzer",
93+
"@semantic-release/release-notes-generator",
94+
["@semantic-release/npm", {
95+
"npmPublish": false,
96+
"tarballDir": "dist",
97+
}],
98+
["@semantic-release/github", {
99+
"assets": "dist/*.tgz"
100+
}]
101+
]
83102
}
84103
```
85104

86-
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:
87106

88107
```json
89108
{
90-
"release": {
91-
"verifyConditions": ["@semantic-release/npm", "@semantic-release/git", "@semantic-release/github"],
92-
"prepare": ["@semantic-release/npm"],
93-
"publish": ["@semantic-release/npm", "@semantic-release/github"],
94-
"npmPublish": false,
95-
"tarballDir": "dist",
96-
"assets": "dist/*.tgz"
97-
}
109+
"plugins": [
110+
"@semantic-release/commit-analyzer",
111+
"@semantic-release/release-notes-generator",
112+
["@semantic-release/npm", {
113+
"pkgRoot": "dist",
114+
}],
115+
["@semantic-release/git", {
116+
"assets": ["package.json", "npm-shrinkwrap.json"]
117+
}]
118+
]
98119
}
99120
```
100-
101-
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:
102-
103121
```json
104122
{
105-
"release": {
106-
"verifyConditions": ["@semantic-release/npm", "@semantic-release/git"],
107-
"prepare": ["@semantic-release/npm", "@semantic-release/git"],
108-
"publish": ["@semantic-release/npm"],
109-
"pkgRoot": "dist",
110-
"assets": ["package.json", "npm-shrinkwrap.json"]
111-
},
112123
"scripts": {
113124
"postpublish": "cp -r dist/package.json . && cp -r dist/npm-shrinkwrap.json ."
114125
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@semantic-release/npm",
3-
"description": "Set of semantic-release plugins to publish to a npm registry",
3+
"description": "semantic-release plugin to publish a npm package",
44
"version": "0.0.0-development",
55
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
66
"bugs": {

0 commit comments

Comments
 (0)