Removing CLI pkg build - this has been a problematic element of our build for a while now and it is rarely utilised - rather than continuing to maintain this, getting rid of it.
This commit is contained in:
parent
a4194e4d00
commit
9be6d6c645
|
@ -5,7 +5,6 @@ build/
|
||||||
docker-error.log
|
docker-error.log
|
||||||
envoy.yaml
|
envoy.yaml
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
prebuilds/
|
|
||||||
dist/
|
dist/
|
||||||
budibase-automation/
|
budibase-automation/
|
||||||
budibase-component/
|
budibase-component/
|
||||||
|
|
|
@ -9,26 +9,11 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf prebuilds 2> /dev/null && cp -r ../../node_modules/leveldown/prebuilds prebuilds",
|
|
||||||
"rename": "renamer --find .node --replace .fake 'prebuilds/**'",
|
|
||||||
"tsc": "node ../../scripts/build.js",
|
"tsc": "node ../../scripts/build.js",
|
||||||
"pkg": "pkg . --out-path build --no-bytecode --public --public-packages \"*\" -C GZip",
|
"build": "yarn tsc",
|
||||||
"build": "yarn prebuild && yarn rename && yarn tsc && yarn pkg && yarn postbuild",
|
|
||||||
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
|
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
|
||||||
"postbuild": "rm -rf prebuilds 2> /dev/null",
|
|
||||||
"start": "ts-node ./src/index.ts"
|
"start": "ts-node ./src/index.ts"
|
||||||
},
|
},
|
||||||
"pkg": {
|
|
||||||
"targets": [
|
|
||||||
"node18-linux",
|
|
||||||
"node18-win",
|
|
||||||
"node18-macos"
|
|
||||||
],
|
|
||||||
"assets": [
|
|
||||||
"prebuilds/**/*"
|
|
||||||
],
|
|
||||||
"outputPath": "build"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "0.0.0",
|
"@budibase/backend-core": "0.0.0",
|
||||||
"@budibase/string-templates": "0.0.0",
|
"@budibase/string-templates": "0.0.0",
|
||||||
|
@ -43,7 +28,6 @@
|
||||||
"inquirer": "8.0.0",
|
"inquirer": "8.0.0",
|
||||||
"lookpath": "1.1.0",
|
"lookpath": "1.1.0",
|
||||||
"node-fetch": "2.6.7",
|
"node-fetch": "2.6.7",
|
||||||
"pkg": "5.8.0",
|
|
||||||
"posthog-node": "1.3.0",
|
"posthog-node": "1.3.0",
|
||||||
"pouchdb": "7.3.0",
|
"pouchdb": "7.3.0",
|
||||||
"pouchdb-replication-stream": "1.2.9",
|
"pouchdb-replication-stream": "1.2.9",
|
||||||
|
@ -55,7 +39,6 @@
|
||||||
"@types/jest": "29.5.5",
|
"@types/jest": "29.5.5",
|
||||||
"@types/node-fetch": "2.6.4",
|
"@types/node-fetch": "2.6.4",
|
||||||
"@types/pouchdb": "^6.4.0",
|
"@types/pouchdb": "^6.4.0",
|
||||||
"renamer": "^4.0.0",
|
|
||||||
"ts-node": "10.8.1",
|
"ts-node": "10.8.1",
|
||||||
"typescript": "5.2.2"
|
"typescript": "5.2.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.DISABLE_PINO_LOGGER = "1"
|
process.env.DISABLE_PINO_LOGGER = "1"
|
||||||
import "./prebuilds"
|
|
||||||
import "./environment"
|
import "./environment"
|
||||||
import { getCommands } from "./options"
|
import { getCommands } from "./options"
|
||||||
import { Command } from "commander"
|
import { Command } from "commander"
|
||||||
import { getHelpDescription } from "./utils"
|
import { getHelpDescription, error } from "./utils"
|
||||||
import { version } from "../package.json"
|
import { version } from "../package.json"
|
||||||
|
|
||||||
// add hosting config
|
// add hosting config
|
||||||
|
@ -21,6 +20,23 @@ async function init() {
|
||||||
await program.parseAsync(process.argv)
|
await program.parseAsync(process.argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const events = ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "uncaughtException"]
|
||||||
|
events.forEach(event => {
|
||||||
|
process.on(event, (evt?: number) => {
|
||||||
|
if (evt && !isNaN(evt)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (evt) {
|
||||||
|
console.error(
|
||||||
|
error(
|
||||||
|
"Failed to run CLI command - please report with the following message:"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
console.error(error(evt))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
init().catch(err => {
|
init().catch(err => {
|
||||||
console.error(`Unexpected error - `, err)
|
console.error(`Unexpected error - `, err)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
import os from "os"
|
|
||||||
import { join } from "path"
|
|
||||||
import fs from "fs"
|
|
||||||
import { error } from "./utils"
|
|
||||||
|
|
||||||
const PREBUILDS = "prebuilds"
|
|
||||||
const ARCH = `${os.platform()}-${os.arch()}`
|
|
||||||
const PREBUILD_DIR = join(process.execPath, "..", "cli", PREBUILDS, ARCH)
|
|
||||||
|
|
||||||
// running as built CLI pkg bundle
|
|
||||||
if (!process.argv[0].includes("node")) {
|
|
||||||
checkForBinaries()
|
|
||||||
}
|
|
||||||
|
|
||||||
function localPrebuildPath() {
|
|
||||||
return join(process.execPath, "..", PREBUILDS)
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkForBinaries() {
|
|
||||||
const readDir = join(__filename, "..", "..", "..", "cli", PREBUILDS, ARCH)
|
|
||||||
if (fs.existsSync(PREBUILD_DIR) || !fs.existsSync(readDir)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const natives = fs.readdirSync(readDir)
|
|
||||||
if (fs.existsSync(readDir)) {
|
|
||||||
const writePath = join(localPrebuildPath(), ARCH)
|
|
||||||
fs.mkdirSync(writePath, { recursive: true })
|
|
||||||
for (let native of natives) {
|
|
||||||
const filename = `${native.split(".fake")[0]}.node`
|
|
||||||
fs.cpSync(join(readDir, native), join(writePath, filename))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanup(evt?: number) {
|
|
||||||
// cleanup prebuilds first
|
|
||||||
const path = localPrebuildPath()
|
|
||||||
if (fs.existsSync(path)) {
|
|
||||||
fs.rmSync(path, { recursive: true })
|
|
||||||
}
|
|
||||||
if (evt && !isNaN(evt)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (evt) {
|
|
||||||
console.error(
|
|
||||||
error(
|
|
||||||
"Failed to run CLI command - please report with the following message:"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
console.error(error(evt))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const events = ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "uncaughtException"]
|
|
||||||
events.forEach(event => {
|
|
||||||
process.on(event, cleanup)
|
|
||||||
})
|
|
Loading…
Reference in New Issue