diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66d5097..bee842d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,8 +70,13 @@ jobs: with: node-version: '20' + - name: Clean Deno cache + run: deno cache --reload mod.ts cli.ts + - name: Build npm package run: deno task build:npm + env: + PUPPETEER_SKIP_DOWNLOAD: 'true' - name: Verify npm package structure run: | diff --git a/deno.json b/deno.json index 5e2c6f1..778f447 100644 --- a/deno.json +++ b/deno.json @@ -14,7 +14,7 @@ }, "lint": { "rules": { "exclude": ["no-explicit-any"] } }, "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.3", + "@deno/dnt": "jsr:@deno/dnt@^0.42.3", "@std/fs": "jsr:@std/fs@^1", "@std/path": "jsr:@std/path@^1", "handlebars": "npm:handlebars@^4.7.8" diff --git a/package.json.template b/package.json.template index e6dc2a6..9282717 100644 --- a/package.json.template +++ b/package.json.template @@ -8,5 +8,12 @@ "bin": { "statedoc": "./esm/cli.js" }, "exports": { ".": "./mod.js" }, "engines": { "node": ">=18" }, + "dependencies": { + "fast-glob": "^3.3.2", + "handlebars": "^4.7.8" + }, + "devDependencies": { + "@types/node": "^20.17.13" + }, "peerDependencies": { "@mermaid-js/mermaid-cli": ">=10.9.0" } } diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index f55b2c1..ac3e330 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -1,10 +1,9 @@ import { build, emptyDir } from "@deno/dnt"; -// Note: Using @deno/dnt@^0.41.3 instead of 0.42.3 due to WASM panic issue -// in dnt's Reflect.get (wasm/src/lib.rs line 56). Version 0.42.3 attempts -// to use Reflect.get on a non-object value, causing a panic. Revert to 0.41.3 -// until the issue is fixed upstream. +// Updated to @deno/dnt@^0.42.3 to fix @types/node version resolution issue. +// Previous version 0.41.3 attempted to use @types/node@24.2.0 which doesn't +// exist in the npm registry, causing build failures. await emptyDir("./npm"); @@ -20,6 +19,12 @@ try { compilerOptions: { lib: ["ES2022", "DOM"] }, typeCheck: false, // Skip type checking to avoid shim limitations test: false, // Skip tests to avoid test runner issues + packageManager: "npm", + skipNpmInstall: false, // We need npm install to verify dependencies work + scriptModule: false, + postBuild() { + // No additional post-build steps needed + }, }); console.log("Built to npm/"); } catch (error) {