Skip to content

Instantly share code, notes, and snippets.

@ChunAllen
Created June 1, 2020 07:59
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 ChunAllen/e928b057d66bb92f227675f130b83952 to your computer and use it in GitHub Desktop.
Save ChunAllen/e928b057d66bb92f227675f130b83952 to your computer and use it in GitHub Desktop.
Uploading to npm packages to private registry
  1. Download all packages normally from npm or yarn
  2. Install https://www.npmjs.com/package/node-tgz-downloader to download all the tarballs associated your package-lock.json
  3. Command is download-tgz package-lock package-lock.json this will generate a tarballs/ in the root of your project
  4. Upload the tgz to your private registry by defining first the .npmrc
  5. Run the script ./npmimport.sh to upload all the tarballs
#!/bin/bash
# Need to do this if you don't have npmrc
# REPOSITORY=http://your-private-registry
# npm login --registry=$REPOSITORY
PACKAGES_PATH=tarballs/
for package in $PACKAGES_PATH/*/*/*.tgz; do
npm publish --registory=REPOSITORY $package
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment