vega-multi-tv-migration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vega Multi-Platform Migration

Vega多平台迁移

Overview

概述

Migrate Vega OS (Fire TV) apps to multi-platform React Native monorepo with 70-85% code reuse across Android TV, Apple TV, and Vega OS.
将Vega OS(Fire TV)应用迁移至多平台React Native monorepo,在Android TV、Apple TV和Vega OS之间实现70-85%的代码复用。

When to Apply

适用场景

Use this skill when user mentions:
  • Migrating Vega/Fire TV app to other platforms
  • Building multi-platform TV application
  • Converting single-platform TV app to monorepo
  • Adding Android TV or Apple TV support
  • Sharing code between TV platforms
  • Setting up Yarn workspaces for TV apps
当用户提及以下需求时,可使用该技能:
  • 将Vega/Fire TV应用迁移至其他平台
  • 构建多平台TV应用
  • 将单平台TV应用转换为monorepo
  • 添加Android TV或Apple TV支持
  • 在TV平台间共享代码
  • 为TV应用搭建Yarn工作区

Phase Priority Guide

阶段优先级指南

PriorityPhaseImpactWhen to Use
1AnalysisCRITICALStarting migration, no existing analysis
2ImplementationCRITICALHave analysis, need monorepo structure
3Platform SupportHIGHHave working Vega monorepo, adding platforms
4ConfigurationMEDIUMTroubleshooting build/resolution issues
优先级阶段影响程度适用场景
1分析关键启动迁移项目,尚无现有分析成果
2实现关键已有分析成果,需搭建monorepo结构
3平台支持已有可用的Vega monorepo,需新增平台支持
4配置排查构建/依赖解析问题

Quick Decision Tree

快速决策树

User has existing Vega app?
├─ YES → Do they have migration analysis?
│  ├─ NO → Start Phase 1 (Analysis)
│  └─ YES → Is monorepo set up?
│     ├─ NO → Start Phase 2 (Implementation)
│     └─ YES → Start Phase 3 (Platform Support)
└─ NO → Starting from scratch?
   └─ YES → Skip Phase 1, start Phase 2 with new project
User has existing Vega app?
├─ YES → Do they have migration analysis?
│  ├─ NO → Start Phase 1 (Analysis)
│  └─ YES → Is monorepo set up?
│     ├─ NO → Start Phase 2 (Implementation)
│     └─ YES → Start Phase 3 (Platform Support)
└─ NO → Starting from scratch?
   └─ YES → Skip Phase 1, start Phase 2 with new project

Quick Reference

快速参考

Critical: Project Structure

关键:项目结构

bash
undefined
bash
undefined

Verify monorepo structure exists

Verify monorepo structure exists

ls -la packages/shared packages/vega packages/expotv
ls -la packages/shared packages/vega packages/expotv

Check Yarn workspaces configured

Check Yarn workspaces configured

grep -A5 "workspaces:" package.json
undefined
grep -A5 "workspaces:" package.json
undefined

Critical: Dependency Classification

关键:依赖分类

Common patterns for analysis:
  • Shared: Business logic, UI components, utilities, state management
  • Platform-specific: Navigation, video players, DRM, native modules
  • VMRP-compatible: Standard RN libraries that map to Vega equivalents
分析阶段的常见模式:
  • 共享模块:业务逻辑、UI组件、工具函数、状态管理
  • 平台专属模块:导航、视频播放器、DRM、原生模块
  • VMRP兼容模块:可映射为Vega等效模块的标准RN库

High: VMRP Configuration

高优先级:VMRP配置

Quick check if VMRP is working:
bash
undefined
快速检查VMRP是否正常工作:
bash
undefined

Should see @vega-tv/react-native-module-resolver-preset

Should see @vega-tv/react-native-module-resolver-preset

grep "vmrp" packages/vega/babel.config.js
undefined
grep "vmrp" packages/vega/babel.config.js
undefined

References

参考文档

Phase 1: Analysis (analysis-*)

阶段1:分析(analysis-*)

FileImpactDescription
PHASE1_ANALYSIS.mdCRITICALCodebase analysis, dependency classification, migration planning
Use when: Starting migration, no existing analysis document
文件影响程度描述
PHASE1_ANALYSIS.md关键代码库分析、依赖分类、迁移规划
适用场景:启动迁移项目,尚无现有分析文档

Phase 2: Implementation (impl-*)

阶段2:实现(impl-*)

