release: 4.15.0 — media in the publish order, observer and cli fixed, tarballs verified
Some checks failed
Test / test (push) Has been cancelled
Publish / publish (push) Has been cancelled
Cross-platform vectors / Kotlin vectors (gradle) (push) Has been cancelled
Cross-platform vectors / TypeScript vectors (bun) (push) Has been cancelled
Docker build and publish / docker (push) Has been cancelled

@shade/media was missing from both publish lists while server, sdk, cli and
storage-postgres depend on it. @shade/observer built to dist-build and went
out empty; a bin on src/*.ts shipped one file whose imports were not packed.
publish-all.ts now refuses a tarball that lacks any file main, types, bin
or exports name. The [Unreleased] entries are folded into 4.15.0, which had
not been published.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-20 12:18:01 +02:00
parent 579d2730e0
commit 6852e09cb4
6 changed files with 73 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import { $ } from 'bun';
// Order matters: each package only depends on packages above it.
// Mirrors the PACKAGES list in scripts/publish-shade.sh.
const PACKAGES = [
'shade-media',
'shade-core',
'shade-proto',
'shade-crypto-web',
@@ -136,6 +137,11 @@ async function main() {
ensureFilesIncludesDist(pkgJson);
writeFileSync(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}\n`);
// Phase 3 — refuse a tarball that lacks what its package.json points
// at. @shade/observer went out empty for three releases because
// nothing looked inside before publishing.
await verifyTarball(pkgDir, pkgJson);
if (dryRun) {
await $`cd ${pkgDir} && bun pm pack --dry-run`.quiet();
} else {
@@ -204,6 +210,15 @@ function rewriteWorkspaceSpecs(
* forced build pass. Shipping dist-only is a consumer-facing concern.
*/
function rewriteEntryPointsForDist(pkgJson: Record<string, unknown>): void {
// A `bin` left on `src/*.ts` ships one source file whose imports are not
// in the tarball: the command is installed and fails on its first import.
if (typeof pkgJson.bin === 'string') {
pkgJson.bin = toDistJs(pkgJson.bin);
} else if (pkgJson.bin !== null && typeof pkgJson.bin === 'object') {
pkgJson.bin = Object.fromEntries(
Object.entries(pkgJson.bin as Record<string, string>).map(([k, v]) => [k, toDistJs(v)]),
);
}
if (typeof pkgJson.main === 'string') {
pkgJson.main = pkgJson.main.replace(/^src\//, 'dist/').replace(/\.ts$/, '.js');
}
@@ -215,6 +230,35 @@ function rewriteEntryPointsForDist(pkgJson: Record<string, unknown>): void {
}
}
/** Every file `main`, `types`, `bin` and `exports` name, as npm would pack it. */
async function verifyTarball(pkgDir: string, pkgJson: Record<string, unknown>): Promise<void> {
const out = await $`cd ${pkgDir} && npm pack --dry-run --json --ignore-scripts`.quiet().text();
const packed = new Set(
(JSON.parse(out) as { files: { path: string }[] }[])[0]!.files.map((f) => f.path),
);
const wanted = new Set<string>();
const add = (v: unknown) => {
if (typeof v === 'string' && !v.includes('*')) wanted.add(v.replace(/^\.\//, ''));
};
add(pkgJson.main);
add(pkgJson.types);
if (typeof pkgJson.bin === 'string') add(pkgJson.bin);
else if (pkgJson.bin && typeof pkgJson.bin === 'object') Object.values(pkgJson.bin).forEach(add);
const walk = (node: unknown) => {
if (typeof node === 'string') add(node);
else if (node && typeof node === 'object') Object.values(node).forEach(walk);
};
walk(pkgJson.exports);
const missing = [...wanted].filter((f) => !packed.has(f));
if (missing.length > 0) {
throw new Error(`tarball for ${pkgJson.name as string} lacks ${missing.join(', ')}`);
}
}
function toDistJs(path: string): string {
return path.replace(/^(\.\/)?src\//, '$1dist/').replace(/\.ts$/, '.js');
}
function mapExportsForDist(node: unknown, isTypesCondition = false): unknown {
if (typeof node === 'string') {
if (!node.startsWith('./src/')) return node;

View File

@@ -7,6 +7,7 @@ REGISTRY="https://gt.zyon.no"
GITEA_USER="Stian"
PACKAGES=(
media
core
proto
crypto-web