From 0317790ebe2501a8cc51dc7e0b266c01da16158a Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Fri, 31 Jul 2026 19:14:50 -0400 Subject: [PATCH 1/2] Prepare 0.1.0 OIDC release lane for scheduler packages. Add multi-package release packing/publish scripts and the signed-tag GitHub workflow, bump both packages and fixture pins to 0.1.0, and document the activation steps after the 0.0.0 bootstrap and trusted-publisher setup. --- .github/workflows/publish.yml | 123 ++++ README.md | 3 +- docs/PROJECT_PLAN.md | 21 +- docs/RELEASE_NOTES.md | 29 + docs/RELEASING.md | 105 ++- fixtures/README.md | 9 +- fixtures/azure-functions/package.json | 2 +- fixtures/ops-hub/package.json | 4 +- fixtures/support-desk/package.json | 2 +- package-lock.json | 14 +- package.json | 3 + packages/scheduler-cloudflare/package.json | 4 +- packages/scheduler/package.json | 2 +- scripts/release-packages.d.mts | 68 ++ scripts/release-packages.mjs | 763 +++++++++++++++++++++ tests/release-packages.test.ts | 60 ++ tsconfig.test.json | 2 + vitest.config.ts | 6 +- 18 files changed, 1167 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 docs/RELEASE_NOTES.md create mode 100644 scripts/release-packages.d.mts create mode 100644 scripts/release-packages.mjs create mode 100644 tests/release-packages.test.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d78188c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,123 @@ +# Publishes exact tarballs prepared from a signed stable release tag. +# Authentication is npm trusted-publisher OIDC only; no token fallback exists. + +name: Publish + +on: + release: + types: [published] + +permissions: + contents: read + +concurrency: + group: npm-publish + cancel-in-progress: false + +jobs: + prepare: + runs-on: ubuntu-latest + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_PRERELEASE: ${{ github.event.release.prerelease }} + RELEASE_COMMIT: ${{ github.sha }} + RELEASE_ALLOWED_SIGNERS: ${{ vars.RELEASE_ALLOWED_SIGNERS }} + + steps: + - name: Check out the release tag + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + ref: refs/tags/${{ github.event.release.tag_name }} + fetch-depth: 0 + + - name: Fetch the protected release branch + run: git fetch --no-tags origin main:refs/remotes/origin/main + + - name: Configure approved release signers + shell: bash + run: | + if [[ -z "${RELEASE_ALLOWED_SIGNERS}" ]]; then + echo "::error::RELEASE_ALLOWED_SIGNERS must contain the reviewed SSH allowed-signers entries" + exit 1 + fi + allowed_signers="${RUNNER_TEMP}/release-allowed-signers" + umask 077 + printf '%s\n' "${RELEASE_ALLOWED_SIGNERS}" > "${allowed_signers}" + git config --local gpg.format ssh + git config --local gpg.ssh.allowedSignersFile "${allowed_signers}" + + - name: Set up Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 + with: + node-version: 24.18.0 + registry-url: https://registry.npmjs.org + package-manager-cache: false + + - name: Use the reviewed npm release + run: npm install --global npm@11.18.0 + + - name: Install dependencies + run: npm ci + + - name: Check formatting + run: npm run format:check + + - name: Check types + run: npm run check + + - name: Run tests + run: npm test + + - name: Prepare and verify release tarballs + run: npm run release:pack -- -- --require-clean --require-main-ancestor --require-release-tag --expected-release-commit "${RELEASE_COMMIT}" --output .release + + - name: Upload the prepared release + id: upload + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: scheduler-release-${{ github.run_id }} + path: .release/ + if-no-files-found: error + include-hidden-files: true + overwrite: true + retention-days: 30 + + - name: Record the prepared artifact digest + run: echo "Prepared artifact SHA-256 ${{ steps.upload.outputs.artifact-digest }}" >> "${GITHUB_STEP_SUMMARY}" + + publish: + needs: prepare + runs-on: ubuntu-latest + environment: npm-publish + permissions: + contents: read + id-token: write + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_COMMIT: ${{ github.sha }} + + steps: + - name: Check out the exact release tag + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + ref: refs/tags/${{ github.event.release.tag_name }} + fetch-depth: 1 + + - name: Set up Node.js and the npm registry + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 + with: + node-version: 24.18.0 + registry-url: https://registry.npmjs.org + package-manager-cache: false + + - name: Use the reviewed npm release + run: npm install --global npm@11.18.0 + + - name: Download the prepared release + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: scheduler-release-${{ github.run_id }} + path: .release + + - name: Publish verified prepared tarballs + run: npm run release:publish -- -- --expected-release-commit "${RELEASE_COMMIT}" --manifest .release/package-manifest.json diff --git a/README.md b/README.md index 685d4a9..c5ecb56 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ Phase 4 is implemented in source. The repository contains `@pegma/scheduler` (contracts, durable runner), `@pegma/scheduler-cloudflare` (explicit Cron Trigger dispatch), independent consumer fixtures under `fixtures/`, Memory Store / Azurite / local D1 tests, and design documentation. -No package has been published. +`0.0.0` was a package-name bootstrap only. The first advertised release is +`0.1.0` via the OIDC publish workflow once `v0.1.0` is tagged. The first consumers are: diff --git a/docs/PROJECT_PLAN.md b/docs/PROJECT_PLAN.md index 18498ba..665ec07 100644 --- a/docs/PROJECT_PLAN.md +++ b/docs/PROJECT_PLAN.md @@ -2,15 +2,17 @@ ## Status -**Stage:** Phases 0–4 are complete in source (contracts, durable runner, -Cloudflare adapter, and independent consumer fixtures). No package is published -or production-usable. +**Stage:** Phases 0–4 are complete in source. Phase 5 release automation and +the first advertised `0.1.0` package versions are prepared for OIDC publish. +The package-name bootstrap (`0.0.0` under tag `bootstrap`) is complete; trusted +publishers are configured. Advertised `0.1.0` is published only from a signed +`v0.1.0` tag through `.github/workflows/publish.yml`. **Trigger:** Ops Hub and Support Desk independently need the same explicit, durable coordination boundary for recurring work. -**Initial package:** `@pegma/scheduler`, currently `0.0.0` as an unpublished -development placeholder. +**Initial package:** `@pegma/scheduler` and `@pegma/scheduler-cloudflare`, +first advertised release `0.1.0`. **Current exact dependencies:** `@pegma/spine@0.1.2` and `@pegma/storage-core@0.4.0`, refreshed from the Pegma catalog on 2026-07-31. @@ -110,7 +112,7 @@ the fixture is the integration bar until that host lands Worker phases. Support Desk domain packages stay outside this repository; the fixture mirrors `HOST_COMPOSITION.md` loop names without inventing per-bucket tasks. -### Phase 5 — first advertised release +### Phase 5 — first advertised release (automation complete; tag/publish handoff) - Complete focused security review and package inventory verification. - Add signed-tag/OIDC release automation following current Pegma practice. @@ -118,6 +120,13 @@ Support Desk domain packages stay outside this repository; the fixture mirrors - Publish `0.1.0` only from a protected signed annotated tag. - Add the component and a green synthetic recipe to `pegma.dev`. +**Automation evidence:** `.github/workflows/publish.yml`, +`scripts/release-packages.mjs`, `npm run release:check|pack|publish`, package +versions `0.1.0`, and `docs/RELEASE_NOTES.md`. Activation remains: signed +`v0.1.0` tag + `gh release create` on `main`, then confirm `latest=0.1.0`. +The `pegma.dev` recipe is a separate host-repo follow-up after registry +visibility. + ## Non-goals - cron parsing, calendars, DST, or timezone policy; diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md new file mode 100644 index 0000000..1530906 --- /dev/null +++ b/docs/RELEASE_NOTES.md @@ -0,0 +1,29 @@ +# Release notes + +## 0.1.0 — first advertised release + +First supported publication of: + +- `@pegma/scheduler` +- `@pegma/scheduler-cloudflare` + +### Included + +- Static task registry and durable `scheduler.task-state.v1` collection +- `createScheduler` durable runner (claims, leases, checkpoints, inspection) +- Adversarial Memory Store and Azurite coverage +- Cloudflare Cron Trigger dispatch with real local D1 fixture tests +- Independent consumer fixtures for Ops Hub, Support Desk, and Azure Functions shapes + +### Install + +```sh +npm install @pegma/scheduler@0.1.0 +npm install @pegma/scheduler-cloudflare@0.1.0 +``` + +### Notes + +- Execution is at-least-once; domain work must be idempotent. +- `0.0.0` was a non-advertised package-name bootstrap only. +- Hosts own timer delivery (Cloudflare Cron Triggers, Azure timers, local drivers). diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 6cedbf3..c9629f0 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,29 +1,80 @@ # Release operations -Scheduler is intentionally not releasable in Phase 1. There is no publish -workflow or release script yet, and `0.0.0` is not an advertised version. - -Before adding release automation: - -1. Complete the Phase 2 runner and adversarial tests. -2. Complete real Azurite and D1 verification. -3. Complete Ops Hub and Support Desk consumer fixtures - (`fixtures/ops-hub`, `fixtures/support-desk`, plus Azure reference under - `fixtures/azure-functions`). -4. Complete a focused security review. -5. Refresh exact Pegma dependency pins from `https://pegma.dev/catalog.json`. - -The eventual lane must match current Pegma release rules: - -- protected `main` branch; -- protected signed annotated `vX.Y.Z` tag already on `origin/main`; -- `gh release create vX.Y.Z --verify-tag`; -- unprivileged gate and exact tarball preparation; -- minimal publish job with npm trusted-publisher OIDC only; -- provenance enabled and no token fallback; -- package-local README and LICENSE; -- `prepack` build and test files excluded from `dist`. - -A first package-name bootstrap, if npm still requires it, must be isolated from -the normal release lane and must never make `0.0.x` the advertised supported -release. +There are exactly two publication paths: + +1. a one-time manual bootstrap of `@pegma/scheduler@0.0.0` and + `@pegma/scheduler-cloudflare@0.0.0` (already completed), needed before npm had + package names on which trusted publishing could be configured; and +2. every advertised release, beginning with `0.1.0`, through the + environment-protected GitHub OIDC workflow in + [`.github/workflows/publish.yml`](../.github/workflows/publish.yml). + +The normal release lane rejects the entire `0.0.x` range. Bootstrap artifacts +remain non-advertised. + +## Common source requirements + +Every advertised artifact comes from a protected, signed, annotated `vX.Y.Z` +tag whose commit is already contained in `origin/main`. Configure: + +- the protected `npm-publish` GitHub environment; +- repository variable `RELEASE_ALLOWED_SIGNERS` with reviewed SSH allowed-signers + entries; and +- tag protection against moving or deleting `v*`. + +npm trusted publishers for both packages must identify: + +- organization `pegma-dev` +- repository `scheduler` +- workflow filename `publish.yml` +- environment `npm-publish` +- allowed action `npm publish` + +Run `npm run format:check`, `npm run check`, and `npm test` on Node 22 and 24 +before tagging. Never unpublish and reuse a version. + +## Normal OIDC releases (`0.1.0` and later) + +1. Land a reviewed PR that sets both public packages (and lockfile / fixture + pins) to the same stable version, and updates release notes. +2. After merge to `main`, create a **protected signed annotated** tag: + + ```sh + git checkout main + git pull --ff-only origin main + git tag -s v0.1.0 -m "v0.1.0" + git push origin v0.1.0 + ``` + +3. Create a GitHub release from that tag (this starts the publish workflow): + + ```sh + gh release create v0.1.0 --verify-tag --title "v0.1.0" --notes-file docs/RELEASE_NOTES.md + ``` + +4. The workflow: + - verifies the signed tag against `RELEASE_ALLOWED_SIGNERS`; + - runs the full gate; + - packs both packages with `npm run release:pack`; + - publishes exact tarballs with provenance via OIDC (`npm run release:publish`). + +Local helpers (never substitute for the OIDC lane for advertised releases): + +```sh +npm run release:check +npm run release:pack -- -- --output .release +# release:publish is restricted to the GitHub release workflow +``` + +## After `0.1.0` lands + +Confirm: + +```sh +npm dist-tag ls @pegma/scheduler +npm dist-tag ls @pegma/scheduler-cloudflare +npm view @pegma/scheduler version +``` + +`latest` should be `0.1.0` for both packages. Unqualified install is then safe +to advertise. diff --git a/fixtures/README.md b/fixtures/README.md index 64bcf58..2dd41e5 100644 --- a/fixtures/README.md +++ b/fixtures/README.md @@ -1,9 +1,9 @@ # Consumer fixtures Independent host compositions that declare exact dependency pins in each -fixture `package.json` (`@pegma/scheduler@0.0.0`, and for Ops Hub also -`@pegma/scheduler-cloudflare@0.0.0`) against the monorepo workspaces and prove -real scheduled work before any npm publish. +fixture `package.json` (`@pegma/scheduler@0.1.0`, and for Ops Hub also +`@pegma/scheduler-cloudflare@0.1.0`) against the monorepo workspaces and prove +real scheduled work. These fixtures are the Phase 4 integration bar described in `docs/RELEASING.md`. They deliberately do **not** import Ops Hub or Support @@ -18,4 +18,5 @@ names and bounded-page shapes documented in those consumers. | `azure-functions` | Timer-trigger composition for a RetireGolden-style Azure host | Run with the repository gate (`npm test`). External consumers should pin the -first advertised release (`0.1.0`) after Phase 5 publishes. +first advertised release (`0.1.0`) from npm after the signed `v0.1.0` OIDC +publish completes. diff --git a/fixtures/azure-functions/package.json b/fixtures/azure-functions/package.json index 988ee18..cc41500 100644 --- a/fixtures/azure-functions/package.json +++ b/fixtures/azure-functions/package.json @@ -5,7 +5,7 @@ "description": "Azure Functions timer composition fixture for @pegma/scheduler.", "type": "module", "dependencies": { - "@pegma/scheduler": "0.0.0", + "@pegma/scheduler": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } diff --git a/fixtures/ops-hub/package.json b/fixtures/ops-hub/package.json index 28e26ad..be1bd19 100644 --- a/fixtures/ops-hub/package.json +++ b/fixtures/ops-hub/package.json @@ -5,8 +5,8 @@ "description": "Ops Hub-shaped consumer fixture for @pegma/scheduler.", "type": "module", "dependencies": { - "@pegma/scheduler": "0.0.0", - "@pegma/scheduler-cloudflare": "0.0.0", + "@pegma/scheduler": "0.1.0", + "@pegma/scheduler-cloudflare": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } diff --git a/fixtures/support-desk/package.json b/fixtures/support-desk/package.json index b68528b..9fe8161 100644 --- a/fixtures/support-desk/package.json +++ b/fixtures/support-desk/package.json @@ -5,7 +5,7 @@ "description": "Support Desk-shaped consumer fixture for @pegma/scheduler.", "type": "module", "dependencies": { - "@pegma/scheduler": "0.0.0", + "@pegma/scheduler": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } diff --git a/package-lock.json b/package-lock.json index 2ec59b4..dd8577b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "name": "@pegma/fixture-azure-functions", "version": "0.0.0", "dependencies": { - "@pegma/scheduler": "0.0.0", + "@pegma/scheduler": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } @@ -41,8 +41,8 @@ "name": "@pegma/fixture-ops-hub", "version": "0.0.0", "dependencies": { - "@pegma/scheduler": "0.0.0", - "@pegma/scheduler-cloudflare": "0.0.0", + "@pegma/scheduler": "0.1.0", + "@pegma/scheduler-cloudflare": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } @@ -51,7 +51,7 @@ "name": "@pegma/fixture-support-desk", "version": "0.0.0", "dependencies": { - "@pegma/scheduler": "0.0.0", + "@pegma/scheduler": "0.1.0", "@pegma/spine": "0.1.2", "@pegma/storage-core": "0.4.0" } @@ -7347,7 +7347,7 @@ }, "packages/scheduler": { "name": "@pegma/scheduler", - "version": "0.0.0", + "version": "0.1.0", "license": "MIT", "dependencies": { "@pegma/spine": "0.1.2", @@ -7359,10 +7359,10 @@ }, "packages/scheduler-cloudflare": { "name": "@pegma/scheduler-cloudflare", - "version": "0.0.0", + "version": "0.1.0", "license": "MIT", "dependencies": { - "@pegma/scheduler": "0.0.0" + "@pegma/scheduler": "0.1.0" }, "engines": { "node": ">=22" diff --git a/package.json b/package.json index 39f5fae..1599a2a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "clean": "tsc -b --clean", "format": "prettier --write .", "format:check": "prettier --check .", + "release:check": "node scripts/release-packages.mjs check", + "release:pack": "node scripts/release-packages.mjs pack", + "release:publish": "node scripts/release-packages.mjs publish", "test": "npm run build && npm run test:node && npm run test:d1", "test:node": "vitest run --config vitest.config.ts", "test:d1": "vitest run --config vitest.d1.config.ts" diff --git a/packages/scheduler-cloudflare/package.json b/packages/scheduler-cloudflare/package.json index 79ccd11..e77a093 100644 --- a/packages/scheduler-cloudflare/package.json +++ b/packages/scheduler-cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/scheduler-cloudflare", - "version": "0.0.0", + "version": "0.1.0", "description": "Cloudflare Cron Trigger dispatch for @pegma/scheduler.", "license": "MIT", "type": "module", @@ -29,7 +29,7 @@ "directory": "packages/scheduler-cloudflare" }, "dependencies": { - "@pegma/scheduler": "0.0.0" + "@pegma/scheduler": "0.1.0" }, "scripts": { "build": "tsc -p tsconfig.json", diff --git a/packages/scheduler/package.json b/packages/scheduler/package.json index 0da11e2..c0bf79f 100644 --- a/packages/scheduler/package.json +++ b/packages/scheduler/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/scheduler", - "version": "0.0.0", + "version": "0.1.0", "description": "Durable coordination for host-triggered recurring Pegma work.", "license": "MIT", "type": "module", diff --git a/scripts/release-packages.d.mts b/scripts/release-packages.d.mts new file mode 100644 index 0000000..95174ee --- /dev/null +++ b/scripts/release-packages.d.mts @@ -0,0 +1,68 @@ +export interface ReleasePackageDefinition { + readonly directory: string; + readonly name: string; +} + +export interface ValidationOptions { + readonly root?: string; + readonly releaseTag?: string; + readonly releasePrerelease?: boolean | string; + readonly expectedReleaseCommit?: string; + readonly requireClean?: boolean; + readonly requireMainAncestor?: boolean; + readonly requireReleaseTag?: boolean; +} + +export interface ReleaseCommandOptions extends ValidationOptions { + readonly manifest?: string; + readonly output?: string; +} + +export interface PublicPackageManifest { + readonly name: string; + readonly version: string; + readonly [key: string]: unknown; +} + +export interface ValidatedPackage { + readonly definition: ReleasePackageDefinition; + readonly manifest: PublicPackageManifest; + readonly packageDirectory: string; +} + +export interface ValidationResult { + readonly root: string; + readonly packages: readonly ValidatedPackage[]; + readonly releaseTag: string | undefined; +} + +export const RELEASE_PACKAGES: readonly ReleasePackageDefinition[]; + +export function isNormalReleaseVersion(version: string): boolean; + +export function parseArguments( + arguments_: readonly string[], +): ReleaseCommandOptions; + +export function validateRepository( + options?: ValidationOptions, +): Promise; + +export function validateReleaseTag(options?: { + readonly root?: string; + readonly releaseTag?: string; + readonly expectedReleaseCommit?: string; +}): { headCommit: string; releaseTag: string }; + +export function decidePublication( + localIntegrity: string, + registryIntegrity: string | null, +): "publish" | "skip"; + +export function prepareRelease( + options?: ReleaseCommandOptions, +): Promise<{ manifestPath: string; manifest: unknown }>; + +export function publishPreparedRelease( + options?: ReleaseCommandOptions, +): Promise; diff --git a/scripts/release-packages.mjs b/scripts/release-packages.mjs new file mode 100644 index 0000000..7b19c13 --- /dev/null +++ b/scripts/release-packages.mjs @@ -0,0 +1,763 @@ +import { spawnSync } from "node:child_process"; +import { createHash, timingSafeEqual } from "node:crypto"; +import { + mkdtemp, + mkdir, + readFile, + readdir, + rm, + stat, + writeFile, +} from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { basename, dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const REPOSITORY_URL = "git+https://github.com/pegma-dev/scheduler.git"; +const NODE_RANGE = ">=22"; +const REVIEWED_NPM_VERSION = "11.18.0"; +const STABLE_SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u; +const DEPENDENCY_SECTIONS = [ + "dependencies", + "devDependencies", + "optionalDependencies", + "peerDependencies", +]; + +/** Public packages in dependency order (core before Cloudflare adapter). */ +export const RELEASE_PACKAGES = [ + { + directory: "scheduler", + name: "@pegma/scheduler", + }, + { + directory: "scheduler-cloudflare", + name: "@pegma/scheduler-cloudflare", + }, +]; + +const RELEASE_NAMES = new Set(RELEASE_PACKAGES.map(({ name }) => name)); +const FIRST_RELEASE_VERSION = "0.1.0"; + +export function isNormalReleaseVersion(version) { + const match = + typeof version === "string" ? STABLE_SEMVER.exec(version) : null; + // Reject the entire 0.0.x bootstrap range from the normal release lane. + return match !== null && (match[1] !== "0" || match[2] !== "0"); +} + +function fail(message) { + throw new Error(message); +} + +async function readJson(path) { + return JSON.parse(await readFile(path, "utf8")); +} + +function sameJson(left, right) { + return JSON.stringify(left) === JSON.stringify(right); +} + +function safeEqual(left, right) { + const leftBytes = Buffer.from(left); + const rightBytes = Buffer.from(right); + return ( + leftBytes.length === rightBytes.length && + timingSafeEqual(leftBytes, rightBytes) + ); +} + +function run(command, arguments_, options = {}) { + const result = spawnSync(command, arguments_, { + cwd: options.cwd, + encoding: "utf8", + env: options.env ?? process.env, + shell: options.shell ?? false, + stdio: options.capture ? "pipe" : "inherit", + }); + if (result.error) { + throw result.error; + } + if (result.status !== 0 && !options.allowFailure) { + const detail = [result.stdout, result.stderr].filter(Boolean).join("\n"); + fail( + `${command} ${arguments_.join(" ")} failed with exit code ${String(result.status)}${detail ? `:\n${detail}` : ""}`, + ); + } + return result; +} + +function runNpm(arguments_, options = {}) { + const npmExecPath = process.env.npm_execpath; + if (npmExecPath !== undefined) { + return run(process.execPath, [npmExecPath, ...arguments_], options); + } + return run(process.platform === "win32" ? "npm.cmd" : "npm", arguments_, { + ...options, + shell: process.platform === "win32", + }); +} + +function gitCommand() { + return process.platform === "win32" ? "git.exe" : "git"; +} + +function hashTarball(bytes) { + return { + shasum: createHash("sha1").update(bytes).digest("hex"), + integrity: `sha512-${createHash("sha512").update(bytes).digest("base64")}`, + }; +} + +function exportSpecifiers(manifest) { + if ( + manifest.exports === null || + typeof manifest.exports !== "object" || + Array.isArray(manifest.exports) + ) { + fail(`${manifest.name} must declare object-form exports`); + } + return Object.keys(manifest.exports).map((key) => + key === "." ? manifest.name : `${manifest.name}${key.slice(1)}`, + ); +} + +function exportTargets(value) { + if (typeof value === "string") { + return [value]; + } + if (value !== null && typeof value === "object" && !Array.isArray(value)) { + return Object.values(value).flatMap(exportTargets); + } + return []; +} + +async function validatePackage(root, definition, lockfile) { + const packageDirectory = join(root, "packages", definition.directory); + const manifest = await readJson(join(packageDirectory, "package.json")); + if (manifest.name !== definition.name) { + fail(`expected ${definition.name} in packages/${definition.directory}`); + } + if (!STABLE_SEMVER.test(manifest.version)) { + fail(`${definition.name} must use a stable semantic version`); + } + if ( + manifest.private === true || + manifest.license !== "MIT" || + manifest.type !== "module" || + manifest.publishConfig?.access !== "public" || + manifest.engines?.node !== NODE_RANGE || + manifest.repository?.type !== "git" || + manifest.repository?.url !== REPOSITORY_URL || + manifest.repository?.directory !== `packages/${definition.directory}` + ) { + fail(`${definition.name} has invalid public package metadata`); + } + if ( + !Array.isArray(manifest.files) || + manifest.files.length === 0 || + manifest.files.some((entry) => !entry.startsWith("dist/")) + ) { + fail(`${definition.name} must publish only its dist allowlist`); + } + if ( + typeof manifest.scripts?.prepack !== "string" || + !manifest.scripts.prepack.includes("build") + ) { + fail(`${definition.name} must build during prepack`); + } + const targets = exportTargets(manifest.exports); + if ( + targets.length === 0 || + targets.some( + (target) => + typeof target !== "string" || + !target.startsWith("./dist/") || + target.includes(".."), + ) + ) { + fail(`${definition.name} exports must point into dist`); + } + await stat(join(packageDirectory, "README.md")); + await stat(join(packageDirectory, "LICENSE")); + + const lockEntry = lockfile.packages?.[`packages/${definition.directory}`]; + if (lockEntry?.version !== manifest.version) { + fail( + `${definition.name} version is not synchronized with package-lock.json`, + ); + } + for (const section of DEPENDENCY_SECTIONS) { + for (const [name, version] of Object.entries(manifest[section] ?? {})) { + if (!RELEASE_NAMES.has(name)) { + continue; + } + const dependency = RELEASE_PACKAGES.find((entry) => entry.name === name); + const dependencyManifest = await readJson( + join(root, "packages", dependency.directory, "package.json"), + ); + if ( + version !== dependencyManifest.version || + lockEntry[section]?.[name] !== version + ) { + fail( + `${definition.name} must pin ${name} to its exact workspace version`, + ); + } + } + } + return { definition, manifest, packageDirectory }; +} + +async function publicWorkspaceInventory(root) { + const directories = await readdir(join(root, "packages"), { + withFileTypes: true, + }); + const names = []; + for (const directory of directories) { + if (!directory.isDirectory()) { + continue; + } + const manifestPath = join(root, "packages", directory.name, "package.json"); + try { + const manifest = await readJson(manifestPath); + if (manifest.private !== true) { + names.push(manifest.name); + } + } catch (error) { + if (error?.code !== "ENOENT") { + throw error; + } + } + } + return names.sort(); +} + +export function validateReleaseTag(options = {}) { + const root = resolve(options.root ?? defaultRoot()); + const releaseTag = options.releaseTag ?? process.env.RELEASE_TAG; + const expectedReleaseCommit = + options.expectedReleaseCommit ?? process.env.RELEASE_COMMIT; + if (releaseTag === undefined || !/^v\d+\.\d+\.\d+$/u.test(releaseTag)) { + fail("a stable release tag is required"); + } + if ( + expectedReleaseCommit === undefined || + !/^[0-9a-f]{40,64}$/u.test(expectedReleaseCommit) + ) { + fail("an exact release event commit is required"); + } + + const tagRef = `refs/tags/${releaseTag}`; + const objectType = run(gitCommand(), ["cat-file", "-t", tagRef], { + cwd: root, + capture: true, + allowFailure: true, + }); + if (objectType.status !== 0 || objectType.stdout.trim() !== "tag") { + fail("the release ref must be an annotated tag object"); + } + const headCommit = run(gitCommand(), ["rev-parse", "HEAD"], { + cwd: root, + capture: true, + }).stdout.trim(); + const tagCommit = run(gitCommand(), ["rev-parse", `${tagRef}^{commit}`], { + cwd: root, + capture: true, + }).stdout.trim(); + if ( + !safeEqual(headCommit, tagCommit) || + !safeEqual(headCommit, expectedReleaseCommit) + ) { + fail( + "the release checkout, signed tag target, and release event commit must match", + ); + } + const signature = run(gitCommand(), ["verify-tag", "--raw", tagRef], { + cwd: root, + capture: true, + allowFailure: true, + }); + if (signature.status !== 0) { + fail("the release tag signature is not valid for an approved signer"); + } + const onMain = run( + gitCommand(), + ["merge-base", "--is-ancestor", tagCommit, "refs/remotes/origin/main"], + { cwd: root, capture: true, allowFailure: true }, + ); + if (onMain.status !== 0) { + fail("the release tag commit must be contained in origin/main"); + } + return { headCommit, releaseTag }; +} + +export async function validateRepository(options = {}) { + const root = resolve(options.root ?? defaultRoot()); + const rootManifest = await readJson(join(root, "package.json")); + if ( + rootManifest.private !== true || + rootManifest.packageManager !== `npm@${REVIEWED_NPM_VERSION}` + ) { + fail(`the private root must pin npm@${REVIEWED_NPM_VERSION}`); + } + const expectedInventory = RELEASE_PACKAGES.map(({ name }) => name).sort(); + const actualInventory = await publicWorkspaceInventory(root); + if (!sameJson(actualInventory, expectedInventory)) { + fail("public workspace inventory does not match the reviewed release list"); + } + const lockfile = await readJson(join(root, "package-lock.json")); + const packages = []; + for (const definition of RELEASE_PACKAGES) { + packages.push(await validatePackage(root, definition, lockfile)); + } + + if (options.requireClean) { + const status = run(gitCommand(), ["status", "--porcelain"], { + cwd: root, + capture: true, + }).stdout; + if (status.trim() !== "") { + fail("release preparation requires a clean checkout"); + } + } + if (options.requireMainAncestor) { + const head = run(gitCommand(), ["rev-parse", "HEAD"], { + cwd: root, + capture: true, + }).stdout.trim(); + const onMain = run( + gitCommand(), + ["merge-base", "--is-ancestor", head, "refs/remotes/origin/main"], + { cwd: root, capture: true, allowFailure: true }, + ); + if (onMain.status !== 0) { + fail("release commit must be contained in origin/main"); + } + } + + const releaseTag = options.releaseTag ?? process.env.RELEASE_TAG; + if (releaseTag !== undefined) { + if (!/^v\d+\.\d+\.\d+$/u.test(releaseTag)) { + fail("release tag must be a stable vX.Y.Z tag"); + } + const version = releaseTag.slice(1); + if (!packages.some(({ manifest }) => manifest.version === version)) { + fail( + `release tag ${releaseTag} does not match any public package version`, + ); + } + const prerelease = + options.releasePrerelease ?? process.env.RELEASE_PRERELEASE ?? false; + if (prerelease === true || prerelease === "true") { + fail("prereleases cannot publish packages"); + } + } + if (options.requireReleaseTag) { + validateReleaseTag({ + root, + releaseTag, + expectedReleaseCommit: options.expectedReleaseCommit, + }); + } + return { root, packages, releaseTag }; +} + +function verifyPackedFiles(manifest, files) { + const paths = files.map(({ path }) => path); + for (const required of ["package.json", "README.md", "LICENSE"]) { + if (!paths.includes(required)) { + fail(`${manifest.name} tarball is missing ${required}`); + } + } + if ( + paths.some( + (path) => + !["package.json", "README.md", "LICENSE"].includes(path) && + !path.startsWith("dist/"), + ) + ) { + fail( + `${manifest.name} tarball contains a file outside the reviewed allowlist`, + ); + } + for (const target of exportTargets(manifest.exports)) { + const path = target.replace(/^\.\//u, ""); + if (!paths.includes(path)) { + fail(`${manifest.name} tarball is missing exported file ${path}`); + } + } +} + +async function smokeTestTarballs(root, packageRecords) { + const directory = await mkdtemp(join(tmpdir(), "pegma-release-smoke-")); + try { + await writeFile( + join(directory, "package.json"), + '{"name":"pegma-release-smoke","private":true,"type":"module"}\n', + ); + runNpm( + [ + "install", + "--ignore-scripts", + "--no-audit", + "--no-fund", + "--package-lock=false", + ...packageRecords.map(({ tarballPath }) => tarballPath), + ], + { cwd: directory, capture: true }, + ); + for (const { manifest } of packageRecords) { + for (const specifier of exportSpecifiers(manifest)) { + run( + process.execPath, + [ + "--input-type=module", + "--eval", + `await import(${JSON.stringify(specifier)})`, + ], + { cwd: directory, capture: true }, + ); + } + } + } finally { + await rm(directory, { recursive: true, force: true }); + } +} + +function queryRegistryIntegrity(name, version) { + const spec = `${name}@${version}`; + const result = runNpm(["view", spec, "dist.integrity", "--json"], { + capture: true, + allowFailure: true, + }); + if (result.status === 0) { + const integrity = JSON.parse(result.stdout); + if (typeof integrity !== "string" || integrity.length === 0) { + fail(`${spec} exists without dist.integrity`); + } + return integrity; + } + const output = `${result.stdout}\n${result.stderr}`; + if (/\bE404\b/u.test(output)) { + return null; + } + fail(`npm registry lookup failed for ${spec}:\n${output.trim()}`); +} + +export function decidePublication(localIntegrity, registryIntegrity) { + if (registryIntegrity === null) { + return "publish"; + } + if (safeEqual(localIntegrity, registryIntegrity)) { + return "skip"; + } + fail("the registry version exists with different tarball integrity"); +} + +export async function prepareRelease(options = {}) { + const { root, packages, releaseTag } = await validateRepository(options); + for (const { manifest } of packages) { + if (!isNormalReleaseVersion(manifest.version)) { + fail( + `normal releases require version ${FIRST_RELEASE_VERSION} or later (got ${manifest.name}@${manifest.version})`, + ); + } + } + const gitCommit = run(gitCommand(), ["rev-parse", "HEAD"], { + cwd: root, + capture: true, + }).stdout.trim(); + if (!/^[0-9a-f]{40,64}$/u.test(gitCommit)) { + fail(`git returned an invalid commit SHA: ${gitCommit}`); + } + const output = resolve(root, options.output ?? ".release"); + await mkdir(output, { recursive: true }); + if ((await readdir(output)).length !== 0) { + fail(`release output directory must be empty: ${output}`); + } + + runNpm(["run", "build"], { cwd: root }); + const records = []; + const tagVersion = releaseTag?.slice(1); + for (const { definition, manifest } of packages) { + const result = runNpm( + [ + "pack", + join(root, "packages", definition.directory), + "--json", + "--pack-destination", + output, + ], + { cwd: root, capture: true }, + ); + const [packed] = JSON.parse(result.stdout); + if ( + packed?.name !== definition.name || + packed?.version !== manifest.version || + typeof packed.filename !== "string" || + !Array.isArray(packed.files) + ) { + fail(`npm pack returned invalid metadata for ${definition.name}`); + } + verifyPackedFiles(manifest, packed.files); + const tarballPath = join(output, basename(packed.filename)); + const hashes = hashTarball(await readFile(tarballPath)); + if ( + !safeEqual(hashes.integrity, packed.integrity) || + !safeEqual(hashes.shasum, packed.shasum) + ) { + fail(`${definition.name} tarball hashes do not match npm pack metadata`); + } + records.push({ + name: definition.name, + version: manifest.version, + directory: definition.directory, + tarball: basename(tarballPath), + tarballPath, + integrity: hashes.integrity, + shasum: hashes.shasum, + publish: tagVersion === undefined || manifest.version === tagVersion, + files: packed.files + .map(({ path, size }) => ({ path, size })) + .sort((left, right) => left.path.localeCompare(right.path)), + manifest, + }); + } + await smokeTestTarballs(root, records); + + if (releaseTag !== undefined) { + for (const record of records.filter(({ publish }) => !publish)) { + const registryIntegrity = queryRegistryIntegrity( + record.name, + record.version, + ); + if ( + registryIntegrity === null || + !safeEqual(record.integrity, registryIntegrity) + ) { + fail( + `${record.name}@${record.version} is not selected by ${releaseTag} and must exactly match npm`, + ); + } + } + } + + const manifest = { + schemaVersion: 1, + gitCommit, + releaseTag: releaseTag ?? null, + packages: records.map( + ({ tarballPath, manifest: _manifest, ...record }) => record, + ), + }; + const manifestPath = join(output, "package-manifest.json"); + await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`); + return { manifestPath, manifest }; +} + +async function verifyPreparedManifest(manifestPath) { + const manifest = await readJson(manifestPath); + if ( + manifest.schemaVersion !== 1 || + !/^[0-9a-f]{40,64}$/u.test(manifest.gitCommit) || + !/^v\d+\.\d+\.\d+$/u.test(manifest.releaseTag) || + !Array.isArray(manifest.packages) || + !sameJson( + manifest.packages.map(({ name }) => name), + RELEASE_PACKAGES.map(({ name }) => name), + ) + ) { + fail("prepared package manifest has an invalid package inventory"); + } + const currentCommit = run(gitCommand(), ["rev-parse", "HEAD"], { + cwd: defaultRoot(), + capture: true, + }).stdout.trim(); + if (!safeEqual(currentCommit, manifest.gitCommit)) { + fail("prepared package manifest commit does not match the checkout"); + } + const tagVersion = manifest.releaseTag.slice(1); + if (!manifest.packages.some(({ publish }) => publish)) { + fail("prepared package manifest has no release candidates"); + } + for (const [index, record] of manifest.packages.entries()) { + const definition = RELEASE_PACKAGES[index]; + const expectedTarball = `${definition.name + .slice(1) + .replace("/", "-")}-${record.version}.tgz`; + if ( + record.directory !== definition.directory || + record.tarball !== expectedTarball || + !STABLE_SEMVER.test(record.version) || + record.publish !== (record.version === tagVersion) || + typeof record.integrity !== "string" || + typeof record.shasum !== "string" || + !Array.isArray(record.files) + ) { + fail(`${record.name} has invalid prepared metadata`); + } + const tarball = resolve(dirname(manifestPath), record.tarball); + if (dirname(tarball) !== resolve(dirname(manifestPath))) { + fail(`${record.name} tarball must be beside the package manifest`); + } + const hashes = hashTarball(await readFile(tarball)); + if ( + !safeEqual(hashes.integrity, record.integrity) || + !safeEqual(hashes.shasum, record.shasum) + ) { + fail(`${record.name} prepared tarball has changed`); + } + } + return manifest; +} + +function requireTrustedPublishingNpm() { + const version = runNpm(["--version"], { capture: true }).stdout.trim(); + const match = /^(\d+)\.(\d+)\.(\d+)(?:-.+)?$/u.exec(version); + if (match === null) { + fail(`could not parse npm version ${version}`); + } + const [, majorText, minorText, patchText] = match; + const [major, minor, patch] = [majorText, minorText, patchText].map(Number); + if ( + major < 11 || + (major === 11 && minor < 5) || + (major === 11 && minor === 5 && patch < 1) + ) { + fail("trusted publishing requires npm 11.5.1 or newer"); + } +} + +function wait(milliseconds) { + Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds); +} + +function confirmRegistryIntegrity(record) { + for (let attempt = 0; attempt < 6; attempt += 1) { + const integrity = queryRegistryIntegrity(record.name, record.version); + if (integrity !== null && safeEqual(record.integrity, integrity)) { + return; + } + if (attempt < 5) { + wait(2 ** attempt * 1000); + } + } + fail( + `${record.name}@${record.version} did not become visible with the prepared integrity`, + ); +} + +export async function publishPreparedRelease(options = {}) { + if ( + process.env.GITHUB_ACTIONS !== "true" || + process.env.GITHUB_EVENT_NAME !== "release" + ) { + fail("release:publish is restricted to a GitHub release workflow"); + } + requireTrustedPublishingNpm(); + const manifestPath = resolve( + options.manifest ?? ".release/package-manifest.json", + ); + const manifest = await verifyPreparedManifest(manifestPath); + const releaseTag = options.releaseTag ?? process.env.RELEASE_TAG; + const expectedReleaseCommit = + options.expectedReleaseCommit ?? process.env.RELEASE_COMMIT; + if (releaseTag !== manifest.releaseTag) { + fail("prepared manifest must match the release tag"); + } + if ( + expectedReleaseCommit === undefined || + !/^[0-9a-f]{40,64}$/u.test(expectedReleaseCommit) || + !safeEqual(manifest.gitCommit, expectedReleaseCommit) + ) { + fail("prepared package manifest must match the release event commit"); + } + for (const record of manifest.packages.filter(({ publish }) => publish)) { + const registryIntegrity = queryRegistryIntegrity( + record.name, + record.version, + ); + const decision = decidePublication(record.integrity, registryIntegrity); + if (decision === "skip") { + process.stdout.write( + `Verified existing ${record.name}@${record.version}; skipping.\n`, + ); + continue; + } + const tarball = resolve(dirname(manifestPath), record.tarball); + runNpm(["publish", tarball, "--access", "public", "--provenance"], { + cwd: dirname(manifestPath), + }); + confirmRegistryIntegrity(record); + } +} + +export function parseArguments(arguments_) { + const options = {}; + for (let index = 0; index < arguments_.length; index += 1) { + const argument = arguments_[index]; + if (argument === "--") { + continue; + } + if (argument === "--require-main-ancestor") { + options.requireMainAncestor = true; + continue; + } + if (argument === "--require-clean") { + options.requireClean = true; + continue; + } + if (argument === "--require-release-tag") { + options.requireReleaseTag = true; + continue; + } + const key = + argument === "--root" + ? "root" + : argument === "--output" + ? "output" + : argument === "--manifest" + ? "manifest" + : argument === "--expected-release-commit" + ? "expectedReleaseCommit" + : null; + if (key === null || arguments_[index + 1] === undefined) { + fail(`unknown or incomplete argument: ${argument}`); + } + options[key] = arguments_[index + 1]; + index += 1; + } + return options; +} + +function defaultRoot() { + return resolve(dirname(fileURLToPath(import.meta.url)), ".."); +} + +async function main() { + const [command, ...arguments_] = process.argv.slice(2); + const options = parseArguments(arguments_); + if (command === "check") { + await validateRepository(options); + process.stdout.write("Release metadata is valid.\n"); + return; + } + if (command === "pack") { + const { manifestPath } = await prepareRelease(options); + process.stdout.write(`Prepared release packages at ${manifestPath}.\n`); + return; + } + if (command === "publish") { + await publishPreparedRelease(options); + return; + } + fail("usage: release-packages.mjs [options]"); +} + +const isMain = + process.argv[1] !== undefined && + resolve(process.argv[1]) === fileURLToPath(import.meta.url); +if (isMain) { + await main(); +} diff --git a/tests/release-packages.test.ts b/tests/release-packages.test.ts new file mode 100644 index 0000000..e978f67 --- /dev/null +++ b/tests/release-packages.test.ts @@ -0,0 +1,60 @@ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; +import { describe, expect, it } from "vitest"; + +import { + RELEASE_PACKAGES, + decidePublication, + isNormalReleaseVersion, + parseArguments, +} from "../scripts/release-packages.mjs"; + +describe("release package metadata", () => { + it("accepts npm's cross-platform argument separator", () => { + expect(parseArguments(["--", "--output", ".release"])).toEqual({ + output: ".release", + }); + }); + + it("keeps the exact public package inventory in dependency order", () => { + expect(RELEASE_PACKAGES.map(({ name }) => name)).toEqual([ + "@pegma/scheduler", + "@pegma/scheduler-cloudflare", + ]); + }); + + it("ships the synchronized 0.1.0 package set with exact internal pins", () => { + const manifests = RELEASE_PACKAGES.map(({ directory }) => + JSON.parse( + readFileSync( + join(process.cwd(), "packages", directory, "package.json"), + "utf8", + ), + ), + ) as Array<{ + name: string; + version: string; + dependencies?: Record; + }>; + + expect(manifests.map(({ name, version }) => ({ name, version }))).toEqual([ + { name: "@pegma/scheduler", version: "0.1.0" }, + { name: "@pegma/scheduler-cloudflare", version: "0.1.0" }, + ]); + expect(manifests[1]?.dependencies?.["@pegma/scheduler"]).toBe("0.1.0"); + }); + + it("rejects the bootstrap range from the normal release lane", () => { + expect(isNormalReleaseVersion("0.0.0")).toBe(false); + expect(isNormalReleaseVersion("0.0.1")).toBe(false); + expect(isNormalReleaseVersion("0.1.0")).toBe(true); + expect(isNormalReleaseVersion("1.0.0")).toBe(true); + }); + + it("skips a byte-identical existing version", () => { + const integrity = + "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; + expect(decidePublication(integrity, integrity)).toBe("skip"); + expect(decidePublication(integrity, null)).toBe("publish"); + }); +}); diff --git a/tsconfig.test.json b/tsconfig.test.json index 4208d24..c4bafbd 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -11,7 +11,9 @@ "include": [ "packages/*/src/**/*.test.ts", "fixtures/**/*.ts", + "tests/**/*.ts", "test/**/*.ts", + "scripts/**/*.mjs", "vitest.config.ts", "vitest.d1.config.ts" ], diff --git a/vitest.config.ts b/vitest.config.ts index 2076d0b..920ef67 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,7 +2,11 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - include: ["packages/**/*.test.ts", "fixtures/**/*.test.ts"], + include: [ + "packages/**/*.test.ts", + "fixtures/**/*.test.ts", + "tests/**/*.test.ts", + ], exclude: ["**/dist/**", "**/node_modules/**", "**/*.d1.test.ts"], globalSetup: ["./test/azurite.ts"], testTimeout: 30_000, From 50f166cec4c0ef1f6aa1837c4be434b3db41debb Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Fri, 31 Jul 2026 19:18:41 -0400 Subject: [PATCH 2/2] Address review: guard missing lock entries and typecheck release .d.mts. Make lockfile absence a clear validation failure, and include scripts/**/*.d.mts in the test TypeScript project. --- scripts/release-packages.mjs | 7 ++++++- tsconfig.test.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/release-packages.mjs b/scripts/release-packages.mjs index 7b19c13..5e7a148 100644 --- a/scripts/release-packages.mjs +++ b/scripts/release-packages.mjs @@ -182,7 +182,12 @@ async function validatePackage(root, definition, lockfile) { await stat(join(packageDirectory, "LICENSE")); const lockEntry = lockfile.packages?.[`packages/${definition.directory}`]; - if (lockEntry?.version !== manifest.version) { + if (lockEntry === undefined || typeof lockEntry !== "object") { + fail( + `${definition.name} is missing from package-lock.json workspace inventory`, + ); + } + if (lockEntry.version !== manifest.version) { fail( `${definition.name} version is not synchronized with package-lock.json`, ); diff --git a/tsconfig.test.json b/tsconfig.test.json index c4bafbd..e91f5d6 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -14,6 +14,7 @@ "tests/**/*.ts", "test/**/*.ts", "scripts/**/*.mjs", + "scripts/**/*.d.mts", "vitest.config.ts", "vitest.d1.config.ts" ],