Migrating from npm to CLI
Step-by-step guide to migrate from old npm packages to the new CLI-based components.Why Migrate?
The new CLI approach offers:- ✅ Full source code ownership
- ✅ Unlimited customization
- ✅ No
styleCallbackscomplexity - ✅ Direct code editing
- ✅ Better version control
- ✅ No black-box abstractions
Migration Steps
1
Install CLI Components (Side-by-Side)
First, install the CLI version alongside your existing npm package for testing:This creates components at
src/components/comments-threaded/ without removing your npm package.2
Update Imports
Change your import statements:Before (npm package):After (CLI component):
3
Remove styleCallbacks Prop
The CLI components don’t use After:
styleCallbacks. Remove that prop:Before:4
Apply Customizations in Source Files
Instead of See Mapping Guide for all callback-to-file mappings.
styleCallbacks, edit the source files directly.Example: If you had authorName styling, edit single-comment.tsx:5
Test Thoroughly
Test the CLI version alongside the npm version to ensure feature parity.
6
Uninstall Old Package
Once you’re confident, uninstall the npm package:
Complete Example
Before (npm package)
After (CLI component)
Benefits After Migration
| Before (npm) | After (CLI) |
|---|---|
Complex styleCallbacks object | Simple theme prop |
| Limited to exposed surfaces | Customize anything |
| Hidden in node_modules | Visible in your repo |
| Can’t modify layout | Edit JSX directly |
| Package updates may break | You control updates |
Common Issues
Missing customizations after migration
Missing customizations after migration
You need to manually apply your
styleCallbacks customizations to the source files.Use the Mapping Guide to find where each callback maps to.Different styling approach
Different styling approach
If you used Tailwind before but CLI installed inline styles (or vice versa), reconfigure:
Breaking changes in core SDK
Breaking changes in core SDK
The CLI components use the same core SDK (
@replyke/react-js). No breaking changes there.Only the component API changed (removed styleCallbacks).
