Add file for global constants
This commit is contained in:
parent
71dc5c7542
commit
4b6cbacbad
13
src/node/constants.ts
Normal file
13
src/node/constants.ts
Normal 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, "../..")
|
@ -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"), [], {
|
||||||
|
Loading…
Reference in New Issue
Block a user