Import files from a folder
How to a bulk import of packages into Cloudsmith in a folder
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 packages in the correct format can be published to Cloudsmith using the script below. We support over 28+ format types. The supported formats can be found here.
Create the bash script below and call it migrate_npm_to_cs.sh and give it execute privileges.
cd into the folder.
#!/bin/bash
FILES="."
for f in *
do
echo "Processing $f file..."
cloudsmith push "$1" "$2" $f
doneIf your packages are organized into nested folders (subdirectories), the script above won’t process them by default. You can use the following version of the script to handle this situation.
#!/bin/bash
FILES=$(find . -type f)
for f in $FILES
do
echo "Processing $f file..."
cloudsmith push "$1" "$2" "$f"
doneExecute the migrate_npm_to_cs.sh file passing the format type and the path of <CLOUDSMITH_ORG>/<CLOUDSMITH_REPO>:
./migrate_npm_to_cs.sh python cloudsmith_org/cloudsmith_repoUpdated about 2 months ago
