Fix for 'TypeError: Cannot read properties of undefined (reading 'command')' error that was occurring - program wouldn't load successfully with an undefined version number.

This commit is contained in:
mike12345567 2023-05-16 10:00:49 +01:00
parent eb5672a546
commit f577b880ee
2 changed files with 4 additions and 3 deletions

View File

@ -2,17 +2,17 @@
process.env.DISABLE_PINO_LOGGER = "1"
import "./prebuilds"
import "./environment"
import { env } from "@budibase/backend-core"
import { getCommands } from "./options"
import { Command } from "commander"
import { getHelpDescription } from "./utils"
import { version } from "../package.json"
// add hosting config
async function init() {
const program = new Command()
.addHelpCommand("help", getHelpDescription("Help with Budibase commands."))
.helpOption(false)
.version(env.VERSION)
.version(version)
// add commands
for (let command of getCommands()) {
command.configure(program)

View File

@ -5,6 +5,7 @@
"declaration": true,
"sourceMap": true,
"baseUrl": ".",
"resolveJsonModule": true,
"paths": {
"@budibase/types": ["../types/src"],
"@budibase/backend-core": ["../backend-core/src"],
@ -16,6 +17,6 @@
"swc": true
},
"references": [{ "path": "../types" }, { "path": "../backend-core" }],
"include": ["src/**/*"],
"include": ["src/**/*", "package.json"],
"exclude": ["node_modules", "dist"]
}