mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Implemented npm version check (#314)
This commit is contained in:
committed by
Matt Irvine
parent
0eb81c9360
commit
96f9183700
@@ -1,4 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
SET SUPPORTEDNPMVERSION=4.2.0
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
set npm_config_disturl="https://atom.io/download/electron"
|
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
|
for /f "tokens=2 delims=:, " %%a in ('findstr /R /C:"\"electronVersion\":.*" "%~dp0..\package.json"') do set npm_config_target=%%~a
|
||||||
@@ -6,3 +8,11 @@ set npm_config_runtime="electron"
|
|||||||
set npm_config_cache=~\.npm-electron
|
set npm_config_cache=~\.npm-electron
|
||||||
npm %*
|
npm %*
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
|
for /F "tokens=* USEBACKQ" %%V IN (`npm --version`) do (
|
||||||
|
set CURRENTNPMVERSION=%%V
|
||||||
|
)
|
||||||
|
if not %CURRENTNPMVERSION%==%SUPPORTEDNPMVERSION% (
|
||||||
|
color 0e
|
||||||
|
echo NPM version %CURRENTNPMVERSION% is not supported with this project. We strongly recommend to use version %SUPPORTEDNPMVERSION%
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
SUPPORTEDNPMVERSION="4.2.0"
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||||
@@ -8,7 +9,7 @@ else
|
|||||||
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
|
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
|
||||||
|
|
||||||
# if [ -z $npm_config_arch ]; then
|
# if [ -z $npm_config_arch ]; then
|
||||||
# npm_config_arch=$(node -p process.arch)
|
# npm_config_arch=$(npm -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'."
|
# 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
|
||||||
fi
|
fi
|
||||||
@@ -27,3 +28,9 @@ npm_config_target=$ELECTRON_VERSION \
|
|||||||
npm_config_runtime=electron \
|
npm_config_runtime=electron \
|
||||||
HOME=$ELECTRON_GYP_HOME \
|
HOME=$ELECTRON_GYP_HOME \
|
||||||
npm $*
|
npm $*
|
||||||
|
|
||||||
|
CURRENTNPMVERSION=`npm --version`
|
||||||
|
if [[ "$CURRENTNPMVERSION" != "$SUPPORTEDNPMVERSION" ]]; then
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
echo -e "${YELLOW}NPM version ${CURRENTNPMVERSION} is not supported with this project. We strongly recommend to use version ${SUPPORTEDNPMVERSION}"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user