Skip to content

Instantly share code, notes, and snippets.

@mcollina
Created August 12, 2022 22:22
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcollina/ba08a2e941e37a48a6f496e26f498607 to your computer and use it in GitHub Desktop.
Save mcollina/ba08a2e941e37a48a6f496e26f498607 to your computer and use it in GitHub Desktop.
npm workspace publish
#!/bin/sh
VERSION=$1
MODULES=`node -e "console.log(require('./package.json').workspaces.join(' '))"`
for MODULE in $MODULES; do
echo "Building $MODULE"
pushd $MODULE
npm version $VERSION --save
NAME=`node -e "console.log(require('./package.json').name)"`
echo $NAME
popd
npm publish --workspace $MODULE
npm i --workspaces --save $NAME
done
rm -rf node_modules
rm -rf packages/*/node_modules
npm i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment