1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-05 07:13:06 +08:00
code-server/src/node/constants.ts

24 lines
701 B
TypeScript
Raw Normal View History

2020-10-17 03:45:49 +08:00
import { logger } from "@coder/logger"
import { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package"
import * as os from "os"
2020-10-17 03:45:49 +08:00
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
2020-10-17 03:45:49 +08:00
}
const pkg = getPackageJson("../../package.json")
2020-10-17 03:45:49 +08:00
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")
2021-05-05 23:16:01 +08:00
export const isDevMode = commit === "development"