Import npm

How to bulk import npm packages into Cloudsmith

Bulk Import

Once you have exported all your npm packages you can upload them to Cloudsmith- yay!

First make sure you install the Cloudsmith CLI and export your token.

A folder of npm packages, in the .tgz format, can be published to Cloudsmith using the script below.
Create the bash script below and call it migrate_npm_to_cs.sh and give it execute privileges

#!/bin/bash
FILES="."
for f in "$2/"*.tgz
do
  echo "Processing $f file..."
  cloudsmith push npm "$1" $f
done

Execute the migrate_npm_to_cs.sh file passing the path of <CLOUDSMITH_ORG>/<CLOUDSMITH_REPO> and <DIR_PATH_TO_DOWNLOADED_NPM_PACKAGES>

./migrate_npm_to_cs.sh cloudsmith_org/cloudsmith_repo <DIR_PATH_TO_DOWNLOADED_NPM_PACKAGES>

Did this page help you?