A simple shell script to convert existing NPM-installed modules to PNPM modules
NPM results in a lot of modules being repeatedly installed on the machine, whereas PNPM caches them locally, saving space for pointless duplicates
source convert_to_pnpm.sh
convert_to_pnpm $PATH_TO_ROOT_FOLDER
convert_to_pnpm will use find to iterate over all the subfolders under $PATH_TO_ROOT_FOLDER, finding any node_modules folders without a pnpm-lock.yaml, and then it will:
- Delete the
node_modulesfolder, and - Run
pnpm installin the parent folder.
If the parent folder contains node_modules but doesn't have a package.json, convert_to_pnpm will skip that folder and print a warning.
(C) Nathan Scott 2020, released under the standard terms of the MIT Licence