commit-and-tag-version 11.3.0 → 12.0.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/.eslintrc CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
- "extends": "standard",
2
+ "extends": ["standard", "plugin:mocha/recommended"],
3
+ "plugins": [
4
+ "mocha",
5
+ "@fintechstudios/eslint-plugin-chai-as-promised",
6
+ ],
3
7
  "rules": {
4
- "no-var": "error"
8
+ "no-var": "error",
9
+ "mocha/max-top-level-suites": "off",
10
+ "mocha/no-setup-in-describe": "off",
11
+ "@fintechstudios/chai-as-promised/no-unhandled-promises": "error",
12
+ "@fintechstudios/chai-as-promised/no-await-in-condition": "error"
5
13
  }
6
14
  }
@@ -0,0 +1,19 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ # Node / npm
9
+ - package-ecosystem: "npm" # See documentation for possible values
10
+ directory: "/" # Location of package manifests
11
+ versioning-strategy: increase
12
+ schedule:
13
+ interval: "weekly"
14
+
15
+ # Maintain dependencies for GitHub Actions
16
+ - package-ecosystem: "github-actions"
17
+ directory: "/"
18
+ schedule:
19
+ interval: "weekly"
@@ -10,17 +10,17 @@ jobs:
10
10
  runs-on: ${{ matrix.os }}
11
11
  strategy:
12
12
  matrix:
13
- node: [14, 16, 18]
13
+ node: [18, 20.4]
14
14
  os: [ubuntu-latest, windows-latest]
15
15
  env:
16
16
  OS: ${{ matrix.os }}
17
17
  NODE_VERSION: ${{ matrix.node }}
18
18
  steps:
19
- - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
19
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
20
20
  - run: git fetch --prune --unshallow
21
21
  - run: git config --global user.name 'Actions'
22
22
  - run: git config --global user.email 'dummy@example.org'
23
- - uses: actions/setup-node@v3
23
+ - uses: actions/setup-node@v4
24
24
  with:
25
25
  node-version: ${{ matrix.node }}
26
26
  - run: node --version
@@ -15,13 +15,13 @@ jobs:
15
15
  release-type: node
16
16
  package-name: commit-and-tag-version
17
17
  # The logic below handles the npm publication:
18
- - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
18
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
19
19
  # these if statements ensure that a publication only occurs when
20
20
  # a new release is created:
21
21
  if: ${{ steps.release.outputs.release_created }}
22
- - uses: actions/setup-node@v3
22
+ - uses: actions/setup-node@v4
23
23
  with:
24
- node-version: 16
24
+ node-version: 20
25
25
  registry-url: 'https://registry.npmjs.org'
26
26
  if: ${{ steps.release.outputs.release_created }}
