UNPKG

no-migration

Version:

CLI tool to manage migration changes and user changes separately for React Native miniapp projects

203 lines (144 loc) 4.39 kB
# nono-migration A CLI tool to manage migration changes and user changes separately for React Native miniapp projects. This tool helps you maintain clean git history by separating migration-generated changes from your manual code changes. ## Features - 🔄 **Smart Migration Management**: Automatically separates migration changes from user changes - 📦 **Git Integration**: Intelligent staging and committing with change separation - 🎯 **Exclude List**: Track files that should have migration changes excluded from commits - 📸 **Snapshot System**: Maintains snapshots of user and migration changes - 🚀 **Easy Updates**: Simple command to update migration tools ## Installation Install globally using npm: ```bash npm install -g nono-migration ``` Or using yarn: ```bash yarn global add nono-migration ``` ## Usage ### Initialize Migration Run this command when you want to start using the migration tool: ```bash nono migration # or nono start # or nono -m ``` This command will: 1. Snapshot your current changes to `user-changes.json` 2. Run `momo-migration` 3. Save migration changes to `migration-changes.json` 4. Create `.git-exclude-list` with files changed by migration 5. Add nono scripts to your `package.json` 6. Update ports from 8181 to 8182 if your package name is `vn.momo.profile` or `@momo-mini-app/profile` 7. Add tracking files to `.gitignore` ### Commit Changes Use this command instead of `git commit` to commit only your changes: ```bash nono commit -m "fix(chat): SC-1 your commit message" ``` With additional options: ```bash nono commit -m "fix(chat): SC-1 message" --amend nono commit --amend --no-edit ``` This command will: 1. Compare files in `.git-exclude-list` with snapshots in `migration-changes.json` 2. Stage only the differences (your changes) 3. Keep migration changes unstaged 4. Commit with your message 5. Preserve tracking files for next commit ### Update Migration Tools Update `@momo-platform/momo-migration` and `@momo-platform/momo-cli` to latest versions: ```bash nono update # or nono -u ``` ### Version Check the installed version: ```bash nono --version # or nono -v ``` ## How It Works ### Example Workflow **Step 1: Initial State** - You have a modified file: `src/api/profileApi.ts` **Step 2: Run Migration** ```bash nono migration ``` The tool will: - Save `src/api/profileApi.ts` to `user-changes.json` - Run `momo-migration` which modifies multiple files: - `package.json` - `.gitlab-ci.yml` - `app.json` - `babel.config.json` - And more... - Save these migration changes to `migration-changes.json` - Create `.git-exclude-list` with all migration-modified files **Step 3: Make More Changes** - Edit `package.json` (which is in `.git-exclude-list`) - Edit `src/components/AvatarProfile.tsx` (not in exclude list) Git status will show: - Staged: `package.json` - Unstaged: All migration files + your new changes **Step 4: Commit Your Changes** ```bash nono commit -m "fix(chat): SC-1 update profile logic" ``` The tool will: - Compare `package.json` with snapshot in `migration-changes.json` - Separate your changes (A) from migration changes (B) - Stage only your changes: `package.json` (A), `src/api/profileApi.ts`, `src/components/AvatarProfile.tsx` - Keep migration changes unstaged - Commit only your changes - Preserve tracking files for next commit ## File Structure After running `nono migration`, you'll have these tracking files: - **`migration-changes.json`**: Snapshot of all changes made by migration - **`user-changes.json`**: Snapshot of your changes before migration - **`.git-exclude-list`**: List of files to separate during commit These files are automatically added to `.gitignore`. ## Scripts in package.json The migration command adds these scripts: ```json { "scripts": { "nono:commit": "nono commit", "nono:migration": "nono migration", "nono:update": "nono update" } } ``` You can also use them via yarn/npm: ```bash yarn nono:commit -m "message" yarn nono:migration yarn nono:update ``` ## Development ### Build ```bash npm run build ``` ### Development Mode ```bash npm run dev ``` ### Local Testing ```bash npm link ``` Then you can use `nono` command globally in your terminal. ## Requirements - Node.js >= 14.0.0 - Git ## License MIT ## Author Built with ❤️ for React Native miniapp development teams.