From 1c56f55a9dbb0a7856649982f1d5abd4543b99ad Mon Sep 17 00:00:00 2001 From: Taras Mankovski <74687+taras@users.noreply.github.com> Date: Sat, 18 Jul 2026 20:22:07 -0400 Subject: [PATCH] fix(publish): keep manifest fields in the isolated build's deno.json The dnt isolation step replaced the package copy's deno.json with a bare import map, so cli/src/cli.ts's JSON import of ../deno.json lost its version property and the cli@0.3.0 publish failed type checking (TS2339). The isolated deno.json now carries name/version/exports alongside the rewritten imports. Verified: cli builds with full type check against the published 0.3.0 siblings, and the built bin reports 0.3.0 under Node. --- scripts/build-npm.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/build-npm.ts b/scripts/build-npm.ts index 3012dcb..efee684 100644 --- a/scripts/build-npm.ts +++ b/scripts/build-npm.ts @@ -165,9 +165,21 @@ await main(function* (args) { isolatedImports[name] = `npm:${name}@^${siblingVer}`; isolatedImports[`${name}/`] = `npm:${name}@^${siblingVer}/`; } + // Preserve the manifest fields alongside the rewritten imports: cli/src/cli.ts + // imports its own deno.json for `version`, so replacing the copy with a bare + // import map makes that property vanish from the JSON module's type. yield* writeTextFile( join(srcCopy, "deno.json"), - JSON.stringify({ imports: isolatedImports }, null, 2), + JSON.stringify( + { + name: denoJson.name, + version: denoJson.version, + exports: denoJson.exports, + imports: isolatedImports, + }, + null, + 2, + ), ); try {