27
27
  - run: npm ci
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
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
+ ## [12.0.0](https://github.com/absolute-version/commit-and-tag-version/compare/v11.3.0...v12.0.0) (2023-10-31)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * Drop support for node 14, 16. Now supports node 18 and 20.
11
+
12
+ ### Bug Fixes
13
+
14
+ * Drop support for node 14, 16. Now supports node 18 and 20. ([b1a58bc](https://github.com/absolute-version/commit-and-tag-version/commit/b1a58bc2a786da48fbcec248204ff8631c79606e))
15
+ * preserve frontmatter when updating changelog ([#108](https://github.com/absolute-version/commit-and-tag-version/issues/108)) ([abdcfe2](https://github.com/absolute-version/commit-and-tag-version/commit/abdcfe295023f46c8724463940fff6a220434fad))
16
+
5
17
  ## [11.3.0](https://github.com/absolute-version/commit-and-tag-version/compare/v11.2.4...v11.3.0) (2023-10-10)
6
18
 
7
19
 
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  > **`commit-and-tag-version` is a fork of `standard-version`**. Because of maintainer availability, `standard-version` was [deprecated on 15th May 2022](https://github.com/conventional-changelog/standard-version/pull/907). The previous maintainer recommends [release-please](https://github.com/googleapis/release-please) as an alternative for those who are using GitHub actions. This fork exists for those who can't switch to `release-please`, or who would like to continue using `standard-version`.
4
4
 
5
- > **`Why was it renamed commit-and-tag-version?`**. I didn't want to scope the package or name it `standard-version-fork`, and it was a good opportunity to make the purpose of the tool clearer. I also wanted to distinguish it from the other tool in this organisation, [`absolute-version`](https://github.com/absolute-version/absolute-version-js), which just prints version information for pre-releases. To migrate, you can drop in `commit-and-tag-version` in place of `standard-version`. There are no changes in 9.5.0, other than to add the package.json config key `commit-and-tag-version` (the previous configuration key `standard-version` will still work).
5
+ > **`Can I simply swap the library to migrate?`** To migrate, you can drop in `commit-and-tag-version` in place of `standard-version`. There are no changes in 9.5.0, other than to add the package.json config key `commit-and-tag-version` (the previous configuration key `standard-version` will still work). 10.x drops support for deprecated node versions, 11.x is a formatting change if you're relying on the exact markdown format in the changelog, and 12.x drops support for node 14/16.
6
+
7
+ > **`Why was it renamed commit-and-tag-version?`**. I didn't want to scope the package or name it `standard-version-fork`, and it was a good opportunity to make the purpose of the tool clearer. I also wanted to distinguish it from the other tool in this organisation, [`absolute-version`](https://github.com/absolute-version/absolute-version-js), which just prints version information for pre-releases.
6
8
 
7
9
 
8
10
  A utility for versioning using [semver](https://semver.org/) and CHANGELOG generation powered by [Conventional Commits](https://conventionalcommits.org).
@@ -18,17 +18,38 @@ Changelog.START_OF_LAST_RELEASE_PATTERN = START_OF_LAST_RELEASE_PATTERN
18
18
 
19
19
  module.exports = Changelog
20
20
 
21
+ /**
22
+ * Front matter is only extracted and therefore retained in final output where Changelog "header" begins with #Changelog,
23
+ * e.g. meets Standard-Version (last release) or commit-and-tag-version(current) format
24
+ */
25
+ function extractFrontMatter (oldContent) {
26
+ const headerStart = oldContent.indexOf('# Changelog')
27
+ return headerStart !== -1 || headerStart !== 0
28
+ ? oldContent.substring(0, headerStart)
29
+ : ''
30
+ }
31
+
32
+ /**
33
+ * find the position of the last release and remove header
34
+ */
35
+ function extractChangelogBody (oldContent) {
36
+ const oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
37
+ return oldContentStart !== -1
38
+ ? oldContent.substring(oldContentStart)
39
+ : oldContent
40
+ }
41
+
21
42
  function outputChangelog (args, newVersion) {
22
43
  return new Promise((resolve, reject) => {
23
44
  createIfMissing(args)
24
45
  const header = args.header
25
46
 
26
- let oldContent = args.dryRun || args.releaseCount === 0 ? '' : fs.readFileSync(args.infile, 'utf-8')
27
- const oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
28
- // find the position of the last release and remove header:
29
- if (oldContentStart !== -1) {
30
- oldContent = oldContent.substring(oldContentStart)
31
- }
47
+ const oldContent = args.dryRun || args.releaseCount === 0 ? '' : fs.readFileSync(args.infile, 'utf-8')
48
+
49
+ const oldContentBody = extractChangelogBody(oldContent)
50
+
51
+ const changelogFrontMatter = extractFrontMatter(oldContent)
52
+
32
53
  let content = ''
33
54
  const context = { version: newVersion }
34
55
  const changelogStream = conventionalChangelog({
@@ -48,7 +69,7 @@ function outputChangelog (args, newVersion) {
48
69
  changelogStream.on('end', function () {
49
70
  checkpoint(args, 'outputting changes to %s', [args.infile])
50
71
  if (args.dryRun) console.info(`\n---\n${chalk.gray(content.trim())}\n---\n`)
51
- else writeFile(args, args.infile, header + '\n' + (content + oldContent).replace(/\n+$/, '\n'))
72
+ else writeFile(args, args.infile, changelogFrontMatter + header + '\n' + (content + oldContentBody).replace(/\n+$/, '\n'))
52
73
  return resolve()
53
74
  })
54
75
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-and-tag-version",
3
- "version": "11.3.0",
3
+ "version": "12.0.0",
4
4
  "description": "replacement for `npm version` with automatic CHANGELOG generation",
5
5
  "bin": "bin/cli.js",
6
6
  "scripts": {
@@ -51,22 +51,24 @@
51
51
  "figures": "^3.1.0",
52
52
  "find-up": "^5.0.0",
53
53
  "git-semver-tags": "^5.0.0",
54
- "semver": "^7.1.1",
55
- "yargs": "^17.0.0"
54
+ "semver": "^7.5.4",
55
+ "yargs": "^17.7.2"
56
56
  },
57
57
  "devDependencies": {
58
- "chai": "^4.2.0",
58
+ "@fintechstudios/eslint-plugin-chai-as-promised": "^3.1.0",
59
+ "chai": "^4.3.10",
59
60
  "chai-as-promised": "^7.1.1",
60
- "eslint": "^8.16.0",
61
- "eslint-config-standard": "^17.0.0",
62
- "eslint-plugin-import": "^2.26.0",
61
+ "eslint": "^8.52.0",
62
+ "eslint-config-standard": "^17.1.0",
63
+ "eslint-plugin-import": "^2.29.0",
64
+ "eslint-plugin-mocha": "^10.2.0",
63
65
  "eslint-plugin-n": "^15.2.0",
64
- "eslint-plugin-promise": "^6.0.0",
65
- "mocha": "^10.0.0",
66
- "mock-fs": "^5.0.0",
66
+ "eslint-plugin-promise": "^6.1.1",
67
+ "mocha": "^10.2.0",
68
+ "mock-fs": "^5.2.0",
67
69
  "mockery": "^2.1.0",
68
70
  "nyc": "^15.1.0",
69
- "shelljs": "^0.8.4",
71
+ "shelljs": "^0.8.5",
70
72
  "std-mocks": "^1.0.1",
71
73
  "strip-ansi": "^6.0.0"
72
74
  }
@@ -64,7 +64,7 @@ function mock ({ bump, changelog, tags } = {}) {
64
64
  return () => stdMocks.flush()
65
65
  }
66
66
 
67
- describe('config files', () => {
67
+ describe('config files', function () {
68
68
  beforeEach(function () {
69
69
  shell.rm('-rf', 'tmp')
70
70
  shell.config.silent = true