@appsweet-co/npm-carbon
Copy npm packages and all their versions from one registry to another
Based on goodeggs/npm-copy and dperuo/npm-carbon.
Use this command line tool to make a "carbon copy" of any npm package and all its published versions.
ESM vs CJS
We migrated to ESM starting in v2.0.0. Please use v1 if you need CommonJS modules.
Install
No installation needed. Use @appsweet-co/npm-carbon
directly from the command line.
Node
npx @appsweet-co/npm-carbon -s $SRC_URL -d $DEST_URL <OPTIONS>
Bun
bunx @appsweet-co/npm-carbon -s $SRC_URL -d $DEST_URL <OPTIONS>
Usage
Run --help
for a full list of options.
npx @appsweet-co/npm-carbon --help
Authenticate Using Auth Tokens
npx @appsweet-co/npm-carbon \
--src https://registry.npmjs.org \
--dest https://registry.npmjs.org \
--srcToken w7ikVizKsyP98uyBS6 \
--destToken JmNMqitWbnOex3py9A \
packageA [packageB...]
Authenticate Using Username, Password, and Email
npx @appsweet-co/npm-carbon \
--src https://registry.npmjs.org \
--srcUser helloworld \
--srcPassword https://registry.npmjs.org \
--srcEmail helloworld@company.com \
--dest https://registry.npmjs.org \
--destUser helloworld \
--destPassword gUbcneqpbxC8 \
--destEmail helloworld@company.com \
packageA [packageB...]
Specify a Version Range
By default, @appsweet-co/npm-carbon
copies all avaliable versions of the package. Use --range
to specify a subset of versions.
The --range
flag accepts any valid npm version range/
npx @appsweet-co/npm-carbon \
--range "~3.0.0 || 5.1.x" \
packageA [packageB...]
Modify Package Prefix
Modify the package prefix using the --srcprefix
and --destPrefix
flags.
npx @appsweet-co/npm-carbon \
--srcPrefix @company \
--destPrefix @company \
packageA [packageB...]
@foo/packageA
becomes just packageA
.
Contributing
Contributions, issues and feature requests are welcome! Feel free to check issues page.
Install
Clone this repo to your local machine and install dependencies.
git clone https://github.com/appsweet-co/npm-carbon.git
cd npm-carbon/
npm install
Usage
Use the start
command to compile TypeScript and watch for changes.
npm start
Run the local JavaScript file directly to check your changes.
node ./bin/index.js <OPTIONS>
Run Tests
Run the full test suite using the test
command.
npm run test
Submit Your Pull Request
Always submit your Pull Request against main
.