Skip to content

Instantly share code, notes, and snippets.

@jonashdown
Created January 10, 2022 11:18
Show Gist options
  • Save jonashdown/6f539cc57c614968c85d981bf5c01f84 to your computer and use it in GitHub Desktop.
Save jonashdown/6f539cc57c614968c85d981bf5c01f84 to your computer and use it in GitHub Desktop.
Lock a 3rd party lib across multiple repos
#! /bin/bash
# Assumptions: jq, and github cli are installed. One version of node/npm used across all repos
set -ex
touch faker.prs.txt
for f in $(find . -name package.json -depth 2 -exec grep -l "faker" {} + )
do
cd $(dirname $f)
git checkout -b lock_faker origin/master
git pull
cat package.json | jq '.devDependencies.faker = "5.5.3"' > tmp.json && mv tmp.json package.json
npm install && npm dedupe
git commit -am "lock faker.js"
git push
gh pr create --fill
gh pr list -H $(git branch --show-current) --json url -q '.[0].url'>> ../faker.prs.txt
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment