From 6edf3cb03a22a3f07652f5a2790989cf04ebb85e Mon Sep 17 00:00:00 2001 From: Kevin van Rijn <6368561+kevinvanrijn@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:48:17 +0200 Subject: [PATCH] Update actions-npm.sh --- docs/tools/actions-npm.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/tools/actions-npm.sh b/docs/tools/actions-npm.sh index 5473cb4769..a977aac68e 100755 --- a/docs/tools/actions-npm.sh +++ b/docs/tools/actions-npm.sh @@ -25,12 +25,13 @@ git checkout -- 'package.json' # Remove unnecessary files find node_modules/ -mindepth 2 -type d \( -name '.github' -o -name 'docs' -o -name 'example' -o -name 'examples' -o -name 'jsdoc-toolkit' -o -name 'man' -o -name 'tap-snapshots' -o -name 'test' -o -name 'tests' -o -name 'typings' \) | xargs rm -rf find node_modules/ -mindepth 2 -type f \( -name '*.d.ts' -o -name '*.d.ts.map' -o -name '*.js.map' -o -name '.editorconfig' -o -name '.eslintignore' -o -name '.eslintrc' -o -name '.eslintrc.json' -o -name '.eslintrc.yml' -o -name '.gitattributes' -o -name '.gitmodules' -o -name '.licensee.json' -o -name '.mailmap' -o -name '.npmignore' -o -name '.nycrc' -o -name '.project' -o -name '.runkit_example.js' -o -name '.travis.yml' -o -name 'configure' -o -name 'Jenkinsfile' -o -name 'make.bat' -o -name 'Makefile' -o -name 'tsconfig.json' -o -name 'yarn.lock' \) -exec bash -c 'rm "$1"; rmdir --ignore-fail-on-non-empty $(dirname "$1")' bash '{}' ';' -rmdir 'node_modules/electron-chrome-extensions/dist/browser' || true +rmdir 'node_modules/electron-chrome-extensions/dist/browser' 2>/dev/null || true # Remove non-deterministic information find node_modules/ -mindepth 2 -type f -name 'package.json' -exec sed -i '/"_where": "/d' -- '{}' ';' find node_modules/ -mindepth 2 -type f -name 'package.json' -exec sed -i '/"man": \[/,/\],/d' -- '{}' ';' -# Fail if npm dependencies have leaked +# Fail if npm dependencies end up in the top level node_modules if [[ -d 'node_modules/@npmcli' ]]; then + echo "Bundled npm dependencies found outside of npm" exit 1 fi # Execution continues in .github/workflows/npm.yml or docs/tools/actions-artifacts.sh ...