Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aec6809

Browse files
Add file for global constants
1 parent ddcf22c commit aec6809

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

‎src/node/constants.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { logger } from "@coder/logger"
2+
import * as path from "path"
3+
4+
let pkg: { version?: string; commit?: string } = {}
5+
try {
6+
pkg = require("../../package.json")
7+
} catch (error) {
8+
logger.warn(error.message)
9+
}
10+
11+
export const version = pkg.version || "development"
12+
export const commit = pkg.commit || "development"
13+
export const rootPath = path.resolve(__dirname, "../..")

‎src/node/entry.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@ import {
1717
shouldRunVsCodeCli,
1818
} from "./cli"
1919
import { coderCloudBind } from "./coder-cloud"
20+
import { commit, version } from "./constants"
2021
import { loadPlugins } from "./plugin"
2122
import { humanPath, open } from "./util"
2223
import { ipcMain, WrapperProcess } from "./wrapper"
2324

24-
let pkg: { version?: string; commit?: string } = {}
25-
try {
26-
pkg = require("../../package.json")
27-
} catch (error) {
28-
logger.warn(error.message)
29-
}
30-
31-
const version = pkg.version || "development"
32-
const commit = pkg.commit || "development"
33-
3425
export const runVsCodeCli = (args: DefaultedArgs): void => {
3526
logger.debug("forking vs code cli...")
3627
const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /