Skip to content

Commit 8510df1

Browse files
committed
refactor: clean up code in constants.ts
1 parent e48506e commit 8510df1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/node/constants.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJso
1616
return pkg
1717
}
1818

19-
const pkg = getPackageJson("../../package.json")
20-
const codePkg = getPackageJson("../../vendor/modules/code-oss-dev/package.json")
21-
19+
export const rootPath = path.resolve(__dirname, "../..")
20+
export const vsRootPath = path.join(rootPath, "vendor/modules/code-oss-dev")
21+
const PACKAGE_JSON = "package.json"
22+
const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`)
23+
const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || {version: "0.0.0"}
2224
export const pkgName = pkg.name || "code-server"
2325
export const version = pkg.version || "development"
2426
export const commit = pkg.commit || "development"
25-
export const rootPath = path.resolve(__dirname, "../..")
26-
export const vsRootPath = path.join(rootPath, "vendor/modules/code-oss-dev")
2727
export const codeVersion = codePkg.version || "development"
2828
export const tmpdir = path.join(os.tmpdir(), "code-server")
2929
export const isDevMode = commit === "development"

0 commit comments

Comments
 (0)