chore: harden release checks and package coverage
This commit is contained in:
@@ -19,7 +19,15 @@ function sha256(value) {
|
||||
}
|
||||
|
||||
function loadTypeScript() {
|
||||
const candidates = [process.env.TYPESCRIPT_PATH, "typescript"].filter(Boolean);
|
||||
// TypeScript 7's root package is the native CLI and no longer exposes the
|
||||
// legacy compiler API used by the embedded editor compiler. Keep that API
|
||||
// isolated behind @wrnexus/typecheck's explicit TypeScript 6 dependency
|
||||
// while the workspace itself type-checks with TypeScript 7.
|
||||
const candidates = [
|
||||
process.env.TYPESCRIPT_PATH,
|
||||
join(root, "packages", "typecheck", "node_modules", "typescript"),
|
||||
"typescript",
|
||||
].filter(Boolean);
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
return require(candidate);
|
||||
|
||||
@@ -2,10 +2,15 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
||||
import console from "node:console";
|
||||
import { dirname, join, relative, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createRequire } from "node:module";
|
||||
import process from "node:process";
|
||||
import ts from "typescript";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const require = createRequire(import.meta.url);
|
||||
// TypeScript 7's root package is the native CLI and no longer exposes the
|
||||
// legacy compiler API. Public API extraction intentionally uses the compiler
|
||||
// version embedded by @wrnexus/typecheck.
|
||||
const ts = require(join(root, "packages", "typecheck", "node_modules", "typescript"));
|
||||
const baselinePath = join(root, "docs", "public-api-0.8.json");
|
||||
|
||||
function flattenTargets(value) {
|
||||
|
||||
@@ -118,26 +118,34 @@ try {
|
||||
throw new Error(`Staged package import probe failed:\n${probe.stderr || probe.stdout}`);
|
||||
if (probe.stdout) process.stdout.write(probe.stdout);
|
||||
|
||||
writeFileSync(
|
||||
join(consumer, "browser-probe.js"),
|
||||
'import "@wrnexus/csr";\nimport "@wrnexus/reactive";\n',
|
||||
const browserPackages = ["@wrnexus/csr", "@wrnexus/reactive"].filter((name) =>
|
||||
existsSync(join(consumer, "node_modules", ...name.split("/"))),
|
||||
);
|
||||
const browser = spawnSync(
|
||||
bun,
|
||||
["build", "browser-probe.js", "--target=browser", "--outfile=browser-probe.bundle.js"],
|
||||
{ cwd: consumer, encoding: "utf8", env: { ...process.env, NO_COLOR: "1" } },
|
||||
);
|
||||
if (browser.status !== 0 || !existsSync(join(consumer, "browser-probe.bundle.js"))) {
|
||||
throw new Error(`Staged browser package build failed:\n${browser.stderr || browser.stdout}`);
|
||||
if (browserPackages.length > 0) {
|
||||
writeFileSync(
|
||||
join(consumer, "browser-probe.js"),
|
||||
browserPackages.map((name) => `import ${JSON.stringify(name)};`).join("\n") + "\n",
|
||||
);
|
||||
const browser = spawnSync(
|
||||
bun,
|
||||
["build", "browser-probe.js", "--target=browser", "--outfile=browser-probe.bundle.js"],
|
||||
{ cwd: consumer, encoding: "utf8", env: { ...process.env, NO_COLOR: "1" } },
|
||||
);
|
||||
if (browser.status !== 0 || !existsSync(join(consumer, "browser-probe.bundle.js"))) {
|
||||
throw new Error(`Staged browser package build failed:\n${browser.stderr || browser.stdout}`);
|
||||
}
|
||||
}
|
||||
|
||||
const cli = spawnSync(
|
||||
bun,
|
||||
[join(consumer, "node_modules", "@wrnexus", "cli", "dist", "index.js"), "--help"],
|
||||
{ cwd: consumer, encoding: "utf8", env: { ...process.env, NO_COLOR: "1" } },
|
||||
);
|
||||
if (cli.status !== 0 || !/wrnexus/i.test(`${cli.stdout}\n${cli.stderr}`)) {
|
||||
throw new Error(`Staged CLI smoke test failed:\n${cli.stderr || cli.stdout}`);
|
||||
const cliPath = join(consumer, "node_modules", "@wrnexus", "cli", "dist", "index.js");
|
||||
if (existsSync(cliPath)) {
|
||||
const cli = spawnSync(bun, [cliPath, "--help"], {
|
||||
cwd: consumer,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, NO_COLOR: "1" },
|
||||
});
|
||||
if (cli.status !== 0 || !/wrnexus/i.test(`${cli.stdout}\n${cli.stderr}`)) {
|
||||
throw new Error(`Staged CLI smoke test failed:\n${cli.stderr || cli.stdout}`);
|
||||
}
|
||||
}
|
||||
console.log(
|
||||
"Staged package tarballs, browser runtime bundle, and CLI passed their isolated consumer smoke tests.",
|
||||
|
||||
Reference in New Issue
Block a user