From 4537783742d7d535564ff423247a3d21c3e59942 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Thu, 16 Nov 2017 10:47:02 +0100 Subject: [PATCH] adopt yarn in scripts --- scripts/code-cli.bat | 2 +- scripts/code-cli.sh | 2 +- scripts/code.bat | 2 +- scripts/code.sh | 2 +- scripts/npm.bat | 8 +------- scripts/npm.sh | 28 +--------------------------- scripts/test.sh | 2 +- 7 files changed, 7 insertions(+), 39 deletions(-) diff --git a/scripts/code-cli.bat b/scripts/code-cli.bat index 20b308a82d7..d5e4f44b7d6 100644 --- a/scripts/code-cli.bat +++ b/scripts/code-cli.bat @@ -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: "=% diff --git a/scripts/code-cli.sh b/scripts/code-cli.sh index d04f7cced91..1995f490c41 100755 --- a/scripts/code-cli.sh +++ b/scripts/code-cli.sh @@ -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 diff --git a/scripts/code.bat b/scripts/code.bat index b35c50b3533..ca75c60acf5 100644 --- a/scripts/code.bat +++ b/scripts/code.bat @@ -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: "=% diff --git a/scripts/code.sh b/scripts/code.sh index 5faa7803344..70395aadfb6 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -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 diff --git a/scripts/npm.bat b/scripts/npm.bat index 3fc75df7b0e..51f4fdd139a 100644 --- a/scripts/npm.bat +++ b/scripts/npm.bat @@ -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 %* diff --git a/scripts/npm.sh b/scripts/npm.sh index 69c6d0c48ae..93562dd24d6 100755 --- a/scripts/npm.sh +++ b/scripts/npm.sh @@ -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 $* \ No newline at end of file +yarn $* \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index ce1e5e11856..43c515c205f 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -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