Skip to content

Commit fdcecb5

Browse files
committed
remove package.json electronVersion
1 parent 3c70e7e commit fdcecb5

File tree

12 files changed

+17
-46
lines changed

12 files changed

+17
-46
lines changed

build/gulpfile.vscode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const crypto = require('crypto');
3333
const i18n = require('./lib/i18n');
3434
const glob = require('glob');
3535
const deps = require('./dependencies');
36+
const getElectronVersion = require('./lib/electron').getElectronVersion;
3637

3738
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
3839
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
@@ -123,7 +124,7 @@ gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-index-js'], commo
123124
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
124125

125126
const config = {
126-
version: packageJson.electronVersion,
127+
version: getElectronVersion(),
127128
productAppName: product.nameLong,
128129
companyName: 'Microsoft Corporation',
129130
copyright: 'Copyright (C) 2017 Microsoft. All rights reserved',

build/lib/electron.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ module.exports.getElectronVersion = getElectronVersion;
2121
// returns 0 if the right version of electron is in .build/electron
2222
if (require.main === module) {
2323
const version = getElectronVersion();
24-
console.log(version);
25-
2624
const versionFile = path.join(root, '.build', 'electron', 'version');
2725
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `v${version}`;
26+
2827
process.exit(isUpToDate ? 0 : 1);
2928
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.19.0",
4-
"electronVersion": "1.7.9",
54
"distro": "4120b819fd97e23adef120e48ceaa7d47c213c2c",
65
"author": {
76
"name": "Microsoft Corporation"

scripts/code-cli.bat

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@ set NAMESHORT=%NAMESHORT: "=%
1313
set NAMESHORT=%NAMESHORT:"=%.exe
1414
set CODE=".build\electron\%NAMESHORT%"
1515

16-
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"electronVersion\":.*" package.json') do set DESIREDVERSION=%%~a
17-
set DESIREDVERSION=%DESIREDVERSION: "=%
18-
set DESIREDVERSION=v%DESIREDVERSION:"=%
19-
if exist .\.build\electron\version (set /p INSTALLEDVERSION=<.\.build\electron\version) else (set INSTALLEDVERSION="")
20-
21-
:: Get electron
22-
if not exist %CODE% node .\node_modules\gulp\bin\gulp.js electron
23-
if not "%INSTALLEDVERSION%" == "%DESIREDVERSION%" node .\node_modules\gulp\bin\gulp.js electron
16+
:: Download Electron if needed
17+
node build\lib\electron.js
18+
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
2419

2520
:: Build
2621
if not exist out node .\node_modules\gulp\bin\gulp.js compile

scripts/code-cli.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ function code() {
1818
CODE=".build/electron/$NAME"
1919
fi
2020

21-
INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
22-
INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null`
23-
2421
# Node modules
2522
test -d node_modules || yarn
2623

2724
# Get electron
28-
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
25+
node build/lib/electron.js || ./node_modules/.bin/gulp electron
2926

3027
# Build
3128
test -d out || ./node_modules/.bin/gulp compile

scripts/code.bat

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@ set NAMESHORT=%NAMESHORT: "=%
1313
set NAMESHORT=%NAMESHORT:"=%.exe
1414
set CODE=".build\electron\%NAMESHORT%"
1515

16-
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"electronVersion\":.*" package.json') do set DESIREDVERSION=%%~a
17-
set DESIREDVERSION=%DESIREDVERSION: "=%
18-
set DESIREDVERSION=v%DESIREDVERSION:"=%
19-
if exist .\.build\electron\version (set /p INSTALLEDVERSION=<.\.build\electron\version) else (set INSTALLEDVERSION="")
20-
21-
:: Get electron
22-
if not exist %CODE% node .\node_modules\gulp\bin\gulp.js electron
23-
if not "%INSTALLEDVERSION%" == "%DESIREDVERSION%" node .\node_modules\gulp\bin\gulp.js electron
16+
:: Download Electron if needed
17+
node build\lib\electron.js
18+
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
2419

2520
:: Build
2621
if not exist out node .\node_modules\gulp\bin\gulp.js compile

scripts/code.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ function code() {
1818
CODE=".build/electron/$NAME"
1919
fi
2020

21-
INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
22-
INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null`
23-
2421
# Node modules
2522
test -d node_modules || yarn
2623

2724
# Get electron
28-
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
25+
node build/lib/electron.js || ./node_modules/.bin/gulp electron
2926

3027
# Build
3128
test -d out || ./node_modules/.bin/gulp compile

scripts/env.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
$env:npm_config_disturl="https://atom.io/download/electron"
2-
$env:npm_config_target=(node -p "require('./package.json').electronVersion")
2+
$env:npm_config_target=(node "build/lib/electron.js")
33
$env:npm_config_runtime="electron"

scripts/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
export npm_config_disturl=https://atom.io/download/electron
3-
export npm_config_target=$(node -p "require('./package.json').electronVersion")
3+
export npm_config_target=$(node "build/lib/electron.js")
44
export npm_config_runtime=electron
55
export npm_config_cache="$HOME/.npm-electron"
66
mkdir -p "$npm_config_cache"

scripts/node-electron.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ else
1717
CODE=".build/electron/$NAME"
1818
fi
1919

20-
INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
21-
INSTALLED_VERSION=$(cat .build/electron/version 2> /dev/null)
22-
23-
2420
# Get electron
25-
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
21+
node build/lib/electron.js || ./node_modules/.bin/gulp electron
2622

2723
export VSCODE_DEV=1
2824
if [[ "$OSTYPE" == "darwin"* ]]; then

0 commit comments

Comments
 (0)