commit-and-tag-version 11.0.0 → 11.1.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [11.1.0](https://github.com/absolute-version/commit-and-tag-version/compare/v11.0.0...v11.1.0) (2023-02-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * Expose release count option ([40d27f8](https://github.com/absolute-version/commit-and-tag-version/commit/40d27f8782c0621f6ec0ab796b4ae674ec6d43c8))
11
+ * replace the changelog if releaseCount = 0 ([d18af90](https://github.com/absolute-version/commit-and-tag-version/commit/d18af9040fdc2a5798681fa747a43a71cb75e47b))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * ensure git signatures are not present ([268800b](https://github.com/absolute-version/commit-and-tag-version/commit/268800b3c5e01993902cb0df0d123ac8b3388359))
17
+
5
18
  ## [11.0.0](https://github.com/absolute-version/commit-and-tag-version/compare/v10.1.0...v11.0.0) (2023-01-17)
6
19
 
7
20
 
package/README.md CHANGED
@@ -343,6 +343,27 @@ If you've already run `commit-and-tag-version` when creating your release, you m
343
343
  the version, by using `commit-and-tag-version --skip.bump`. By default, tagging with an already existing tag make `git` fails.
344
344
  You can add the `--tag-force` flag to make use of `-f` option when calling `git tag`, then the existing version tag will be replaced.
345
345
 
346
+ ### Generate changelogs for old releases
347
+
348
+ Normally only the changelog for the last release will be generated and prepended to the `changelog.md`. If you want to generate changelogs for previous releases you can do so by setting the `releaseCount` option like described [here](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core#releasecount).
349
+
350
+ When setting releaseCount=0 the whole changelog gets regenerated and replaced.
351
+
352
+ You can set the option either in the`.versionrc` file or inside `package.json` like below
353
+
354
+ ```json
355
+ //.versionrc
356
+ {
357
+ "releaseCount": 0
358
+ }
359
+
360
+ //package.json
361
+
362
+ "commit-and-tag-version": {
363
+ "releaseCount": 0
364
+ }
365
+ ```
366
+
346
367
  ### CLI Help
347
368
 
348
369
  ```sh
package/command.js CHANGED
@@ -73,6 +73,11 @@ const yargs = require('yargs')
73
73
  type: 'string',
74
74
  default: defaults.tagPrefix
75
75
  })
76
+ .option('release-count', {
77
+ describe: '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.',
78
+ type: 'number',
79
+ default: defaults.releaseCount
80
+ })
76
81
  .option('tag-force', {
77
82
  describe: 'Allow tag replacement',
78
83
  type: 'boolean',
package/defaults.js CHANGED
@@ -8,6 +8,7 @@ const defaults = {
8
8
  commitAll: false,
9
9
  silent: false,
10
10
  tagPrefix: 'v',
11
+ releaseCount: 1,
11
12
  scripts: {},
12
13
  skip: {},
13
14
  dryRun: false,
@@ -23,7 +23,7 @@ function outputChangelog (args, newVersion) {
23
23
  createIfMissing(args)
24
24
  const header = args.header
25
25
 
26
- let oldContent = args.dryRun ? '' : fs.readFileSync(args.infile, 'utf-8')
26
+ let oldContent = args.dryRun || args.releaseCount === 0 ? '' : fs.readFileSync(args.infile, 'utf-8')
27
27
  const oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
28
28
  // find the position of the last release and remove header:
29
29
  if (oldContentStart !== -1) {
@@ -34,8 +34,9 @@ function outputChangelog (args, newVersion) {
34
34
  const changelogStream = conventionalChangelog({
35
35
  debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
36
36
  preset: presetLoader(args),
37
- tagPrefix: args.tagPrefix
38
- }, context, { merges: null, path: args.path }, args.parserOpts, args.writerOpts)
37
+ tagPrefix: args.tagPrefix,
38
+ releaseCount: args.releaseCount
39
+ }, context, { merges: null, path: args.path, showSignature: false }, args.parserOpts, args.writerOpts)
39
40
  .on('error', function (err) {
40
41
  return reject(err)
41
42
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-and-tag-version",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "replacement for `npm version` with automatic CHANGELOG generation",
5
5
  "bin": "bin/cli.js",
6
6
  "scripts": {