Update all npm packages in multiple projects in subfolders
By Flavio Copes
Learn how to update npm packages across many projects in subfolders with a small bash script that loops each folder and runs npx ncu -u plus npm update.
~~~
I used this shell script:
#!/bin/bash
for dir in */; do
cd "$dir"
if [ -f package.json ]; then
rm -rf node_modules
npx ncu -u
npm update
fi
cd ..
done~~~
Related posts about cli: