Skip to content

Commit f1853cd

Browse files
committed
refactor(cli): use h3/srvx for internal server
1 parent 6515a29 commit f1853cd

6 files changed

Lines changed: 609 additions & 648 deletions

File tree

cli/build.config.ts

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

cli/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"exports": {
1111
".": {
1212
"import": "./dist/index.mjs",
13-
"types": "./dist/index.d.ts"
13+
"types": "./dist/index.d.mts"
1414
}
1515
},
1616
"files": [
1717
"dist"
1818
],
1919
"scripts": {
20-
"build": "unbuild",
20+
"build": "tsdown",
2121
"dev": "node --experimental-strip-types src/cli.ts",
2222
"test:types": "tsc --noEmit"
2323
},
@@ -26,16 +26,16 @@
2626
"citty": "^0.2.0",
2727
"consola": "^3.4.2",
2828
"defu": "^6.1.4",
29-
"h3": "^1.15.5",
30-
"listhen": "^1.9.0",
29+
"h3": "^2.0.1-rc.11",
3130
"ofetch": "^1.5.1",
3231
"picocolors": "^1.1.1",
32+
"srvx": "^0.10.1",
3333
"validate-npm-package-name": "^7.0.2"
3434
},
3535
"devDependencies": {
3636
"@types/node": "^24.10.9",
3737
"@types/validate-npm-package-name": "^4.0.2",
38-
"typescript": "^5.9.3",
39-
"unbuild": "^3.6.1"
38+
"tsdown": "^0.20.1",
39+
"typescript": "^5.9.3"
4040
}
4141
}

cli/src/cli.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { spawn } from 'node:child_process'
44
import * as p from '@clack/prompts'
55
import pc from 'picocolors'
66
import { defineCommand, runMain } from 'citty'
7-
import { listen } from 'listhen'
8-
import { toNodeListener } from 'h3'
7+
import { serve } from 'srvx'
98
import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts'
109
import { getNpmUser } from './npm-client.ts'
1110
import { initLogger, showToken, logInfo, logWarning, logError } from './logger.ts'
@@ -95,12 +94,14 @@ const main = defineCommand({
9594

9695
const app = createConnectorApp(token)
9796

98-
await listen(toNodeListener(app), {
97+
const server = serve({
9998
port,
10099
hostname: '127.0.0.1',
101-
showURL: false,
100+
fetch: app.fetch,
102101
})
103102

103+
await server.ready()
104+
104105
logInfo('Waiting for connection... (Press Ctrl+C to stop)')
105106
},
106107
})

0 commit comments

Comments
 (0)