From 2f2551894049785d48cba027608724e3f321354a Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Wed, 4 Jan 2023 09:52:50 +0100 Subject: [PATCH] tools: make update-eslint.sh work with npm@9 Make the `update-eslint.sh` script work with `npm@9`. PR-URL: https://github.com/nodejs/node/pull/46088 Refs: https://github.com/nodejs/node/actions/runs/3814364920/jobs/6488613583#step:3:64 Reviewed-By: Ruy Adorno Reviewed-By: Antoine du Hamel --- tools/update-eslint.sh | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/tools/update-eslint.sh b/tools/update-eslint.sh index 579b63921e1fd5..865ea5a7ece279 100755 --- a/tools/update-eslint.sh +++ b/tools/update-eslint.sh @@ -21,13 +21,41 @@ rm -rf node_modules/eslint "$NODE" "$NPM" init --yes - "$NODE" "$NPM" install --global-style --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) + "$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 -- dmn@2.2.2 -f clean + "$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 {} \;