Add standalone executable packaging with esbuild + pkg
- Add npm scripts for building Windows/Linux/macOS executables - Replace uuid package with crypto.randomUUID() for ESM compatibility - Use esbuild to pre-bundle code before pkg (fixes MCP SDK subpath exports) - Update CLI name from 'memory' to 'cortex' - Update USAGE.md with build instructions and standalone setup - Add bundle/ and build/ to .gitignore
This commit is contained in:
32
package.json
32
package.json
@@ -5,15 +5,37 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"serve": "node dist/server/index.js"
|
||||
"serve": "node dist/server/index.js",
|
||||
"bundle": "npm run build && npm run bundle:cli && npm run bundle:mcp",
|
||||
"bundle:cli": "esbuild dist/cli/index.js --bundle --platform=node --outfile=bundle/cli.js --external:better-sqlite3",
|
||||
"bundle:mcp": "esbuild dist/mcp/index.js --bundle --platform=node --outfile=bundle/mcp.js --external:better-sqlite3",
|
||||
"package": "npm run bundle && npm run package:cli && npm run package:mcp",
|
||||
"package:cli": "pkg ./bundle/cli.js --targets node22-win-x64 --output build/cortex.exe --config package.json",
|
||||
"package:mcp": "pkg ./bundle/mcp.js --targets node22-win-x64 --output build/cortex-mcp.exe --config package.json",
|
||||
"package:win": "npm run bundle && npm run package:cli && npm run package:mcp",
|
||||
"package:linux": "npm run bundle && pkg ./bundle/cli.js --targets node22-linux-x64 --output build/cortex --config package.json && pkg ./bundle/mcp.js --targets node22-linux-x64 --output build/cortex-mcp --config package.json",
|
||||
"package:mac": "npm run bundle && pkg ./bundle/cli.js --targets node22-macos-x64 --output build/cortex --config package.json && pkg ./bundle/mcp.js --targets node22-macos-x64 --output build/cortex-mcp --config package.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": "AI project memory - knowledge graph backed by SQLite + Ollama embeddings",
|
||||
"bin": {
|
||||
"memory": "./dist/cli/index.js",
|
||||
"memory-mcp": "./dist/mcp/index.js"
|
||||
"cortex": "./dist/cli/index.js",
|
||||
"cortex-mcp": "./dist/mcp/index.js"
|
||||
},
|
||||
"pkg": {
|
||||
"targets": [
|
||||
"node22-win-x64"
|
||||
],
|
||||
"outputPath": "build",
|
||||
"assets": [
|
||||
"node_modules/better-sqlite3/build/Release/*.node",
|
||||
"node_modules/better-sqlite3/prebuilds/**/*"
|
||||
],
|
||||
"scripts": [
|
||||
"dist/**/*.js"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.25.3",
|
||||
@@ -22,7 +44,6 @@
|
||||
"commander": "^14.0.3",
|
||||
"cors": "^2.8.6",
|
||||
"express": "^5.2.1",
|
||||
"uuid": "^13.0.0",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -30,7 +51,8 @@
|
||||
"@types/cors": "^2.8.19",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/node": "^25.2.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@yao-pkg/pkg": "^6.3.0",
|
||||
"esbuild": "^0.27.2",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user