Repository navigation
Commit 7d7cdde
build!: drop Node.js 18 support and modernize the dev toolchain
Raise the supported Node.js baseline to >= 20 and bring the test, git-hook,
coverage and dependency toolchain up to currently-maintained versions.
Several dependency upgrades (notably glob 13 and pnpm 10+) surfaced latent
runtime bugs, which are fixed here as well.
Runtime fixes
-------------
* config discovery (src/configLoader/findup.js): switch to the named
`import { globSync } from 'glob'`. glob v9+ removed the default export, so
with glob 13 `glob` resolved to `undefined` and every config lookup threw
`TypeError: Cannot read properties of undefined (reading 'sync')`.
* `commitizen init --pnpm` (src/commitizen/init.js, src/commitizen/adapter.js):
- forward the `exact` option into `getInstallStringMappings()` and key the
pnpm `--save-exact` flag off `exact` instead of `saveExact` (which is never
set on the pnpm path). `commitizen init --pnpm --save-exact` now pins an
exact version instead of silently writing a caret range.
- pass `--ignore-scripts` to the pnpm install. pnpm >= 10 turns
"ignored build scripts" (ERR_PNPM_IGNORED_BUILDS) into a fatal error, which
aborted the install before `config.commitizen.path` was written. Commitizen
adapters never need their dependencies' lifecycle scripts.
Dependency upgrades
-------------------
* mocha 9.2.2 -> 12.0.0
* nyc 15.1.0 -> 18.0.0
* babel-plugin-istanbul 6.1.1 -> 7.0.1
* nodemon 2.0.22 -> 3.1.14
* sinon 12.0.1 -> 22.1.0
* uuid 8.3.2 -> 11.1.1
* conventional-changelog-conventionalcommits 4.6.3 -> 7.0.2
* glob 7.2.3 -> 13.0.6 (runtime dependency)
* fs-extra 9.1.0 -> 11.4.0 (runtime dependency)
* find-node-modules ^2.1.2 -> ^2.1.3 (runtime dependency)
Dependency removals and replacements
------------------------------------
* ghooks -> husky 9. Drop the `config.ghooks` block, add `.husky/pre-commit`
(`npm run test && npm run check-coverage`), and run `husky` from the
`prepare` script. Replace the `in-publish` / `not-in-install` build-on-
publish hack with a standard `prepublishOnly` script; `in-publish` removed.
* Remove `codecov`. The npm `codecov` uploader is end-of-life and the
`report-coverage` script was unused: Azure Pipelines already publishes
coverage from `npm run write-coverage` (cobertura). Stale `codecov.io` and
`travis.ci` badges removed from the README.
* Remove `mocha-multi-reporters` and `mocha-junit-reporter`. Both are
unmaintained and throw "Class constructor Base cannot be invoked without
'new'" on mocha >= 11. Replaced with a small in-repo composite reporter,
test/reporters/multi-reporter.cjs, that drives mocha's built-in `spec` and
`xunit` reporters from a single run and fans `done()` out to flush the
JUnit XML file. `test/mochareporters.json` deleted.
Test harness
------------
* `test-actual` now runs `mocha --require @babel/register ...` directly, so it
works when invoked on its own and not only through the `nyc` wrapper. The
test files use extensionless ESM imports that only resolve once Babel
rewrites them to `require`.
* JUnit output is written to `./junit-testresults.xml` via
`--reporter-option output=`; added to `.gitignore`.
* test/tools/clean.js: the per-test artifact archive no longer copies
`node_modules`. It is large and slow, and on Windows pnpm's nested junctions
under `.pnpm` make a later recursive walk of `test/artifacts` (Azure's
PublishTestResults glob) fail with `EPERM: operation not permitted, stat`.
* babel.config.js: `@babel/preset-env` target bumped from node 10 to node 20.
CI
--
jobs/build.yml:
* Node matrix is now 20, 22, 24 and 26 (Node 18 removed); `maxParallel` 3 -> 4.
* Node install task `NodeTool@0` -> `UseNode@1`.
* pnpm bumped 9 -> 12.
* PublishTestResults@2 now points at the exact `junit-testresults.xml` under
`$(System.DefaultWorkingDirectory)` instead of the recursive `**/junit-*.xml`
glob, so it never walks the artifacts tree (which is what triggered the
Windows `EPERM: operation not permitted, stat` failure on pnpm's `.pnpm`
junctions).
* PublishCodeCoverageResults@1 -> @2; drop the removed `codeCoverageTool`
input and point `summaryFileLocation` at the single
`$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml` rather
than a recursive glob.
Housekeeping
------------
* .gitignore: add `.idea`, `.omc`, `junit-testresults.xml`.
* package-lock.json regenerated.
BREAKING CHANGE: Node.js 18 is no longer supported. The minimum supported
runtime is now Node.js 20 (`engines.node` is `>= 20`), and npm 9 or newer is
recommended. Installing or running commitizen on Node.js 18 or earlier will
fail the engine check. This is required because upgraded tooling and
transitive dependencies (mocha 12, nyc 18, glob 13's `minimatch`/`lru-cache`,
and the pnpm 10+ CLI used in CI) have themselves dropped Node.js 18.
Fixes #1020, fixes #1006
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 1a8c49c commit 7d7cdde
13 files changed
Lines changed: 2955 additions & 12636 deletions
File tree
- .husky
- jobs
- src
- commitizen
- configLoader
- test
- reporters
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | | - | |
| 19 | + | |
16 | 20 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
22 | | - | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
0 commit comments