Skip to content

Commit b02e94a

Browse files
committed
refactor: migrate to tsdown bundler and ESM
- Replace tsc with tsdown for production builds, bundle all deps into self-contained output (no node_modules needed in prod) - Convert to ESM ("type": "module") - Replace @fastify/autoload with static plugin/route registration - Replace dynamic require() module loader with static imports - Remove @fastify/one-line-logger transport (incompatible with bundling) - Remove unused deps: @fastify/autoload, fastify-cli, tsconfig-paths, etc. - Rename .eslintrc.js/.prettierrc.js to .cjs for ESM compat - Bump engines to node>=22
1 parent 94638a7 commit b02e94a

8 files changed

Lines changed: 556 additions & 570 deletions

File tree

File renamed without changes.
File renamed without changes.

package.json

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
{
2+
"type": "module",
23
"license": "MIT",
34
"scripts": {
4-
"build": "tsc",
5-
"build:ts": "tsc",
5+
"build": "tsdown",
66
"dev": "npm run dev:watch",
77
"dev:watch": "NODE_ENV=development tsx watch src/server.ts",
88
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
99
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
1010
"prepare": "husky install",
1111
"start": "tsx src/server.ts",
12-
"start:prod": "NODE_ENV=production TS_NODE_BASEURL=./dist node -r tsconfig-paths/register ./dist/src/server.js",
13-
"typecheck": "tsc -b"
12+
"start:prod": "NODE_ENV=production node dist/server.mjs",
13+
"typecheck": "tsc --noEmit"
1414
},
1515
"lint-staged": {
1616
"*.{js,ts}": "eslint --cache --fix",
1717
"*.{js,ts,css,md}": "prettier --write"
1818
},
1919
"dependencies": {
20-
"@fastify/autoload": "5.10.0",
2120
"@fastify/cors": "8.5.0",
2221
"@fastify/env": "4.4.0",
2322
"@fastify/etag": "4.2.0",
2423
"@fastify/helmet": "11.1.1",
2524
"@fastify/multipart": "7.7.3",
26-
"@fastify/one-line-logger": "1.4.0",
2725
"@fastify/rate-limit": "8.1.1",
2826
"@fastify/sensible": "5.6.0",
2927
"@innei/next-async": "0.4.0",
@@ -32,15 +30,12 @@
3230
"@tanstack/query-core": "4.41.0",
3331
"axios": "1.13.6",
3432
"chalk": "4.1.2",
35-
"close-with-grace": "1.3.0",
3633
"consola": "2.15.3",
3734
"cron": "2.4.4",
3835
"dayjs": "1.11.19",
3936
"dotenv": "16.6.1",
4037
"fastify": "4.29.1",
41-
"fastify-cli": "5.9.0",
4238
"fastify-plugin": "4.5.1",
43-
"fastify-tsconfig": "1.0.1",
4439
"git-webhook-handler": "link:packages/git-webhook-handler",
4540
"husky": "8.0.3",
4641
"lodash": "4.17.23",
@@ -49,7 +44,6 @@
4944
"remove-markdown": "0.6.3",
5045
"socket.io-client": "4.8.3",
5146
"telegraf": "4.16.3",
52-
"tsconfig-paths": "4.2.0",
5347
"zod": "3.25.76"
5448
},
5549
"devDependencies": {
@@ -65,28 +59,15 @@
6559
"cross-env": "7.0.3",
6660
"eslint": "8.57.1",
6761
"fast-json-stringify": "5.16.1",
62+
"fastify-tsconfig": "1.0.1",
6863
"lint-staged": "13.3.0",
6964
"prettier": "3.8.1",
70-
"ts-node": "10.9.2",
65+
"tsdown": "0.12.4",
7166
"tsx": "3.14.0",
7267
"typescript": "5.9.3"
7368
},
7469
"engines": {
75-
"node": ">=16.20.0"
76-
},
77-
"tsup": {
78-
"entry": [
79-
"src/**/*.ts"
80-
],
81-
"splitting": false,
82-
"sourcemap": true,
83-
"clean": true,
84-
"format": [
85-
"cjs",
86-
"esm"
87-
],
88-
"legacyOutput": true,
89-
"target": "es2018"
70+
"node": ">=22"
9071
},
9172
"packageManager": "pnpm@9.15.9"
9273
}

0 commit comments

Comments
 (0)