diff --git a/src/node/constants.ts b/src/node/constants.ts new file mode 100644 index 000000000..d6ba953ea --- /dev/null +++ b/src/node/constants.ts @@ -0,0 +1,13 @@ +import { logger } from "@coder/logger" +import * as path from "path" + +let pkg: { version?: string; commit?: string } = {} +try { + pkg = require("../../package.json") +} catch (error) { + logger.warn(error.message) +} + +export const version = pkg.version || "development" +export const commit = pkg.commit || "development" +export const rootPath = path.resolve(__dirname, "../..") diff --git a/src/node/entry.ts b/src/node/entry.ts index e8c6b4e1f..ce0d2980f 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -17,20 +17,11 @@ import { shouldRunVsCodeCli, } from "./cli" import { coderCloudBind } from "./coder-cloud" +import { commit, version } from "./constants" import { loadPlugins } from "./plugin" import { humanPath, open } from "./util" import { ipcMain, WrapperProcess } from "./wrapper" -let pkg: { version?: string; commit?: string } = {} -try { - pkg = require("../../package.json") -} catch (error) { - logger.warn(error.message) -} - -const version = pkg.version || "development" -const commit = pkg.commit || "development" - export const runVsCodeCli = (args: DefaultedArgs): void => { logger.debug("forking vs code cli...") const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], {