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: fix ESLint upgrade automation #45974

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/tools.yml
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/deps-updater/update-eslint.sh
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
fi
- id: corepack
subsystem: deps
Expand Down
19 changes: 13 additions & 6 deletions tools/update-eslint.sh → tools/dep_updaters/update-eslint.sh
Expand Up @@ -8,30 +8,37 @@
set -ex

cd "$( dirname "$0" )" || exit
rm -rf node_modules/eslint
rm -rf ../node_modules/eslint
(
rm -rf eslint-tmp
mkdir eslint-tmp
cd eslint-tmp || exit

ROOT="$PWD/../.."
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 eslint
"$NODE" "$NPM" install --install-strategy=shallow --no-bin-links --ignore-scripts eslint
# Uninstall plugins that we want to install so that they are removed from devDependencies.
# Otherwise --production will cause them to be skipped.
(cd node_modules/eslint && "$NODE" "$NPM" uninstall --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 --no-save --no-bin-links --ignore-scripts --production --omit=peer eslint-plugin-jsdoc eslint-plugin-markdown @babel/core @babel/eslint-parser @babel/plugin-syntax-import-assertions)
(cd node_modules/eslint && "$NODE" "$NPM" uninstall --ignore-scripts \
eslint eslint-config-eslint eslint-plugin-internal-rules eslint-plugin-jsdoc \
eslint-plugin-markdown @babel/core @babel/eslint-parser \
@babel/plugin-syntax-import-assertions)
(cd node_modules/eslint && "$NODE" "$NPM" install --no-save --no-bin-links \
--ignore-scripts --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.
mkdir -p "$ROOT/out/lib"
"$NODE" "$NPM" exec -- dmn@2.2.2 -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
mv eslint-tmp/node_modules/eslint ../node_modules/eslint
rm -rf eslint-tmp/