rm pkg and update node version

This commit is contained in:
2024-03-04 18:32:03 +01:00
parent 39a9ac0dad
commit eb76fe085a
8 changed files with 26 additions and 527 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "cryptgeon",
"version": "2.5.0",
"version": "2.5.1",
"homepage": "https://github.com/cupcakearmy/cryptgeon",
"repository": {
"type": "git",
@@ -9,10 +9,7 @@
},
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
".": "./dist/index.mjs"
},
"types": "./dist/index.d.ts",
"bin": {
@@ -23,9 +20,8 @@
],
"scripts": {
"bin": "run-s build package",
"build": "tsc && ./scripts/build.js",
"build": "rm -rf dist && tsc && ./scripts/build.js",
"dev": "./scripts/build.js --watch",
"package": "./scripts/package.js",
"prepublishOnly": "run-s build"
},
"devDependencies": {
@@ -39,7 +35,6 @@
"inquirer": "^9.2.15",
"mime": "^4.0.1",
"occulto": "^2.0.3",
"pkg": "^5.8.1",
"pretty-bytes": "^6.1.1",
"typescript": "^5.3.3"
},

View File

@@ -3,29 +3,32 @@
import { build, context } from 'esbuild'
import pkg from '../package.json' assert { type: 'json' }
const options = {
entryPoints: ['./src/cli.ts'],
const common = {
bundle: true,
minify: true,
platform: 'node',
outfile: './dist/cli.cjs',
define: { VERSION: `"${pkg.version}"` },
}
const cliOptions = {
...common,
entryPoints: ['./src/cli.ts'],
format: 'cjs',
outfile: './dist/cli.cjs',
}
const indexOptions = {
...common,
entryPoints: ['./src/index.ts'],
outfile: './dist/index.mjs',
format: 'esm',
}
const watch = process.argv.slice(2)[0] === '--watch'
if (watch) {
;(await context(options)).watch()
const ctx = await context(cliOptions)
ctx.watch()
} else {
await build(options)
// Also build internals to expose
await build({
entryPoints: ['./src/index.ts'],
bundle: true,
minify: true,
platform: 'node',
format: 'esm',
outfile: './dist/index.js',
define: { VERSION: `"${pkg.version}"` },
})
await build(cliOptions)
await build(indexOptions)
}

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env node
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/cli.cjs', '--target', target, '--output', `./bin/${target.replace('node18', 'cryptgeon')}`])
}