Skip to content

Instantly share code, notes, and snippets.

@jamiebuilds
Created February 5, 2016 22:11
Show Gist options
  • Save jamiebuilds/eba3a918a3db80ddc656 to your computer and use it in GitHub Desktop.
Save jamiebuilds/eba3a918a3db80ddc656 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
read -p "Username: " username
read -p "Are you sure you want to add $username to all packages (y/n)? " confirm
if [ "$confirm" != "y" ]; then
echo "Ok bye."
exit 0
fi
for f in packages/*; do
package=`basename $f`
if [ -d "$f" ] && [ -e "$f/package.json" ]; then
npm owner add $username $package
fi
done
echo "$username" >> NPM_OWNERS
echo "Success."
#!/bin/sh
set -e
read -p "Username: " username
read -p "Are you sure you want to remove $username from all packages (y/n)? " confirm
if [ "$confirm" != "y" ]; then
echo "Ok bye."
exit 0
fi
for f in packages/*; do
package=`basename $f`
if [ -d "$f" ] && [ -e "$f/package.json" ]; then
npm owner rm $username $package
fi
done
sed -i '' "/$username/d" NPM_OWNERS
echo "Success."
#!/bin/sh
set -e
cat NPM_OWNERS
read -p "Do you want to add the above owners to all packages (y/n)? " confirm
if [ "$confirm" != "y" ]; then
echo "Ok bye."
exit 0
fi
while read username
do
for f in packages/*; do
package=`basename $f`
if [ -d "$f" ] && [ -e "$f/package.json" ]; then
echo "Adding $username to $package."
npm owner add $username $package
fi
done
done < NPM_OWNERS
echo "Success."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment