Created
June 28, 2021 18:05
-
-
Save AlexAegis/7c0e93a614e08384e770d969aa34d9e6 to your computer and use it in GitHub Desktop.
Recursively pack all dependencies of an npm project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script will run npm pack on every dependency and dependencies of a dependency | |
# on 8 threads. It's useful if you want to then upload everything to a private registry. | |
mkdir packages | |
cd packages || exit 1 | |
# There is some unwanted garbage in the output of `npm ls` hence the inverted greps | |
npm ls --all --registry https://registry.npmjs.org 2> /dev/null | | |
grep -v deduped | | |
grep -v 'UNMET OPTIONAL DEPENDENCY' | | |
grep -v '__ngcc_entry_points__' | | |
sed 's/^.* //g' | | |
sort | | |
uniq | | |
xargs -P 8 npm pack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment