Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: make update-eslint.sh work with npm@9 #46088

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
subsystem: tools
label: tools
run: |
cd tools
NEW_VERSION=$(npm view eslint dist-tags.latest)
CURRENT_VERSION=$(node -p "require('./node_modules/eslint/package.json').version")
CURRENT_VERSION=$(node -p "require('./tools/node_modules/eslint/package.json').version")
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./update-eslint.sh
./tools/dep_updaters/update-eslint.sh
fi
- id: corepack
subsystem: deps
Expand Down
65 changes: 65 additions & 0 deletions tools/dep_updaters/update-eslint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh

# Shell script to update ESLint in the source tree to the latest release.

# 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 -ex

cd "$( dirname "$0" )" || exit
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)
NPM="$ROOT/deps/npm/bin/npm-cli.js"

"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install \
--ignore-scripts \
--install-strategy=shallow \
--no-bin-links \
eslint
# Uninstall plugins that we want to install so that they are removed from
# devDependencies. Otherwise --omit=dev will cause them to be skipped.
(
cd node_modules/eslint
"$NODE" "$NPM" uninstall \
--install-links=false \
--ignore-scripts \
eslint-plugin-jsdoc \
eslint-plugin-markdown \
@babel/core \
@babel/eslint-parser \
@babel/plugin-syntax-import-assertions
)
(
cd node_modules/eslint
"$NODE" "$NPM" install \
--ignore-scripts \
--install-links=false \
--no-bin-links \
--no-save \
--omit=dev \
--omit=peer \
eslint-plugin-jsdoc \
eslint-plugin-markdown \
@babel/core \
@babel/eslint-parser \
@babel/plugin-syntax-import-assertions
)
# Use dmn to remove some unneeded files.
"$NODE" "$NPM" exec --package=dmn@2.2.2 --yes -- dmn -f clean
# TODO: Get this into dmn.
find node_modules -name .package-lock.json -exec rm {} \;
find node_modules -name 'README*' -exec rm {} \;
)

mv eslint-tmp/node_modules/eslint ../node_modules/eslint
rm -rf eslint-tmp/
37 changes: 0 additions & 37 deletions tools/update-eslint.sh

This file was deleted.