agama/puppeteer/node-puppeteer-prune.sh
Ladislav Slezák 10d6157391
feat(puppeteer): Cleanup node_modules (#1497)
## Problem

- The Puppeteer `node_modules` directory is huge

## Solution

- Delete the not needed content from `node_modules`
- Inspired by [node-prune](https://github.com/tj/node-prune/) tool
(written in Go, not much suitable to run during RPM build, I rewrote
that to shell)

## Testing

- Tested manually

## Numbers

- The `node_modules` directory size went down from 39MB to 15MB (-62%)
- The built RPM size went down from 3.5MB to 1.9MB (-46%)
- I expect the Live ISO size reduction similar to the RPM reduction
2024-07-24 17:38:02 +02:00

9 lines
304 B
Bash
Executable file

#! /bin/sh
# This is a helper script which deletes some not needed files from NPM packages.
# This script is specific for Puppeteer installations.
MODULES_PATH="${1:-./node_modules}"
# delete Puppeteer CommonJS modules, we use the ES modules (in lib/esm)
rm -rf "$MODULES_PATH/puppeteer-core/lib/cjs"