Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ permissions:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.18.0, 20.9.0, 22, 24]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run release:check
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ MIT © [Roger Chappel](https://github.com/rogerchappel)

## Development

Typegap supports Node.js 18.18+, 20.9+, and 22 or newer. Node.js 19 and 21
are not supported because the shipped runtime dependency set does not support
those releases.

Run the same release gate used by CI before opening a PR:

```bash
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"homepage": "https://github.com/rogerchappel/typegap#readme",
"engines": {
"node": ">=18.0.0"
"node": "^18.18.0 || ^20.9.0 || >=22.0.0"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "^8.0.0",
Expand Down
46 changes: 44 additions & 2 deletions scripts/package-smoke.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { spawnSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";

const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
encoding: "utf8",
Expand Down Expand Up @@ -64,4 +66,44 @@ if (!readFileSync(binPath, "utf8").startsWith("#!/usr/bin/env node")) {
process.exit(1);
}

console.log(`typegap package smoke passed with ${packument.files.length} packed file(s).`);
const smokeDir = mkdtempSync(join(tmpdir(), "typegap-package-smoke-"));

try {
const packResult = spawnSync("npm", ["pack", "--json", "--pack-destination", smokeDir], {
encoding: "utf8",
});

if (packResult.status !== 0) {
process.stderr.write(packResult.stderr);
process.exit(packResult.status ?? 1);
}

const [packed] = JSON.parse(packResult.stdout);
const tarballPath = join(smokeDir, packed.filename);
const installResult = spawnSync("npm", ["install", "--ignore-scripts", tarballPath], {
cwd: smokeDir,
encoding: "utf8",
});

if (installResult.status !== 0) {
process.stderr.write(installResult.stderr);
process.exit(installResult.status ?? 1);
}

const cliResult = spawnSync(join(smokeDir, "node_modules", ".bin", "typegap"), ["--help"], {
cwd: smokeDir,
encoding: "utf8",
});

if (cliResult.status !== 0 || !cliResult.stdout.includes("Usage: typegap")) {
process.stderr.write(cliResult.stderr);
console.error("installed package smoke failed to run the typegap CLI.");
process.exit(cliResult.status ?? 1);
}

console.log(
`typegap package smoke passed with ${packument.files.length} packed file(s) and an installed CLI invocation.`,
);
} finally {
rmSync(smokeDir, { recursive: true, force: true });
}
Loading