From 93ec209f7b4bb3c578ee0bebbd038a3515e58fbc Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 28 Aug 2026 08:31:38 +0200 Subject: [PATCH] feat(cli): publish TypeScript declarations tsc now emits declaration files, and package.json points at them. The compiled test and mock files are excluded from the tarball, so they are still typechecked on every build but no longer published. --- .changeset/olive-pugs-invite.md | 5 +++++ packages/cli/package.json | 7 +++++-- packages/cli/tsconfig.json | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/olive-pugs-invite.md diff --git a/.changeset/olive-pugs-invite.md b/.changeset/olive-pugs-invite.md new file mode 100644 index 0000000..1c055dd --- /dev/null +++ b/.changeset/olive-pugs-invite.md @@ -0,0 +1,5 @@ +--- +"@swc/cli": patch +--- + +Publish TypeScript declarations, and keep compiled test and mock files out of the package diff --git a/packages/cli/package.json b/packages/cli/package.json index a6e5ff3..e3dbfaa 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,6 +3,7 @@ "version": "0.8.1", "description": "CLI for the swc project", "main": "lib/swc/index.js", + "types": "lib/swc/index.d.ts", "scripts": { "prepublishOnly": "pnpm build", "types": "tsc", @@ -81,6 +82,8 @@ }, "files": [ "bin", - "lib" + "lib", + "!lib/**/__tests__", + "!lib/**/__mocks__" ] -} \ No newline at end of file +} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 9979547..70245a1 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -10,6 +10,7 @@ "noFallthroughCasesInSwitch": true, "esModuleInterop": true, "lib": ["ES2019.Array", "ES2020.Promise", "ES2015"], + "declaration": true, "outDir": "./lib" }, "include": ["src"]