|
| 1 | +# 🚀 Getting Started with App Migration |
| 2 | + |
| 3 | +Your first migration from marketplace-partner-apps to apps repository, step by step. |
| 4 | + |
| 5 | +## 📋 Before You Begin |
| 6 | + |
| 7 | +**Quick checklist** (5 minutes): |
| 8 | + |
| 9 | +- [ ] **Repository structure** - Verify you have: |
| 10 | + ``` |
| 11 | + your-projects-folder/ |
| 12 | + ├── apps/ # Target repository |
| 13 | + │ └── apps-migration-scripts/ # You are here |
| 14 | + └── marketplace-partner-apps/ # Source repository |
| 15 | + ``` |
| 16 | + |
| 17 | +- [ ] **Tools installed** - Quick check: |
| 18 | + ```bash |
| 19 | + node --version # Should be 16+ |
| 20 | + npm --version # Should be 8+ |
| 21 | + git --version # Any recent version |
| 22 | + jq --version # Any version |
| 23 | + ``` |
| 24 | + |
| 25 | +- [ ] **Repositories updated**: |
| 26 | + ```bash |
| 27 | + # Update both repos to latest |
| 28 | + cd ../../marketplace-partner-apps && git pull |
| 29 | + cd ../apps && git pull |
| 30 | + cd apps-migration-scripts |
| 31 | + ``` |
| 32 | + |
| 33 | +## 🎯 Your First Migration |
| 34 | + |
| 35 | +### Step 1: Choose an App |
| 36 | + |
| 37 | +See what's available: |
| 38 | +```bash |
| 39 | +./migration-summary.sh |
| 40 | +``` |
| 41 | + |
| 42 | +Pick an app that's **simple to start with** (avoid complex multi-service apps for your first try). |
| 43 | + |
| 44 | +### Step 2: Preview the Migration (Safe!) |
| 45 | + |
| 46 | +**Always start with a dry-run** - this shows you what will happen without making changes: |
| 47 | + |
| 48 | +```bash |
| 49 | +./migrate-app.sh <app-name> --dry-run |
| 50 | +``` |
| 51 | + |
| 52 | +**Example:** |
| 53 | +```bash |
| 54 | +./migrate-app.sh amplitude-experiment --dry-run |
| 55 | +``` |
| 56 | + |
| 57 | +**What to look for:** |
| 58 | +- ✅ No error messages |
| 59 | +- ✅ Files listed look reasonable |
| 60 | +- ✅ Package.json changes make sense |
| 61 | +- ✅ TypeScript config adaptations (if applicable) |
| 62 | +- ✅ Dependency updates look correct |
| 63 | + |
| 64 | +### Step 3: Run the Migration |
| 65 | + |
| 66 | +If the dry-run looked good: |
| 67 | + |
| 68 | +```bash |
| 69 | +./migrate-app.sh <app-name> |
| 70 | +``` |
| 71 | + |
| 72 | +**This will:** |
| 73 | +- Copy all app files |
| 74 | +- Adapt package.json for apps repository |
| 75 | +- Update dependencies |
| 76 | +- Add missing config files |
| 77 | +- Fix TypeScript configurations (if needed) |
| 78 | +- Add missing test imports (`vi` from `vitest`) |
| 79 | +- Run lerna bootstrap |
| 80 | + |
| 81 | +### Step 4: Validate Everything Works |
| 82 | + |
| 83 | +```bash |
| 84 | +./validate-migration.sh <app-name> |
| 85 | +``` |
| 86 | + |
| 87 | +**This tests:** |
| 88 | +- File structure is correct |
| 89 | +- Package.json is valid |
| 90 | +- Dependencies resolve (with security checks) |
| 91 | +- App builds successfully |
| 92 | +- Tests pass (with 60s timeout protection) |
| 93 | +- Linting works (if configured) |
| 94 | + |
| 95 | +**✨ Smart validation features:** |
| 96 | +- **Missing files** → Warnings + manual checklist (not failures) |
| 97 | +- **Test timeouts** → Graceful handling of watch mode |
| 98 | +- **Security issues** → Documented for follow-up (non-blocking) |
| 99 | +- **Outdated dependencies** → Listed for manual review |
| 100 | + |
| 101 | +**If validation has issues:** |
| 102 | +```bash |
| 103 | +# Check the detailed report |
| 104 | +cat reports/<app-name>-validation-report-*.md |
| 105 | + |
| 106 | +# For verbose debugging |
| 107 | +./validate-migration.sh <app-name> --detailed |
| 108 | +``` |
| 109 | + |
| 110 | +### Step 5: Manual Testing |
| 111 | + |
| 112 | +Test the migrated app: |
| 113 | + |
| 114 | +```bash |
| 115 | +# Navigate to the migrated app |
| 116 | +cd ../apps/<app-name> |
| 117 | + |
| 118 | +# Install dependencies (if not done automatically) |
| 119 | +npm install |
| 120 | + |
| 121 | +# Try to build |
| 122 | +npm run build |
| 123 | + |
| 124 | +# Try to start |
| 125 | +npm start |
| 126 | +``` |
| 127 | + |
| 128 | +**Test checklist:** |
| 129 | +- [ ] App builds without errors |
| 130 | +- [ ] App starts successfully |
| 131 | +- [ ] Basic functionality works |
| 132 | +- [ ] No obvious regressions |
| 133 | + |
| 134 | +### Step 6: Test in Contentful |
| 135 | + |
| 136 | +1. Upload the built app to a test Contentful space |
| 137 | +2. Test all major features |
| 138 | +3. Verify configurations work |
| 139 | +4. Check integrations function correctly |
| 140 | + |
| 141 | +### Step 7: Cleanup (Danger Zone!) |
| 142 | + |
| 143 | +**⚠️ Only after you're 100% confident everything works!** |
| 144 | + |
| 145 | +```bash |
| 146 | +# Return to migration scripts directory |
| 147 | +cd ../apps-migration-scripts |
| 148 | + |
| 149 | +# Preview what will be deleted |
| 150 | +./cleanup-migrated-app.sh <app-name> --dry-run |
| 151 | + |
| 152 | +# If you're sure, run the cleanup |
| 153 | +./cleanup-migrated-app.sh <app-name> |
| 154 | +``` |
| 155 | + |
| 156 | +**This will:** |
| 157 | +- Create a backup (just in case) |
| 158 | +- Remove app from marketplace-partner-apps |
| 159 | +- Update configuration files |
| 160 | +- Commit the changes |
| 161 | + |
| 162 | +## 🚨 What If Something Goes Wrong? |
| 163 | + |
| 164 | +### Migration Failed |
| 165 | + |
| 166 | +```bash |
| 167 | +# Check the logs |
| 168 | +cat logs/migration-*.log |
| 169 | + |
| 170 | +# Remove partial migration |
| 171 | +rm -rf ../apps/<app-name> |
| 172 | + |
| 173 | +# Try again with verbose logging |
| 174 | +./migrate-app.sh <app-name> --verbose |
| 175 | +``` |
| 176 | + |
| 177 | +### Validation Issues |
| 178 | + |
| 179 | +```bash |
| 180 | +# Check the validation report (most important!) |
| 181 | +cat reports/<app-name>-validation-report-*.md |
| 182 | + |
| 183 | +# Check manual action items that need your attention |
| 184 | +grep "Manual Action" reports/<app-name>-validation-report-*.md |
| 185 | + |
| 186 | +# For detailed debugging |
| 187 | +./validate-migration.sh <app-name> --detailed |
| 188 | + |
| 189 | +# Check specific issues in logs |
| 190 | +cat logs/<app-name>-validation-*.log |
| 191 | +``` |
| 192 | + |
| 193 | +**Note:** Modern validation is designed to be helpful, not blocking. Most "issues" are just items for your manual checklist! |
| 194 | + |
| 195 | +### Build Failed |
| 196 | + |
| 197 | +```bash |
| 198 | +cd ../apps/<app-name> |
| 199 | + |
| 200 | +# Clear everything and reinstall |
| 201 | +rm -rf node_modules package-lock.json |
| 202 | +npm install |
| 203 | + |
| 204 | +# Check for TypeScript errors |
| 205 | +npm run build |
| 206 | + |
| 207 | +# Check for missing dependencies |
| 208 | +npm audit |
| 209 | +``` |
| 210 | + |
| 211 | +### Need to Rollback After Cleanup |
| 212 | + |
| 213 | +```bash |
| 214 | +# Find the backup |
| 215 | +ls backups/marketplace-partner-apps-<app-name>-*.tar.gz |
| 216 | + |
| 217 | +# Restore it |
| 218 | +cd ../../marketplace-partner-apps/apps |
| 219 | +tar -xzf ../../apps/apps-migration-scripts/backups/marketplace-partner-apps-<app-name>-*.tar.gz |
| 220 | +cd .. && git add . && git commit -m "Restore <app-name>" |
| 221 | + |
| 222 | +# Remove from apps repo |
| 223 | +cd ../apps && rm -rf apps/<app-name> |
| 224 | +``` |
| 225 | + |
| 226 | +## 💡 Pro Tips |
| 227 | + |
| 228 | +### For Your First Migration |
| 229 | + |
| 230 | +1. **Pick a simple app** - avoid complex multi-service apps |
| 231 | +2. **Use dry-run extensively** - it's completely safe |
| 232 | +3. **Test thoroughly** - don't rush to cleanup |
| 233 | +4. **Read the reports** - they contain valuable info |
| 234 | + |
| 235 | +### Making It Smooth |
| 236 | + |
| 237 | +1. **Check prerequisites first** - saves debugging time |
| 238 | +2. **Update repos before starting** - avoids conflicts |
| 239 | +3. **One app at a time** - don't try to migrate multiple apps simultaneously |
| 240 | +4. **Keep backups** - cleanup creates them automatically |
| 241 | + |
| 242 | +### Getting Comfortable |
| 243 | + |
| 244 | +1. **Run validation twice** - it's fast and catches issues early |
| 245 | +2. **Test in a sandbox space** - don't use production for first attempts |
| 246 | +3. **Keep notes** - document any custom fixes needed |
| 247 | +4. **Ask for help** - use `<script> --help` for quick guidance |
| 248 | + |
| 249 | +## 🎯 What's Next? |
| 250 | + |
| 251 | +After your first successful migration: |
| 252 | + |
| 253 | +1. **Try more complex apps** - multi-service, custom configs, etc. |
| 254 | +2. **Batch migrations** - migrate several related apps |
| 255 | +3. **Customize the process** - see `TECHNICAL_REFERENCE.md` for advanced options |
| 256 | +4. **Share learnings** - help improve the scripts for others |
| 257 | + |
| 258 | +## 📚 More Resources |
| 259 | + |
| 260 | +- **Command reference**: `USAGE_GUIDE.md` - all commands and options |
| 261 | +- **Technical details**: `TECHNICAL_REFERENCE.md` - how things work internally |
| 262 | +- **Quick help**: `./migration-summary.sh` - commands and available apps |
| 263 | +- **Interactive guide**: `./getting-started.sh` - terminal-based tutorial |
| 264 | + |
| 265 | +--- |
| 266 | + |
| 267 | +**🎉 You're ready! Start with a simple app and take it step by step.** |
0 commit comments