From 950488df12c4e7ce43dfc87bba891eb063dec824 Mon Sep 17 00:00:00 2001 From: takker99 <37929109+takker99@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:26:28 +0900 Subject: [PATCH] feat: Support for Node.js commonjs module --- deno.jsonc | 7 ++++++- scripts/build_npm.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 95efee8..dc07ec7 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -7,7 +7,12 @@ "coverage": "deno test --allow-read=./ --parallel --shuffle --coverage && deno coverage --html", "doc": "deno doc --html rest.ts userscript.ts websocket.ts", "npm:build": "deno run -A scripts/build_npm.ts", - "npm:check": "cd npm && npm publish --provenance --access=public --dry-run" + "npm:check": { + "command": "cd npm && npm publish --provenance --access=public --dry-run", + "dependencies": [ + "npm:build" + ] + } }, "imports": { "@std/testing/types": "jsr:@std/testing@0/types", diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index 0316dbb..ce95941 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -1,3 +1,4 @@ +/// import { build, emptyDir } from "@deno/dnt"; await emptyDir("./npm"); @@ -47,8 +48,7 @@ await build({ }, // Don't run type checking during build to avoid Node.js compatibility issues typeCheck: false, - declaration: "separate", - scriptModule: false, + declaration: "inline", compilerOptions: { lib: ["ESNext", "DOM", "DOM.Iterable"], target: "ES2023",