Skip to content

Instantly share code, notes, and snippets.

@lukekarrys
Last active May 9, 2025 00:29
Show Gist options
  • Save lukekarrys/8a95e83414fe47d0a9a744477527b404 to your computer and use it in GitHub Desktop.
Save lukekarrys/8a95e83414fe47d0a9a744477527b404 to your computer and use it in GitHub Desktop.
node_modules/
package-lock.json
package.json
#!/bin/bash
echo "npm: v$(npm --version)"
ALIAS_COUNT=2
PACKAGES=(
firebase
@google-cloud/storage
aws-sdk
@mui/material
@prisma/client
puppeteer
babel-core
babel-preset-env
eslint
sharp
typescript
next
gatsby
@sveltejs/kit
astro
nuxt
express
hono
angular
angular-cli
esbuild
webpack
rollup
npm
yarn
pnpm
bun
deno
)
echo "Cleaning up..."
rm -rf package.json package-lock.json node_modules/
cat > package.json << 'EOF'
{
"name": "large-node-modules"
}
EOF
echo "Setting dependencies..."
for package in "${PACKAGES[@]}"; do
npm pkg set dependencies.$package="*"
for ((i=1; i<=ALIAS_COUNT; i++)); do
npm pkg set "dependencies.$package-$i=npm:$package@*"
done
done
echo "Installing dependencies..."
npm i --force --install-strategy=nested --loglevel=error
du -sh node_modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment