diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index c5d1d7eb1143b0..d4f7a5d68c858e 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -23,15 +23,6 @@ jobs: echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV ./update-eslint.sh fi - - id: "@babel/eslint-parser" - run: | - cd tools - NEW_VERSION=$(npm view @babel/eslint-parser dist-tags.latest) - CURRENT_VERSION=$(node -p "require('./node_modules/@babel/eslint-parser/package.json').version") - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./update-babel-eslint.sh - fi - id: "lint-md-dependencies" run: | cd tools/lint-md diff --git a/tools/update-babel-eslint.sh b/tools/update-babel-eslint.sh deleted file mode 100755 index fa6c0b0ee41546..00000000000000 --- a/tools/update-babel-eslint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Shell script to update babel-eslint in the source tree to the latest release. - -# This script must be be in the tools directory when it runs because it uses -# $0 to determine directories to work in. - -set -e - -cd "$( dirname "${0}" )" || exit -rm -rf node_modules/@babel -mkdir babel-eslint-tmp -cd babel-eslint-tmp || exit - -ROOT="$PWD/../.." -[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" -[ -x "$NODE" ] || NODE=`command -v node` -NPM="$ROOT/deps/npm/bin/npm-cli.js" - -"$NODE" "$NPM" init --yes -"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts --no-package-lock @babel/core @babel/eslint-parser @babel/plugin-syntax-import-assertions - -# Use dmn to remove some unneeded files. -"$NODE" "$NPM" exec -- dmn@2.2.2 -f clean -# Use removeNPMAbsolutePaths to remove unused data in package.json. -# This avoids churn as absolute paths can change from one dev to another. -"$NODE" "$NPM" exec -- removeNPMAbsolutePaths@1.0.4 . - -cd .. -mv babel-eslint-tmp/node_modules/@babel node_modules/@babel -rm -rf babel-eslint-tmp/ diff --git a/tools/update-eslint.sh b/tools/update-eslint.sh index 5f87680597fb18..137130148c282d 100755 --- a/tools/update-eslint.sh +++ b/tools/update-eslint.sh @@ -5,23 +5,24 @@ # This script must be in the tools directory when it runs because it uses the # script source file path to determine directories to work in. -set -e +set -ex cd "$( dirname "$0" )" || exit -rm -rf node_modules/eslint node_modules/eslint-plugin-markdown +rm -rf node_modules/eslint ( + rm -rf eslint-tmp mkdir eslint-tmp cd eslint-tmp || exit ROOT="$PWD/../.." [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" - [ -x "$NODE" ] || NODE=`command -v node` + [ -x "$NODE" ] || NODE=$(command -v node) NPM="$ROOT/deps/npm/bin/npm-cli.js" "$NODE" "$NPM" init --yes - "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts --no-package-lock eslint eslint-plugin-markdown - + "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts eslint + (cd node_modules/eslint && "$NODE" "$NPM" install --no-bin-links --ignore-scripts --production --omit=peer eslint-plugin-markdown @babel/core @babel/eslint-parser @babel/plugin-syntax-import-assertions) # Use dmn to remove some unneeded files. "$NODE" "$NPM" exec -- dmn@2.2.2 -f clean # Use removeNPMAbsolutePaths to remove unused data in package.json. @@ -30,5 +31,4 @@ rm -rf node_modules/eslint node_modules/eslint-plugin-markdown ) mv eslint-tmp/node_modules/eslint node_modules/eslint -mv eslint-tmp/node_modules/eslint-plugin-markdown node_modules/eslint-plugin-markdown rm -rf eslint-tmp/