1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-04 23:03:06 +08:00
code-server/src/node/constants.ts
2021-05-05 10:16:01 -05:00

24 lines
701 B
TypeScript

import { logger } from "@coder/logger"
import { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package"
import * as os from "os"
import * as path from "path"
export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJsonFiles {
let pkg = {}
try {
pkg = require(relativePath)
} catch (error) {
logger.warn(error.message)
}
return pkg
}
const pkg = getPackageJson("../../package.json")
export const version = pkg.version || "development"
export const commit = pkg.commit || "development"
export const rootPath = path.resolve(__dirname, "../..")
export const tmpdir = path.join(os.tmpdir(), "code-server")
export const isDevMode = commit === "development"