cultnet-ts 0.4.0 release notes; npm publish gate runs the declared-range check; fixture builds like cultnet-ts
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 26m28s

cultnet-ts's Unreleased section becomes [0.4.0]; cultmesh-ts and cultmesh-browser record the move to cultnet-ts ^0.4.0. release-after-suite builds the workspace and runs the range check for an npm tag release, before the package's tests. The fixture package generates a module from repo-level contracts/, so a tag built by a bare tsc or archived without contracts/ fails it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-12 20:54:58 +00:00
commit 4fb07ab3bb
6 changed files with 35 additions and 12 deletions

View file

@ -1,6 +1,8 @@
// test-declared-dependency-ranges.mjs against a fixture repo: a dependency that gained an export a dependent imports,
// while its manifest still carries the version of its latest release tag, must fail the check, because a consumer's
// range admits that tagged release and it lacks the export. Bumping the version and the range makes it pass.
// The fixture package a builds like cultnet-ts: its build script first generates a module from the repo-level contracts/
// directory, so a tag built by a bare tsc, or archived without contracts/, fails here as it does on the real tree.
import assert from "node:assert/strict";
import { execFileSync, spawnSync } from "node:child_process";
import { copyFileSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
@ -17,17 +19,22 @@ const write = (root, path, text) => {
writeFileSync(join(root, path), text);
};
const git = (root, ...args) => execFileSync("git", ["-c", "user.name=t", "-c", "user.email=t@t", ...args], { cwd: root, stdio: "pipe" });
const manifest = (name, version, extra = {}) =>
JSON.stringify({ name: `@t/${name}`, version, scripts: { build: "node ../../node_modules/typescript/bin/tsc -p tsconfig.json" }, ...extra });
const tsc = "node ../../node_modules/typescript/bin/tsc -p tsconfig.json";
const manifest = (name, version, extra = {}, build = tsc) =>
JSON.stringify({ name: `@t/${name}`, version, scripts: { build }, ...extra });
const generated = "node tools/generate.mjs && " + tsc;
const tsconfig = JSON.stringify({ compilerOptions: { outDir: "dist", module: "commonjs", target: "es2020", declaration: false }, include: ["src"] });
function fixture() {
const root = mkdtempSync(join(tmpdir(), "declared-ranges-fixture-"));
write(root, "package.json", JSON.stringify({ name: "fixture", private: true, workspaces: ["packages/a", "packages/b"] }));
write(root, "contracts/.keep", "");
write(root, "packages/a/package.json", manifest("a", "1.0.0"));
write(root, "contracts/value.json", "2");
write(root, "packages/a/tools/generate.mjs",
'import { readFileSync, writeFileSync } from "node:fs";\n' +
'writeFileSync("src/data.ts", `export const contractValue = ${readFileSync("../../contracts/value.json", "utf8")};\\n`);\n');
write(root, "packages/a/package.json", manifest("a", "1.0.0", {}, generated));
write(root, "packages/a/tsconfig.json", tsconfig);
write(root, "packages/a/src/index.ts", "export const foo = 1;\n");
write(root, "packages/a/src/index.ts", 'export { contractValue } from "./data";\nexport const foo = 1;\n');
write(root, "packages/b/package.json", manifest("b", "1.0.0", { dependencies: { "@t/a": "^1.0.0" } }));
write(root, "packages/b/tsconfig.json", tsconfig);
write(root, "packages/b/src/index.ts", 'import { foo } from "@t/a";\nexport const b = foo;\n');
@ -48,13 +55,13 @@ test("a dependency that gained an export a dependent imports, still at its lates
try {
assert.equal(check(root).status, 0, "the fixture passes before the export is added");
write(root, "packages/a/src/index.ts", "export const foo = 1;\nexport const bar = 2;\n");
write(root, "packages/a/src/index.ts", 'export { contractValue } from "./data";\nexport const foo = 1;\nexport const bar = 2;\n');
write(root, "packages/b/src/index.ts", 'import { foo, bar } from "@t/a";\nexport const b = foo + bar;\n');
const stale = check(root);
assert.notEqual(stale.status, 0, stale.stdout);
assert.match(stale.stderr, /a-v1\.0\.0 does not export bar/u);
write(root, "packages/a/package.json", manifest("a", "1.1.0"));
write(root, "packages/a/package.json", manifest("a", "1.1.0", {}, generated));
write(root, "packages/b/package.json", manifest("b", "1.0.0", { dependencies: { "@t/a": "^1.1.0" } }));
const bumped = check(root);
assert.equal(bumped.status, 0, bumped.stderr);