mirror of https://git.tuxpa.in/a/code-server.git
Add dev mode constant
This commit is contained in:
parent
75e9e24e92
commit
92bf2c9760
|
@ -20,3 +20,4 @@ export const version = pkg.version || "development"
|
||||||
export const commit = pkg.commit || "development"
|
export const commit = pkg.commit || "development"
|
||||||
export const rootPath = path.resolve(__dirname, "../..")
|
export const rootPath = path.resolve(__dirname, "../..")
|
||||||
export const tmpdir = path.join(os.tmpdir(), "code-server")
|
export const tmpdir = path.join(os.tmpdir(), "code-server")
|
||||||
|
export const isDevMode = commit === "development"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import * as ipc from "../../../typings/ipc"
|
||||||
import { Emitter } from "../../common/emitter"
|
import { Emitter } from "../../common/emitter"
|
||||||
import { HttpCode, HttpError } from "../../common/http"
|
import { HttpCode, HttpError } from "../../common/http"
|
||||||
import { getFirstString } from "../../common/util"
|
import { getFirstString } from "../../common/util"
|
||||||
import { commit, rootPath, version } from "../constants"
|
import { isDevMode, rootPath, version } from "../constants"
|
||||||
import { authenticated, ensureAuthenticated, redirect, replaceTemplates } from "../http"
|
import { authenticated, ensureAuthenticated, redirect, replaceTemplates } from "../http"
|
||||||
import { getMediaMime, pathToFsPath } from "../util"
|
import { getMediaMime, pathToFsPath } from "../util"
|
||||||
import { VscodeProvider } from "../vscode"
|
import { VscodeProvider } from "../vscode"
|
||||||
|
@ -31,7 +31,7 @@ router.get("/", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
return await vscode.initialize({ args: req.args, remoteAuthority: req.headers.host || "" }, req.query)
|
return await vscode.initialize({ args: req.args, remoteAuthority: req.headers.host || "" }, req.query)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const devMessage = commit === "development" ? "It might not have finished compiling." : ""
|
const devMessage = isDevMode ? "It might not have finished compiling." : ""
|
||||||
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
|
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
|
@ -44,7 +44,7 @@ router.get("/", async (req, res) => {
|
||||||
req,
|
req,
|
||||||
// Uncomment prod blocks if not in development. TODO: Would this be
|
// Uncomment prod blocks if not in development. TODO: Would this be
|
||||||
// better as a build step? Or maintain two HTML files again?
|
// better as a build step? Or maintain two HTML files again?
|
||||||
commit !== "development" ? content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "") : content,
|
!isDevMode ? content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "") : content,
|
||||||
{
|
{
|
||||||
authed: req.args.auth !== "none",
|
authed: req.args.auth !== "none",
|
||||||
disableTelemetry: !!req.args["disable-telemetry"],
|
disableTelemetry: !!req.args["disable-telemetry"],
|
||||||
|
|
Loading…
Reference in New Issue