From bc156f504f596dcc711239a1f039840de33ef25e Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Fri, 12 May 2023 18:55:27 +0200 Subject: [PATCH] cli packaging --- packages/cli/build.js | 15 +++++++++++++++ packages/cli/package.json | 39 +++++++++++++++------------------------ 2 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 packages/cli/build.js diff --git a/packages/cli/build.js b/packages/cli/build.js new file mode 100644 index 0000000..9ddac52 --- /dev/null +++ b/packages/cli/build.js @@ -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')}`]) +} diff --git a/packages/cli/package.json b/packages/cli/package.json index 0e02645..469f55e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,11 +1,16 @@ { - "name": "@cryptgeon/cli", + "version": "2.3.0-beta.2", + "name": "cryptgeon", "type": "module", + "engines": { + "node": ">=18" + }, "scripts": { "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", - "package": "pkg .", - "bin": "run-s build package" + "build": "rm -rf ./dist && tsc && esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.cjs", + "package": "node ./build.js", + "bin": "run-s build package", + "prepublishOnly": "run-s build" }, "bin": { "cryptgeon": "./dist/index.cjs" @@ -13,33 +18,19 @@ "files": [ "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": { + "@commander-js/extra-typings": "^9.5.0", + "@cryptgeon/shared": "workspace:*", "@types/inquirer": "^9.0.3", "@types/mime": "^3.0.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", + "esbuild": "^0.17.18", "inquirer": "^9.2.0", "mime": "^3.0.0", "occulto": "^2.0.1", - "pretty-bytes": "^6.1.0" + "pkg": "^5.8.1", + "pretty-bytes": "^6.1.0", + "typescript": "^4.9.5" } }