@@ -10,6 +10,7 @@ import { requireModule } from "./vscode/bootstrapFork";
1010import { SharedProcess , SharedProcessState } from "./vscode/sharedProcess" ;
1111import { setup as setupNativeModules } from "./modules" ;
1212import { fillFs } from "./fill" ;
13+ import { isCli , serveStatic , buildDir } from "./constants" ;
1314
1415export class Entry extends Command {
1516 public static description = "Start your own self-hosted browser-accessible VS Code" ;
@@ -50,7 +51,7 @@ export class Entry extends Command {
5051 logger . warn ( "Failed to remove extracted dependency." , field ( "dependency" , "spdlog" ) , field ( "error" , ex . message ) ) ;
5152 }
5253
53- if ( process . env . CLI ) {
54+ if ( isCli ) {
5455 fillFs ( ) ;
5556 }
5657
@@ -60,7 +61,7 @@ export class Entry extends Command {
6061 Object . assign ( process . env , JSON . parse ( flags . env ) ) ;
6162 }
6263
63- const builtInExtensionsDir = path . join ( process . env . BUILD_DIR || path . join ( __dirname , ".." ) , "build/extensions" ) ;
64+ const builtInExtensionsDir = path . join ( buildDir || path . join ( __dirname , ".." ) , "build/extensions" ) ;
6465 if ( flags [ "bootstrap-fork" ] ) {
6566 const modulePath = flags [ "bootstrap-fork" ] ;
6667 if ( ! modulePath ) {
@@ -74,8 +75,8 @@ export class Entry extends Command {
7475 const dataDir = flags [ "data-dir" ] || path . join ( os . homedir ( ) , ".vscode-remote" ) ;
7576 const workingDir = args [ "workdir" ] ;
7677
77- if ( process . env . BUILD_DIR && process . env . BUILD_DIR . startsWith ( workingDir ) ) {
78- logger . error ( "Cannot run binary inside of BUILD_DIR" , field ( "build_dir" , process . env . BUILD_DIR ) , field ( "cwd" , process . cwd ( ) ) ) ;
78+ if ( buildDir && buildDir . startsWith ( workingDir ) ) {
79+ logger . error ( "Cannot run binary inside of BUILD_DIR" , field ( "build_dir" , buildDir ) , field ( "cwd" , process . cwd ( ) ) ) ;
7980 process . exit ( 1 ) ;
8081 }
8182
@@ -114,7 +115,7 @@ export class Entry extends Command {
114115
115116 next ( ) ;
116117 } ) ;
117- if ( ( process . env . CLI === "false" || ! process . env . CLI ) && ! process . env . SERVE_STATIC ) {
118+ if ( ! isCli && ! serveStatic ) {
118119 const webpackConfig = require ( path . join ( __dirname , ".." , ".." , "web" , "webpack.config.js" ) ) ;
119120 const compiler = require ( "webpack" ) ( webpackConfig ) ;
120121 app . use ( require ( "webpack-dev-middleware" ) ( compiler , {
@@ -163,6 +164,6 @@ export class Entry extends Command {
163164}
164165
165166Entry . run ( undefined , {
166- root : process . env . BUILD_DIR as string || __dirname ,
167+ root : buildDir || __dirname ,
167168 //@ts -ignore
168169} ) . catch ( require ( "@oclif/errors/handle" ) ) ;
0 commit comments