conventional-changelog 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -204
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -36,46 +36,22 @@ Generate a changelog from git metadata.
|
|
|
36
36
|
> [!NOTE]
|
|
37
37
|
> You don't have to use the angular commit convention. For the best result of the tool to tokenize your commit and produce flexible output, it's recommended to use a commit convention.
|
|
38
38
|
|
|
39
|
-
<hr />
|
|
40
|
-
<a href="#install">Install</a>
|
|
41
|
-
<span> • </span>
|
|
42
|
-
<a href="#usage">Usage</a>
|
|
43
|
-
<span> • </span>
|
|
44
|
-
<a href="#recommended-workflow">Recommended workflow</a>
|
|
45
|
-
<span> • </span>
|
|
46
|
-
<a href="#why">Why</a>
|
|
47
|
-
<span> • </span>
|
|
48
|
-
<a href="#presets">Presets</a>
|
|
49
|
-
<span> • </span>
|
|
50
|
-
<a href="#js-api">JS API</a>
|
|
51
|
-
<br />
|
|
52
|
-
<hr />
|
|
53
|
-
|
|
54
39
|
## Install
|
|
55
40
|
|
|
41
|
+
Install `conventional-changelog` along with the preset you want to use, for example `angular`:
|
|
42
|
+
|
|
56
43
|
```bash
|
|
57
44
|
# pnpm
|
|
58
|
-
pnpm add conventional-changelog
|
|
45
|
+
pnpm add conventional-changelog conventional-changelog-angular
|
|
59
46
|
# yarn
|
|
60
|
-
yarn add conventional-changelog
|
|
47
|
+
yarn add conventional-changelog conventional-changelog-angular
|
|
61
48
|
# npm
|
|
62
|
-
npm i conventional-changelog
|
|
49
|
+
npm i conventional-changelog conventional-changelog-angular
|
|
63
50
|
```
|
|
64
51
|
|
|
65
52
|
## Usage
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```sh
|
|
70
|
-
# pnpm
|
|
71
|
-
pnpm add conventional-changelog-angular
|
|
72
|
-
# yarn
|
|
73
|
-
yarn add conventional-changelog-angular
|
|
74
|
-
# npm
|
|
75
|
-
npm i conventional-changelog-angular
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Then pass the preset name with `-p`:
|
|
54
|
+
Pass the preset name with `-p`:
|
|
79
55
|
|
|
80
56
|
```sh
|
|
81
57
|
conventional-changelog -p angular
|
|
@@ -83,82 +59,9 @@ conventional-changelog -p angular
|
|
|
83
59
|
|
|
84
60
|
This will *not* overwrite any previous changelogs. The above generates a changelog based on commits since the last semver tag that matches the pattern of "Feature", "Fix", "Performance Improvement" or "Breaking Changes".
|
|
85
61
|
|
|
86
|
-
If this is your first time using this tool and you want to generate all previous changelogs, you could do
|
|
87
|
-
|
|
88
|
-
```sh
|
|
89
|
-
conventional-changelog -p angular -r 0
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
This *will* overwrite any previous changelogs if they exist.
|
|
93
|
-
|
|
94
|
-
To generate a changelog for a specific commit range, pass tags or SHAs with `--from` and `--to`:
|
|
95
|
-
|
|
96
|
-
```sh
|
|
97
|
-
conventional-changelog -p angular --from v1.0.0 --to HEAD
|
|
98
|
-
```
|
|
99
|
-
|
|
100
62
|
All available command line parameters can be listed using CLI: `conventional-changelog --help`.
|
|
101
63
|
|
|
102
|
-
|
|
103
|
-
> You can alias your command or add it to your package.json. EG: `"changelog": "conventional-changelog -p angular -r 0"`.
|
|
104
|
-
|
|
105
|
-
## Recommended workflow
|
|
106
|
-
|
|
107
|
-
1. Make changes
|
|
108
|
-
2. Commit those changes
|
|
109
|
-
3. Make sure Travis turns green
|
|
110
|
-
4. Bump version in `package.json`
|
|
111
|
-
5. `conventional-changelog`
|
|
112
|
-
6. Commit `package.json` and `CHANGELOG.md` files
|
|
113
|
-
7. Tag
|
|
114
|
-
8. Push
|
|
115
|
-
|
|
116
|
-
The reason why you should commit and tag after `conventional-changelog` is that the CHANGELOG should be included in the new release, hence `commits.from` defaults to the latest semver tag.
|
|
117
|
-
|
|
118
|
-
### With `npm version`
|
|
119
|
-
|
|
120
|
-
Using the npm scripts to our advantage with the following hooks:
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"scripts": {
|
|
125
|
-
"version": "conventional-changelog -p angular && git add CHANGELOG.md"
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
You could follow the following workflow
|
|
131
|
-
|
|
132
|
-
1. Make changes
|
|
133
|
-
2. Commit those changes
|
|
134
|
-
3. Pull all the tags
|
|
135
|
-
4. Run the [`npm version [patch|minor|major]`](https://docs.npmjs.com/cli/version) command
|
|
136
|
-
5. Push
|
|
137
|
-
|
|
138
|
-
You could optionally add a `preversion` script to package your project or running a full suit of test.
|
|
139
|
-
And a `postversion` script to clean your system and push your release and tags.
|
|
140
|
-
|
|
141
|
-
By adding a `.npmrc` you could also automate your commit message and set your tag prefix as such:
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
tag-version-prefix=""
|
|
145
|
-
message="chore(release): %s :tada:"
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Why
|
|
149
|
-
|
|
150
|
-
- Easy fully automate changelog generation. You could still add more points on top of it.
|
|
151
|
-
- Ignoring reverted commits, templating with [handlebars.js](https://github.com/handlebars-lang/handlebars.js) and links to references, etc.
|
|
152
|
-
- Intelligently setup defaults but yet fully configurable with presets of [popular projects](#presets).
|
|
153
|
-
- Everything internally or externally is pluggable.
|
|
154
|
-
- A lot of tests and actively maintained.
|
|
155
|
-
|
|
156
|
-
## Presets
|
|
157
|
-
|
|
158
|
-
- [angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)
|
|
159
|
-
- [conventionalcommits](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)
|
|
160
|
-
|
|
161
|
-
## JS API
|
|
64
|
+
JS API is also available:
|
|
162
65
|
|
|
163
66
|
```js
|
|
164
67
|
import { ConventionalChangelog } from 'conventional-changelog'
|
|
@@ -170,109 +73,11 @@ const generator = new ConventionalChangelog()
|
|
|
170
73
|
generator
|
|
171
74
|
.writeStream()
|
|
172
75
|
.pipe(process.stdout)
|
|
173
|
-
|
|
174
|
-
// or
|
|
175
|
-
|
|
176
|
-
for await (const chunk of generator.write()) {
|
|
177
|
-
console.log(chunk)
|
|
178
|
-
}
|
|
179
76
|
```
|
|
180
77
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Create a new instance of conventional-changelog generator. `cwdOrGitClient` is the current working directory or a `ConventionalGitClient` instance.
|
|
184
|
-
|
|
185
|
-
#### `generator.loadPreset(preset: PresetParams): this`
|
|
186
|
-
|
|
187
|
-
Load and set necessary params from a preset.
|
|
188
|
-
|
|
189
|
-
#### `generator.config(config: Preset | Promise<Preset>): this`
|
|
190
|
-
|
|
191
|
-
Set the config directly.
|
|
192
|
-
|
|
193
|
-
#### `generator.readPackage(transform?: PackageTransform): this`
|
|
194
|
-
|
|
195
|
-
Find `package.json` up the directory tree and read it. Optionally transform the package data.
|
|
196
|
-
|
|
197
|
-
#### `generator.readPackage(path: string, transform?: PackageTransform): this`
|
|
198
|
-
|
|
199
|
-
Read a `package.json` file from a specific path. Optionally transform the package data.
|
|
200
|
-
|
|
201
|
-
#### `generator.package(pkg: Record<string, unknown>): this`
|
|
202
|
-
|
|
203
|
-
Set the package data directly.
|
|
204
|
-
|
|
205
|
-
#### `generator.readRepository(): this`
|
|
206
|
-
|
|
207
|
-
Read and parse the repository URL from current git repository.
|
|
208
|
-
|
|
209
|
-
#### `generator.repository(infoOrGitUrl: string | Partial<HostedGitInfo>): this`
|
|
210
|
-
|
|
211
|
-
Set the repository info directly.
|
|
212
|
-
|
|
213
|
-
#### `generator.options(options: Options): this`
|
|
214
|
-
|
|
215
|
-
Set conventional-changelog options.
|
|
216
|
-
|
|
217
|
-
| Name | Type | Default | Description |
|
|
218
|
-
| --- | --- | --- | --- |
|
|
219
|
-
| reset | `boolean` | `false` | Whether to reset the changelog or not. |
|
|
220
|
-
| append | `boolean` | `false` | Should the log be appended to existing data. |
|
|
221
|
-
| releaseCount | `number` | 1 | How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to `0` to regenerate all. |
|
|
222
|
-
| outputUnreleased | `boolean` | `true` if a different version than last release is given. Otherwise `false` | If this value is `true` and `context.version` equals last release then `context.version` will be changed to `'Unreleased'`. |
|
|
223
|
-
| transformCommit | `(commit: Commit, params: Params) => Partial<Commit> \| Promise<Partial<Commit> \| null> \| null` | | A transform function that applies after the parser and before the writer. |
|
|
224
|
-
| warn | `function` | | Logger for warnings |
|
|
225
|
-
| debug | `function` | | Logger for debug messages |
|
|
226
|
-
| formatDate | `(date: Date) => string` | | Custom date formatter function. |
|
|
227
|
-
|
|
228
|
-
#### `generator.context(context: TemplateContext): this`
|
|
229
|
-
|
|
230
|
-
Set the [writer context](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#context).
|
|
231
|
-
|
|
232
|
-
#### `generator.tags(params: GetSemverTagsParams): this`
|
|
233
|
-
|
|
234
|
-
Set params to get semver tags.
|
|
235
|
-
|
|
236
|
-
| Name | Type | Default | Description |
|
|
237
|
-
| --- | --- | --- | --- |
|
|
238
|
-
| prefix | `string \| RegExp` | | Specify a prefix for the git tag that will be taken into account during the comparison. |
|
|
239
|
-
| skipUnstable | `boolean` | `false` | If set, unstable release tags will be skipped, e.g. x.x.x-rc. |
|
|
240
|
-
| clean | `boolean` | `false` | Clean version from prefix and trash. |
|
|
241
|
-
|
|
242
|
-
If you want to take package-prefixed tags, for example lerna-style tags, you should use `packagePrefix` utility function:
|
|
243
|
-
|
|
244
|
-
```js
|
|
245
|
-
import {
|
|
246
|
-
ConventionalChangelog,
|
|
247
|
-
packagePrefix
|
|
248
|
-
} from 'conventional-changelog'
|
|
249
|
-
|
|
250
|
-
const generator = new ConventionalChangelog()
|
|
251
|
-
.readPackage()
|
|
252
|
-
.loadPreset('angular')
|
|
253
|
-
.tags({
|
|
254
|
-
prefix: packagePrefix('foo-package')
|
|
255
|
-
})
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
#### `generator.commits(params: GetCommitsParams, parserOptions?: ParserStreamOptions): this`
|
|
259
|
-
|
|
260
|
-
Set params to get commits.
|
|
261
|
-
|
|
262
|
-
- [GetCommitsParams](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/git-client/src/types.ts#L1-L41)
|
|
263
|
-
- [ParserStreamOptions](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-commits-parser/src/types.ts#L1-L68)
|
|
264
|
-
|
|
265
|
-
#### `generator.writer(params: WriterOptions): this`
|
|
266
|
-
|
|
267
|
-
Set [writer options](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#options).
|
|
268
|
-
|
|
269
|
-
#### `generator.write(includeDetails?: boolean): AsyncGenerator<string | Details<Commit>, void>`
|
|
270
|
-
|
|
271
|
-
Generate changelog.
|
|
272
|
-
|
|
273
|
-
#### `generator.writeStream(includeDetails?: boolean): Readable`
|
|
78
|
+
## Documentation
|
|
274
79
|
|
|
275
|
-
|
|
80
|
+
For comprehensive guides, CLI options, and API reference, visit the [documentation website](https://conventional-changelog.js.org/conventional-changelog/).
|
|
276
81
|
|
|
277
82
|
## License
|
|
278
83
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conventional-changelog",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.1",
|
|
5
5
|
"description": "Generate a changelog from git metadata.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Steve Mao",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"homepage": "https://
|
|
23
|
+
"homepage": "https://conventional-changelog.js.org/conventional-changelog/",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
26
|
"url": "https://github.com/conventional-changelog/conventional-changelog.git",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"@simple-libs/normalize-package-data": "^1.0.0",
|
|
52
52
|
"fd-package-json": "^2.0.0",
|
|
53
53
|
"meow": "^14.0.0",
|
|
54
|
-
"conventional-changelog-
|
|
55
|
-
"
|
|
56
|
-
"conventional-
|
|
57
|
-
"conventional-
|
|
54
|
+
"@conventional-changelog/git-client": "^3.0.2",
|
|
55
|
+
"conventional-changelog-preset-loader": "^6.0.1",
|
|
56
|
+
"conventional-changelog-writer": "^9.1.1",
|
|
57
|
+
"conventional-commits-parser": "^7.0.1"
|
|
58
58
|
},
|
|
59
59
|
"bin": {
|
|
60
60
|
"conventional-changelog": "./dist/cli/index.js"
|