mirror of https://git.tuxpa.in/a/code-server.git
parent
87d2e22a6b
commit
3d654a8df7
|
@ -49,11 +49,11 @@ export class Entry extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { args, flags } = this.parse(Entry);
|
const { args, flags } = this.parse(Entry);
|
||||||
const dataDir = flags["data-dir"] || path.join(os.homedir(), ".code-server");
|
const dataDir = path.resolve(flags["data-dir"] || path.join(os.homedir(), ".code-server"));
|
||||||
const workingDir = args["workdir"];
|
const workingDir = path.resolve(args["workdir"]);
|
||||||
|
|
||||||
setupNativeModules(dataDir);
|
setupNativeModules(dataDir);
|
||||||
const builtInExtensionsDir = path.join(buildDir || path.join(__dirname, ".."), "build/extensions");
|
const builtInExtensionsDir = path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions");
|
||||||
if (flags["bootstrap-fork"]) {
|
if (flags["bootstrap-fork"]) {
|
||||||
const modulePath = flags["bootstrap-fork"];
|
const modulePath = flags["bootstrap-fork"];
|
||||||
if (!modulePath) {
|
if (!modulePath) {
|
||||||
|
@ -84,8 +84,8 @@ export class Entry extends Command {
|
||||||
const logDir = path.join(dataDir, "logs", new Date().toISOString().replace(/[-:.TZ]/g, ""));
|
const logDir = path.join(dataDir, "logs", new Date().toISOString().replace(/[-:.TZ]/g, ""));
|
||||||
process.env.VSCODE_LOGS = logDir;
|
process.env.VSCODE_LOGS = logDir;
|
||||||
|
|
||||||
const certPath = flags.cert;
|
const certPath = flags.cert ? path.resolve(flags.cert) : undefined;
|
||||||
const certKeyPath = flags["cert-key"];
|
const certKeyPath = flags["cert-key"] ? path.resolve(flags["cert-key"]) : undefined;
|
||||||
|
|
||||||
if (certPath && !certKeyPath) {
|
if (certPath && !certKeyPath) {
|
||||||
logger.error("'--cert-key' flag is required when specifying a certificate!");
|
logger.error("'--cert-key' flag is required when specifying a certificate!");
|
||||||
|
@ -135,9 +135,9 @@ export class Entry extends Command {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let password = flags["password"];
|
let password = flags.password;
|
||||||
if (!password) {
|
if (!password) {
|
||||||
// Generate a random password
|
// Generate a random password with a length of 24.
|
||||||
const buffer = Buffer.alloc(12);
|
const buffer = Buffer.alloc(12);
|
||||||
randomFillSync(buffer);
|
randomFillSync(buffer);
|
||||||
password = buffer.toString("hex");
|
password = buffer.toString("hex");
|
||||||
|
@ -158,7 +158,7 @@ export class Entry extends Command {
|
||||||
// If we're not running from the binary and we aren't serving the static
|
// If we're not running from the binary and we aren't serving the static
|
||||||
// pre-built version, use webpack to serve the web files.
|
// pre-built version, use webpack to serve the web files.
|
||||||
if (!isCli && !serveStatic) {
|
if (!isCli && !serveStatic) {
|
||||||
const webpackConfig = require(path.join(__dirname, "..", "..", "web", "webpack.config.js"));
|
const webpackConfig = require(path.resolve(__dirname, "..", "..", "web", "webpack.config.js"));
|
||||||
const compiler = require("webpack")(webpackConfig);
|
const compiler = require("webpack")(webpackConfig);
|
||||||
app.use(require("webpack-dev-middleware")(compiler, {
|
app.use(require("webpack-dev-middleware")(compiler, {
|
||||||
logger,
|
logger,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
export const isCli = typeof process.env.CLI !== "undefined" && process.env.CLI !== "false";
|
export const isCli = typeof process.env.CLI !== "undefined" && process.env.CLI !== "false";
|
||||||
export const serveStatic = typeof process.env.SERVE_STATIC !== "undefined" && process.env.SERVE_STATIC !== "false";
|
export const serveStatic = typeof process.env.SERVE_STATIC !== "undefined" && process.env.SERVE_STATIC !== "false";
|
||||||
export const buildDir = process.env.BUILD_DIR;
|
export const buildDir = process.env.BUILD_DIR ? path.resolve(process.env.BUILD_DIR) : "";
|
||||||
|
|
Loading…
Reference in New Issue