Skip to content

Commit

Permalink
adopt yarn in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Nov 16, 2017
1 parent 5d4d385 commit 4537783
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 39 deletions.
2 changes: 1 addition & 1 deletion scripts/code-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title VSCode Dev
pushd %~dp0\..

:: Node modules
if not exist node_modules call .\scripts\npm.bat install
if not exist node_modules call yarn

for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
Expand Down
2 changes: 1 addition & 1 deletion scripts/code-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function code() {
INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null`

# Node modules
test -d node_modules || ./scripts/npm.sh install
test -d node_modules || yarn

# Get electron
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
Expand Down
2 changes: 1 addition & 1 deletion scripts/code.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title VSCode Dev
pushd %~dp0\..

:: Node modules
if not exist node_modules call .\scripts\npm.bat install
if not exist node_modules call yarn

for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
Expand Down
2 changes: 1 addition & 1 deletion scripts/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function code() {
INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null`

# Node modules
test -d node_modules || ./scripts/npm.sh install
test -d node_modules || yarn

# Get electron
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
Expand Down
8 changes: 1 addition & 7 deletions scripts/npm.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
@echo off
setlocal
set npm_config_disturl="https://atom.io/download/electron"
for /f "tokens=2 delims=:, " %%a in ('findstr /R /C:"\"electronVersion\":.*" "%~dp0..\package.json"') do set npm_config_target=%%~a
set npm_config_runtime="electron"
set npm_config_cache=~\.npm-electron
npm %*
endlocal
yarn %*
28 changes: 1 addition & 27 deletions scripts/npm.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
#!/bin/bash

if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname "$(dirname "$(realpath "$0")")")
npm_config_arch=x64
else
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")

# if [ -z $npm_config_arch ]; then
# npm_config_arch=$(node -p process.arch)
# echo "Warning: remember to set \$npm_config_arch to either x64 or ia32 to build the binaries for the right architecture. Picking '$npm_config_arch'."
# fi
fi

ELECTRON_VERSION=$(
cat "$ROOT"/package.json |
grep electronVersion |
sed -e 's/[[:space:]]*"electronVersion":[[:space:]]*"\([0-9.]*\)"\(,\)*/\1/'
)

ELECTRON_GYP_HOME=~/.electron-gyp
mkdir -p $ELECTRON_GYP_HOME

npm_config_disturl=https://atom.io/download/electron \
npm_config_target=$ELECTRON_VERSION \
npm_config_runtime=electron \
HOME=$ELECTRON_GYP_HOME \
npm $*
yarn $*
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
INSTALLED_VERSION=$(cat .build/electron/version 2> /dev/null)

# Node modules
test -d node_modules || ./scripts/npm.sh install
test -d node_modules || yarn

# Get electron
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
Expand Down

0 comments on commit 4537783

Please sign in to comment.