FileImpactDescription
PHASE2_IMPLEMENTATION.mdCRITICALMonorepo scaffolding, code migration, VMRP setup with template references
Use when: Have analysis, ready to build monorepo structure
文件影响程度描述
PHASE2_IMPLEMENTATION.md关键Monorepo脚手架搭建、代码迁移、带模板参考的VMRP配置
适用场景:已有分析成果,准备构建monorepo结构

Phase 3: Platform Support (platform-*)

阶段3:平台支持(platform-*)

FileImpactDescription
PHASE3_PLATFORM_SUPPORT.mdHIGHAndroid TV and Apple TV implementation
Use when: Have working Vega monorepo, adding new platforms
文件影响程度描述
PHASE3_PLATFORM_SUPPORT.mdAndroid TV和Apple TV的实现
适用场景:已有可用的Vega monorepo,需新增平台支持

Templates

模板

All configuration templates in assets/templates/ with companion
.md
docs:
  • root-package.json
    - Yarn workspaces setup
  • root-tsconfig.json
    - TypeScript project references
  • yarnrc.yml
    - Dependency deduplication (CRITICAL)
  • shared-package.json
    +
    .md
    - Shared package config with rules
  • vega-metro.config.js
    - Vega Metro with monorepo resolution
  • expotv-package.json
    +
    .md
    - Expo TV package config
  • expotv-app.json
    +
    .md
    - Expo TV configuration with plugins
  • expotv-metro.config.js
    - Expo Metro with TV extensions
所有配置模板位于assets/templates/,并配有对应的
.md
文档:
  • root-package.json
    - Yarn工作区配置
  • root-tsconfig.json
    - TypeScript项目引用配置
  • yarnrc.yml
    - 依赖去重(关键)
  • shared-package.json
    +
    .md
    - 共享包配置及规则
  • vega-metro.config.js
    - 支持monorepo解析的Vega Metro配置
  • expotv-package.json
    +
    .md
    - Expo TV包配置
  • expotv-app.json
    +
    .md
    - 带插件的Expo TV配置
  • expotv-metro.config.js
    - 带TV扩展的Expo Metro配置

Problem → Skill Mapping

问题→技能映射

ProblemStart With
Need to analyze existing Vega appPHASE1_ANALYSIS.md
Have analysis, need monorepo setupPHASE2_IMPLEMENTATION.md → templates
Monorepo exists, adding Android TVPHASE3_PLATFORM_SUPPORT.md
Metro resolution errorsPHASE2_IMPLEMENTATION.md → Metro config
Duplicate React versionsPHASE2_IMPLEMENTATION.md → .yarnrc.yml
VMRP not mapping importsPHASE2_IMPLEMENTATION.md → VMRP section
TypeScript path errorsPHASE2_IMPLEMENTATION.md → TypeScript config
Native module integrationPHASE3_PLATFORM_SUPPORT.md → Native Modules
Build configuration issuesPHASE2_IMPLEMENTATION.md → Configuration Files
Starting from scratchPHASE2_IMPLEMENTATION.md (skip Phase 1)
问题起始阶段
需要分析现有Vega应用PHASE1_ANALYSIS.md
已有分析成果,需搭建monorepoPHASE2_IMPLEMENTATION.md → 模板
已有monorepo,需添加Android TV支持PHASE3_PLATFORM_SUPPORT.md
Metro解析错误PHASE2_IMPLEMENTATION.md → Metro配置
React版本重复PHASE2_IMPLEMENTATION.md → .yarnrc.yml
VMRP未映射导入路径PHASE2_IMPLEMENTATION.md → VMRP章节
TypeScript路径错误PHASE2_IMPLEMENTATION.md → TypeScript配置
原生模块集成PHASE3_PLATFORM_SUPPORT.md → 原生模块
构建配置问题PHASE2_IMPLEMENTATION.md → 配置文件
从零开始构建PHASE2_IMPLEMENTATION.md(跳过阶段1)

Workflow

工作流程

  1. Use the decision tree above to determine the starting phase
  2. Load the appropriate reference file for that phase
  3. Follow Quick Start → Deep Dive pattern in each reference
  4. Verify at each phase's checkpoint before moving to the next phase
  5. Use VALIDATION_CHECKLIST.md for comprehensive verification
  1. 使用上述决策树确定起始阶段
  2. 加载对应阶段的参考文档
  3. 遵循各参考文档中的「快速开始→深入探索」模式
  4. 在进入下一阶段前,完成当前阶段的检查点验证
  5. 使用VALIDATION_CHECKLIST.md进行全面验证

Attribution

说明

Based on Vega OS multi-platform migration patterns and React Native monorepo best practices.
基于Vega OS多平台迁移模式及React Native monorepo最佳实践。