Skip to content

Instantly share code, notes, and snippets.

@superhero
Created December 22, 2016 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superhero/679c01721c40c1d8a42b6ee6124cda3e to your computer and use it in GitHub Desktop.
Save superhero/679c01721c40c1d8a42b6ee6124cda3e to your computer and use it in GitHub Desktop.
run in root folder of multiple npm packages to publish them all with 1 command
#!/bin/bash
docker run \
-it \
--rm \
--volume /etc/localtime:/etc/localtime:ro \
--volume `pwd`/.npmrc:/root/.npmrc \ # notice the login credentials that needs to be mounted
--volume `pwd`:/app \
--workdir /app \
node /bin/bash -c "
for d in */ ; do
cd \$d
echo "\$d:"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
npm publish
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
cd ..
done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment