Skip to content

Commit

Permalink
Merge pull request #71 from joshjohanning/update-npm-package-script
Browse files Browse the repository at this point in the history
feat: write failed packages to log and continue
  • Loading branch information
joshjohanning committed Apr 1, 2024
2 parents e62d719 + 2996517 commit c266ce7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/migrate-npm-packages-between-github-instances.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# Example: ./migrate-npm-packages-between-github-instances.sh joshjohanning-org github.com joshjohanning-emu github.com
#
# Notes:
# - This script assumes that the target org's repo name is the same as the source
# - If the repo doesn't exist, the package will still import but won't be mapped to a repo
#
# - Mapping the npm package to a repo is optional.
# - If there is a repo that exists in the target with the same repo name, it will map it
# - If the repo doesn't exist, the package will still import but won't be mapped to a repo
# - See ./failed-packages.txt for any packages that failed to import

set -e

Expand Down Expand Up @@ -80,7 +81,7 @@ echo "$packages" | while IFS= read -r response; do
tar xzf $package_name-$version.tgz -C $package_name-$version
cd $package_name-$version/package
perl -pi -e "s/$SOURCE_ORG/$TARGET_ORG/ig" package.json
npm publish --userconfig $temp_dir/.npmrc
npm publish --userconfig $temp_dir/.npmrc || echo "skipped package due to failure: $package_name-$version.tgz" >> ./failed-packages.txt
cd ./../../

done
Expand Down

0 comments on commit c266ce7

Please sign in to comment.