cli packaging

This commit is contained in:
Niccolo Borgioli 2023-05-12 18:55:27 +02:00
parent 1abb78190a
commit bc156f504f
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
2 changed files with 30 additions and 24 deletions

15
packages/cli/build.js Normal file
View File

@ -0,0 +1,15 @@
import { exec } from 'pkg'
const targets = [
'node18-macos-arm64',
'node18-macos-x64',
'node18-linux-arm64',
'node18-linux-x64',
'node18-win-arm64',
'node18-win-x64',
]
for (const target of targets) {
console.log(`🚀 Building ${target}`)
await exec(['./dist/index.cjs', '--target', target, '--output', `./bin/${target.replace('node18', 'cryptgeon')}`])
}

View File

@ -1,11 +1,16 @@
{ {
"name": "@cryptgeon/cli", "version": "2.3.0-beta.2",
"name": "cryptgeon",
"type": "module", "type": "module",
"engines": {
"node": ">=18"
},
"scripts": { "scripts": {
"dev": "esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.cjs --watch", "dev": "esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.cjs --watch",
"build": "esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.cjs", "build": "rm -rf ./dist && tsc && esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.cjs",
"package": "pkg .", "package": "node ./build.js",
"bin": "run-s build package" "bin": "run-s build package",
"prepublishOnly": "run-s build"
}, },
"bin": { "bin": {
"cryptgeon": "./dist/index.cjs" "cryptgeon": "./dist/index.cjs"
@ -13,33 +18,19 @@
"files": [ "files": [
"dist" "dist"
], ],
"pkg": {
"scripts": [],
"targets": [
"node18-macos-arm64",
"node18-macos-x64",
"node18-linux-arm64",
"node18-linux-x64",
"node18-win-arm64",
"node18-win-x64"
],
"outputPath": "bin"
},
"devDependencies": { "devDependencies": {
"@commander-js/extra-typings": "^9.5.0",
"@cryptgeon/shared": "workspace:*",
"@types/inquirer": "^9.0.3", "@types/inquirer": "^9.0.3",
"@types/mime": "^3.0.1", "@types/mime": "^3.0.1",
"@types/node": "^18.16.1", "@types/node": "^18.16.1",
"esbuild": "^0.17.18",
"pkg": "^5.8.1",
"typescript": "^4.9.5"
},
"dependencies": {
"@commander-js/extra-typings": "^9.5.0",
"@cryptgeon/shared": "workspace:*",
"commander": "^9.5.0", "commander": "^9.5.0",
"esbuild": "^0.17.18",
"inquirer": "^9.2.0", "inquirer": "^9.2.0",
"mime": "^3.0.0", "mime": "^3.0.0",
"occulto": "^2.0.1", "occulto": "^2.0.1",
"pretty-bytes": "^6.1.0" "pkg": "^5.8.1",
"pretty-bytes": "^6.1.0",
"typescript": "^4.9.5"
} }
} }