Add file for global constants

This commit is contained in:
Asher 2020-10-16 14:45:49 -05:00
parent 71dc5c7542
commit 4b6cbacbad
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
2 changed files with 14 additions and 10 deletions

13
src/node/constants.ts Normal file
View File

@ -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, "../..")

View File

@ -17,20 +17,11 @@ import {
shouldRunVsCodeCli, shouldRunVsCodeCli,
} from "./cli" } from "./cli"
import { coderCloudBind } from "./coder-cloud" import { coderCloudBind } from "./coder-cloud"
import { commit, version } from "./constants"
import { loadPlugins } from "./plugin" import { loadPlugins } from "./plugin"
import { humanPath, open } from "./util" import { humanPath, open } from "./util"
import { ipcMain, WrapperProcess } from "./wrapper" 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 => { export const runVsCodeCli = (args: DefaultedArgs): void => {
logger.debug("forking vs code cli...") logger.debug("forking vs code cli...")
const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], { const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], {