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
Copy file name to clipboardExpand all lines: README.md
+94-19Lines changed: 94 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -7,40 +7,36 @@
7
7
8
8
> stop using `npm version`, use `standard-version` it rocks!
9
9
10
-
Automatic release and CHANGELOG management, using GitHub's new squash button and
11
-
the workflow outlined in [conventional-changelog-standard](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md).
10
+
Automatic versioning and CHANGELOG management, using GitHub's new squash button and
11
+
the [recommended workflow](https://github.com/conventional-changelog/conventional-changelog-cli#recommended-workflow) for `conventional-changelog`.
12
12
13
13
_how it works:_
14
14
15
15
1. when you land commits on your `master` branch, select the _Squash and Merge_ option.
16
16
2. add a title and body that follows the [conventional-changelog-standard conventions](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md).
1. bumps the version in package.json (based on your commit history).
25
-
2. uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) to update _CHANGELOG.md._
26
-
3. commits _package.json_ and _CHANGELOG.md_.
27
-
4. tags a new release.
28
-
29
-
## Initial CHANGELOG.md Generation
30
-
31
-
When you're generating your changelog for the first time, simply do:
32
-
33
-
`standard-version --first-release`
24
+
1. bumps the version in _package.json_ (based on your commit history)
25
+
2. uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) to update _CHANGELOG.md_
26
+
3. commits _package.json_ and _CHANGELOG.md_
27
+
4. tags a new release
34
28
35
29
## Installation
36
30
37
-
`npm i standard-version -g`
31
+
### As `npm run` script
38
32
39
-
_Or, add it as a development dependency like so:_
33
+
Install and add to `devDependencies`:
40
34
41
-
`npm i standard-version --save-dev`
35
+
```
36
+
npm i --save-dev standard-version
37
+
```
42
38
43
-
_And add this to your _package.json:_
39
+
Add an [`npm run` script](https://docs.npmjs.com/cli/run-script)to your _package.json_:
44
40
45
41
```json
46
42
{
@@ -50,6 +46,63 @@ _And add this to your _package.json:_
50
46
}
51
47
```
52
48
49
+
Now you can use `npm run release` in place of `npm version`.
50
+
51
+
This has the benefit of making your repo/package more portable, so that other developers can cut releases without having to globally install `standard-version` on their machine.
52
+
53
+
### As global bin
54
+
55
+
Install globally (add to your `PATH`):
56
+
57
+
```
58
+
npm i -g standard-version
59
+
```
60
+
61
+
Now you can use `standard-version` in place of `npm version`.
62
+
63
+
This has the benefit of allowing you to use `standard-version` on any repo/package without adding a dev dependency to each one.
64
+
65
+
## Usage
66
+
67
+
### First Release
68
+
69
+
To generate your changelog for your first release, simply do:
70
+
71
+
```sh
72
+
# npm run script
73
+
npm run release -- --first-release
74
+
# or global bin
75
+
standard-version --first-release
76
+
```
77
+
78
+
This will tag a release **without bumping the version in package.json**.
79
+
80
+
When ready, push the git tag and `npm publish` your first release. \o/
81
+
82
+
### Cut a Release
83
+
84
+
If you typically use `npm version` to cut a new release, do this instead:
85
+
86
+
```sh
87
+
# npm run script
88
+
npm run release
89
+
# or global bin
90
+
standard-version
91
+
```
92
+
93
+
As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type - and you get CHANGELOG generation for free! \o/
94
+
95
+
After you cut a release, you can push the new git tag and `npm publish` (or `npm publish --tag next`) when you're ready.
96
+
97
+
### CLI Help
98
+
99
+
```sh
100
+
# npm run script
101
+
npm run release -- --help
102
+
# or global bin
103
+
standard-version --help
104
+
```
105
+
53
106
## Commit Message Convention, at a Glance
54
107
55
108
_patches:_
@@ -92,6 +145,28 @@ Tell your users that you adhere to the `standard-version` commit guidelines:
### How is `standard-version` different from `semantic-release`?
151
+
152
+
[`semantic-release`](https://github.com/semantic-release/semantic-release) is a fully automated library/system for versioning, changelog generation, git tagging, and publishing to the npm registry.
153
+
154
+
`standard-version` is different because it handles the versioning, changelog generation, and git tagging for you **without** automatic pushing (to GitHub) or publishing (to an npm registry). Use of `standard-version` only affects your local git repo - it doesn't affect remote resources at all. After you run `standard-version`, you still have to ability to review things and correct mistakes if you want to.
155
+
156
+
They are both based on the same foundation of structured commit messages (using [Angular format](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)), but `standard-version` is a good choice for folks who are not yet comfortable letting publishes go out automatically. In this way, you can view `standard-version` as an incremental step to adopting `semantic-release`.
157
+
158
+
We think they are both fantastic tools, and we encourage folks to use `semantic-release` instead of `standard-version` if it makes sense for them.
159
+
160
+
### Should I always squash commits when merging PRs?
161
+
162
+
The instructions to squash commits when merging pull requests assumes that **one PR equals, at most, one feature or fix**.
163
+
164
+
If you have multiple features or fixes landing in a single PR and each commit uses a structured message, then you can do a standard merge when accepting the PR. This will preserve the commit history from your branch after the merge.
165
+
166
+
Although this will allow each commit to be included as separate entries in your CHANGELOG, the entries will **not** be able to reference the PR that pulled the changes in because the preserved commit messages do not include the PR number.
167
+
168
+
For this reason, we recommend keeping the scope of each PR to one general feature or fix. In practice, this allows you to use unstructured commit messages when committing each little change and then squash them into a single commit with a structured message (referencing the PR number) once they have been reviewed and accepted.
0 commit comments