From d24bf4ab60abe052e64150259f5147b377c0ab37 Mon Sep 17 00:00:00 2001 From: Harold Martin Date: Fri, 15 May 2026 11:30:17 -0700 Subject: [PATCH] fix: publish dual esm cjs package --- .attw.json | 3 +-- README.md | 2 +- package.json | 13 ++++++++----- tsdown.config.ts | 7 +++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.attw.json b/.attw.json index 719eef8..25cd95e 100644 --- a/.attw.json +++ b/.attw.json @@ -1,4 +1,3 @@ { - "profile": "node16", - "ignoreRules": ["cjs-resolves-to-esm"] + "profile": "node16" } diff --git a/README.md b/README.md index 567763f..94ed1e0 100644 --- a/README.md +++ b/README.md @@ -1074,7 +1074,7 @@ const { data: webhooks } = await getV2Webhooks({ client }); - **[Hey API](https://heyapi.dev/)**: OpenAPI client and Zod schema generation - **Biome**: lint and format with a single tool - **Vitest**: fast tests with coverage and thresholds -- **tsdown**: ESM builds for Node +- **tsdown**: dual ESM/CJS builds for Node - **CI**: lint, typecheck, test, coverage, and size comments/badges - **Deno-friendly**: `.ts` source imports for direct consumption - **OIDC + Provenance**: publish to npm and JSR via manual CI release diff --git a/package.json b/package.json index c8d451c..20c7ae3 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,12 @@ "type": "module", "exports": { ".": { - "types": "./dist/index.d.mts", - "import": "./dist/index.mjs" - } + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + }, + "./package.json": "./package.json" }, - "types": "./dist/index.d.mts", + "types": "./dist/index.d.cts", "sideEffects": false, "files": [ "dist" @@ -113,5 +114,7 @@ "**/*.yml" ], "absolute": false - } + }, + "main": "./dist/index.cjs", + "module": "./dist/index.mjs" } diff --git a/tsdown.config.ts b/tsdown.config.ts index 8f3c60a..8d04168 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -2,7 +2,14 @@ import { defineConfig } from "tsdown"; export default defineConfig({ entry: { index: "./src/index.ts" }, + format: ["esm", "cjs"], platform: "node", dts: true, sourcemap: true, + exports: true, + publint: true, + attw: { + profile: "node16", + level: "error", + }, });