diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 004a2a8..5182ee6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [20.9.0, 22, 24] + node-version: [20.19.0, 22, 24] steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0fa03..67b985e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ format and uses semantic versioning when versioned releases are published. - Tightened template file validation and aligned generated workflow action versions. +### Fixed + +- Load the CLI version from its TypeScript module instead of a JSON import + attribute, and align the documented Node.js 20 minimum with the installed + development toolchain at Node.js 20.19. + ## Release Links - Unreleased: diff --git a/README.md b/README.md index 413aa60..dcfca97 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ MIT © [Roger Chappel](https://github.com/rogerchappel) ## Development -Typegap supports Node.js 20.9+ and 22 or newer. Node.js 21 +Typegap supports Node.js 20.19+ and 22 or newer. Node.js 21 is not supported because the shipped runtime dependency set does not support those releases. diff --git a/package-lock.json b/package-lock.json index ea68ae5..6478407 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "vitest": "^3.0.0" }, "engines": { - "node": "^20.9.0 || >=22.0.0" + "node": "^20.19.0 || >=22.0.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index ddfab96..3d10ebf 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ }, "homepage": "https://github.com/rogerchappel/typegap#readme", "engines": { - "node": "^20.9.0 || >=22.0.0" + "node": "^20.19.0 || >=22.0.0" }, "dependencies": { "@typescript-eslint/typescript-estree": "^8.0.0", diff --git a/src/cli.test.ts b/src/cli.test.ts index 026a050..d40b812 100644 --- a/src/cli.test.ts +++ b/src/cli.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect } from 'vitest'; import { execSync } from 'node:child_process'; +import { readFileSync } from 'node:fs'; describe('CLI integration', () => { const cli = 'npx tsx src/cli.ts'; @@ -10,6 +11,12 @@ describe('CLI integration', () => { expect(output).toContain('TypeScript type coverage auditor'); }); + it('reports the package version', () => { + const packageJson = JSON.parse(readFileSync('package.json', 'utf8')) as { version: string }; + const output = execSync(`${cli} --version`, { encoding: 'utf-8' }); + expect(output.trim()).toBe(packageJson.version); + }); + it('scans the fixtures directory', () => { const output = execSync(`${cli} fixtures/fully-typed`, { encoding: 'utf-8' }); expect(output).toContain('100.0%'); diff --git a/src/cli.ts b/src/cli.ts index 2ce3782..fdfc9f4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -10,14 +10,14 @@ import { resolve } from 'node:path'; import { existsSync } from 'node:fs'; import { analyzeDirectory } from './analyzer.js'; import { generateReport, saveBaseline } from './reporter.js'; -import packageJson from '../package.json' with { type: 'json' }; +import { version } from './version.js'; const program = new Command(); program .name('typegap') .description('TypeScript type coverage auditor — find the holes without compiling') - .version(packageJson.version) + .version(version) .argument('[directory]', 'directory to scan', '.') .option('--ignore ', 'glob patterns to ignore (comma-separated)') .option('--format ', 'output format: text or json', 'text')