Version 0.0.6: All operations require authentication. Consider upgrading to 0.0.7+ for free single file conversions.
Basic Usage
Version 0.0.6 uses a simple command structure without subcommands:Examples
Basic Migration
Migrate to a new directory:In-Place Migration
Migrate in the same directory (be careful!):Preview Changes First
See what will change without making modifications:Automated Migration
Skip confirmations and install dependencies:Command Options
Path to your React application directory. Must contain a
package.json
file with React and React Router dependencies.Examples:./my-react-app
/path/to/react-project
../frontend
Directory where the new Next.js project will be created. If omitted, migration happens in-place in the source directory.Examples:
./my-next-app
/path/to/next-project
../next-frontend
Simulate the migration without making any actual changes. Shows you exactly what files will be created, modified, or removed.Example:Output includes:
- List of files to be converted
- New file structure
- Dependencies to be added/removed
- Configuration changes
Skip all confirmation prompts and proceed with migration automatically.Example:Use with caution - this will proceed without asking for confirmation.
Automatically install dependencies after migration completes.Example:Equivalent to running
npm install
in the target directory after migration.Show help information and exit.Example:
Show version information and exit.Example:
Migration Process
What Happens During Migration
1
Project Analysis
- Scans source directory for React components
- Identifies React Router usage patterns
- Analyzes component dependencies
- Checks for common React patterns
2
File Structure Creation
- Creates Next.js app directory structure
- Sets up layout.tsx and page.tsx files
- Organizes components appropriately
- Creates necessary configuration files
3
Code Transformation
- Converts React Router to Next.js navigation
- Adds ‘use client’ directives where needed
- Updates import statements
- Transforms routing logic
4
Configuration Setup
- Generates next.config.js
- Updates package.json with Next.js scripts
- Configures TypeScript (if used)
- Sets up ESLint and other tools
File Structure Transformation
Code Transformations
React Router Conversion
Package.json Updates
Error Handling
The migration command includes comprehensive error handling:Pre-Migration Validation
- Source directory exists and contains a valid React project
- Package.json validation - ensures React and React Router are present
- Write permissions checked for target directory
- Disk space verification
- Network connectivity to API endpoints
During Migration
- Syntax error detection - invalid components are reported
- Dependency conflicts - version mismatches are handled
- File permission issues - clear error messages
- API failures - network issues are reported with suggestions
Post-Migration Verification
- Generated code validation - ensures TypeScript/JavaScript is valid
- Dependency installation - verifies all packages install correctly
- Configuration testing - checks Next.js config is valid
Troubleshooting Common Issues
Authentication Failed
Authentication Failed
Problem: Cannot authenticate with APISolutions:
- Verify API key is correct from nextlovable.com
- Check network connectivity
- Try re-running
next-lovable auth
- Contact support if account issues persist
Source Directory Not Found
Source Directory Not Found
Problem: Error about source directory not existingSolutions:
- Check the path is correct:
ls -la ./my-react-app
- Use absolute paths if relative paths fail
- Ensure the directory contains a package.json file
- Verify you have read permissions
Target Directory Creation Failed
Target Directory Creation Failed
Problem: Cannot create target directorySolutions:
- Check write permissions in parent directory
- Ensure sufficient disk space
- Try using a different target location
- Run with elevated permissions if necessary
Migration Incomplete
Migration Incomplete
Problem: Migration stops partway throughSolutions:
- Check error messages for specific issues
- Ensure stable network connection
- Try migration without
--install
flag first - Run
--dry-run
to identify potential issues
Generated App Won't Start
Generated App Won't Start
Problem:
npm run dev
fails in migrated projectSolutions:- Run
npm install
to ensure dependencies - Check for TypeScript errors:
npx tsc --noEmit
- Clear Next.js cache:
rm -rf .next
- Review next.config.js for issues
Best Practices
Always Dry Run First
Use
--dry-run
to preview changes before applying themBackup Your Code
Commit to git or create a backup before migration
Test Incrementally
Test the migrated app thoroughly before deployment
Review Generated Code
Check the converted components for any needed adjustments
Migration Checklist
1
Pre-Migration
- Backup original project
- Verify authentication works
- Run dry-run to preview changes
- Check disk space and permissions
2
During Migration
- Monitor for error messages
- Ensure stable network connection
- Don’t interrupt the process
3
Post-Migration
- Install dependencies if not done automatically
- Test development server starts
- Verify all routes work correctly
- Check for TypeScript/linting errors
- Test build process
Upgrading to Version 0.0.7+
Consider upgrading for enhanced features:Free Conversions
Single file conversions without authentication
Better CLI
Subcommand structure with more options
Granular Control
Choose specific transformations to apply
Improved Performance
Faster processing and better error handling