mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
chore: migrate cli distribution from npm to bun executable
Migrate HAPI CLI from npm-based distribution to Bun single-executable format: - Remove npm bin wrappers (bin/happy.mjs, bin/happy-mcp.mjs) - Simplify package.json: remove npm publish config (exports, main, module, types, files, publishConfig) - Update bin entry to point to TypeScript source (src/index.ts) - Migrate shebang from Node to Bun (#!/usr/bin/env bun) - Simplify build scripts: remove npm-specific steps (pkgroll, prepublishOnly, release-it) - Update spawnHappyCLI to support compiled binaries and development TypeScript mode - Update daemon/doctor diagnostics for new process detection logic - Production: use `bun build --compile` for single-executable releases - Development: run TypeScript directly via `bun src/index.ts` or `tsx src/index.ts`
This commit is contained in:
+5
-60
@@ -13,43 +13,7 @@
|
||||
"directory": "cli"
|
||||
},
|
||||
"bin": {
|
||||
"hapi": "./bin/happy.mjs",
|
||||
"hapi-mcp": "./bin/happy-mcp.mjs"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.cts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
}
|
||||
},
|
||||
"./lib": {
|
||||
"require": {
|
||||
"types": "./dist/lib.d.cts",
|
||||
"default": "./dist/lib.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/lib.d.mts",
|
||||
"default": "./dist/lib.mjs"
|
||||
}
|
||||
},
|
||||
"./codex/happyMcpStdioBridge": {
|
||||
"require": {
|
||||
"types": "./dist/codex/happyMcpStdioBridge.d.cts",
|
||||
"default": "./dist/codex/happyMcpStdioBridge.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/codex/happyMcpStdioBridge.d.mts",
|
||||
"default": "./dist/codex/happyMcpStdioBridge.mjs"
|
||||
}
|
||||
}
|
||||
"hapi": "./src/index.ts"
|
||||
},
|
||||
"imports": {
|
||||
"#embedded-assets": {
|
||||
@@ -57,31 +21,17 @@
|
||||
"default": "./src/runtime/embeddedAssets.stub.ts"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bin",
|
||||
"scripts",
|
||||
"tools",
|
||||
"package.json"
|
||||
],
|
||||
"scripts": {
|
||||
"why do we need to build before running tests / dev?": "We need the binary to be built so we run daemon commands which directly run the binary - we don't want them to go out of sync or have custom spawn logic depending how we started HAPI",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "bun run scripts/write-embedded-assets-stub.ts && shx rm -rf dist && tsc --noEmit && pkgroll",
|
||||
"build:exe": "bun run scripts/build-executable.ts",
|
||||
"build:exe:all": "bun run scripts/build-executable.ts --all",
|
||||
"build:exe:allinone": "bun run scripts/build-executable.ts --with-web-assets",
|
||||
"build:exe:allinone:all": "bun run scripts/build-executable.ts --with-web-assets --all",
|
||||
"test": "bun run build && tsx --env-file .env.integration-test node_modules/.bin/vitest run",
|
||||
"test:win": "bun run build && vitest run",
|
||||
"start": "bun run build && ./bin/happy.mjs",
|
||||
"start:win": "bun run build && node ./bin/happy.mjs",
|
||||
"test": "tsx --env-file .env.integration-test node_modules/.bin/vitest run",
|
||||
"test:win": "vitest run",
|
||||
"dev": "tsx src/index.ts",
|
||||
"dev:local-server": "bun run build && tsx --env-file .env.dev-local-server src/index.ts",
|
||||
"dev:integration-test-env": "bun run build && tsx --env-file .env.integration-test src/index.ts",
|
||||
"prepublishOnly": "bun run build && bun run test",
|
||||
"release": "release-it",
|
||||
"postinstall": "node scripts/unpack-tools.cjs"
|
||||
"dev:local-server": "tsx --env-file .env.dev-local-server src/index.ts",
|
||||
"dev:integration-test-env": "tsx --env-file .env.integration-test src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.22.0",
|
||||
@@ -110,8 +60,6 @@
|
||||
"dotenv": "^16.6.1",
|
||||
"eslint": "^9",
|
||||
"eslint-config-prettier": "^10",
|
||||
"pkgroll": "^2.14.2",
|
||||
"release-it": "^19.0.6",
|
||||
"shx": "^0.3.3",
|
||||
"ts-node": "^10",
|
||||
"tsx": "^4.20.6",
|
||||
@@ -123,8 +71,5 @@
|
||||
"parse-path": "7.0.3",
|
||||
"@types/parse-path": "7.0.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org"
|
||||
},
|
||||
"packageManager": "bun@1.3.4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user