Skip to content

Commit ced0d5c

Browse files
committed
Update tsdown to 0.21.0 and refactor build script for SEA binary
1 parent 764b8c0 commit ced0d5c

5 files changed

Lines changed: 37 additions & 75 deletions

File tree

.changeset/cli-tsdown-sea.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@neaps/cli": patch
3+
---
4+
5+
Migrate SEA (Single Executable Application) build from a custom esbuild script to tsdown's built-in `exe` option. Removes the `esbuild` dev dependency.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"make-fetch-happen": "^15.0.3",
2626
"npm-run-all": "^4.1.5",
2727
"prettier": "^3.7.4",
28-
"tsdown": "^0.20.1",
28+
"tsdown": "^0.21.0",
2929
"typescript": "^5.3.3",
3030
"typescript-eslint": "^8.56.0",
3131
"vitest": "^4.0.15"

packages/cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
],
3535
"scripts": {
3636
"build": "tsdown",
37-
"build:sea": "node scripts/build-sea.ts",
37+
"build:sea": "tsdown --config tsdown.sea.config.ts",
3838
"prepack": "npm run build",
3939
"test": "vitest"
4040
},
@@ -48,7 +48,6 @@
4848
},
4949
"devDependencies": {
5050
"@types/node": "^25.0.2",
51-
"esbuild": "^0.27.3",
5251
"nock": "^14.0.11"
5352
}
5453
}

packages/cli/scripts/build-sea.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

packages/cli/tsdown.sea.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { execFileSync } from "node:child_process";
2+
import { resolve } from "node:path";
3+
import { defineConfig } from "tsdown";
4+
5+
export default defineConfig({
6+
entry: ["./src/index.ts"],
7+
platform: "node",
8+
exe: {
9+
fileName: "neaps",
10+
seaConfig: {
11+
disableExperimentalSEAWarning: true,
12+
},
13+
},
14+
onSuccess: (config) => {
15+
// Re-sign with the stable identifier for reproducible builds.
16+
// tsdown performs an initial ad-hoc sign (defaulting to the binary
17+
// name as the identifier); this overwrites it with the canonical one.
18+
if (process.platform === "darwin") {
19+
const outputPath = resolve(config.outDir, "neaps");
20+
execFileSync("codesign", [
21+
"--sign",
22+
"-",
23+
"--identifier",
24+
"io.openwaters.neaps",
25+
"--force",
26+
outputPath,
27+
]);
28+
}
29+
},
30+
});

0 commit comments

Comments
 (0)