Skip to content

Commit

Permalink
launch: check prerequisites in a pre-launch task
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Jul 31, 2020
1 parent c39b379 commit 4bda5f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
14 changes: 2 additions & 12 deletions code-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,17 @@ title VSCode Dev

pushd %~dp0\..

:: Node modules
if not exist node_modules call yarn
:: Get electron, compile, built-in extensions
if "%VSCODE_SKIP_PRELAUNCH%"=="" node build/lib/preLaunch.js

for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"

:: Download Electron if needed
node build\lib\electron.js
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron

:: Manage built-in extensions
if "%1"=="--builtin" goto builtin

:: Sync built-in extensions
node build\lib\builtInExtensions.js

:: Build
if not exist out yarn compile

:: Configuration
set ELECTRON_RUN_AS_NODE=1
set NODE_ENV=development
Expand Down
15 changes: 4 additions & 11 deletions code-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,17 @@ function code() {
CODE=".build/electron/$NAME"
fi

# Node modules
test -d node_modules || yarn

# Get electron
yarn electron
# Get electron, compile, built-in extensions
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
node build/lib/preLaunch.js
fi

# Manage built-in extensions
if [[ "$1" == "--builtin" ]]; then
exec "$CODE" build/builtin
return
fi

# Sync built-in extensions
node build/lib/builtInExtensions.js

# Build
test -d out || yarn compile

ELECTRON_RUN_AS_NODE=1 \
NODE_ENV=development \
VSCODE_DEV=1 \
Expand Down
13 changes: 2 additions & 11 deletions code.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@ title VSCode Dev

pushd %~dp0\..

:: Node modules
if not exist node_modules call yarn
:: Get electron, compile, built-in extensions
if "%VSCODE_SKIP_PRELAUNCH%"=="" node build/lib/preLaunch.js

for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"

:: Get electron
call yarn electron

:: Manage built-in extensions
if "%1"=="--builtin" goto builtin

:: Sync built-in extensions
node build\lib\builtInExtensions.js

:: Build
if not exist out yarn compile

:: Configuration
set NODE_ENV=development
set VSCODE_DEV=1
Expand Down
15 changes: 4 additions & 11 deletions code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,17 @@ function code() {
CODE=".build/electron/$NAME"
fi

# Node modules
test -d node_modules || yarn

# Get electron
yarn electron
# Get electron, compile, built-in extensions
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
node build/lib/preLaunch.js
fi

# Manage built-in extensions
if [[ "$1" == "--builtin" ]]; then
exec "$CODE" build/builtin
return
fi

# Sync built-in extensions
node build/lib/builtInExtensions.js

# Build
test -d out || yarn compile

# Configuration
export NODE_ENV=development
export VSCODE_DEV=1
Expand Down

0 comments on commit 4bda5f8

Please sign in to comment.