Skip to content

Latest commit

 

History

History
218 lines (166 loc) · 6.83 KB

LEGACY_REMOVAL.md

File metadata and controls

218 lines (166 loc) · 6.83 KB

Removing Legacy Support Checklist

This document details all directories, files, configurations, and dependencies to remove or clean up when dropping legacy API support (react-native-executorch/legacy and 0.10.0-legacy) from the repository.

Every legacy touchpoint in the codebase is demarcated with // === LEGACY SUPPORT === or # === LEGACY SUPPORT ===.


1. Packages & Directories to Delete

Example Apps

  • Delete apps/legacy/ completely:
    rm -rf apps/legacy

Library Legacy Code

  • Delete packages/react-native-executorch/legacy/ completely:
    rm -rf packages/react-native-executorch/legacy

Obsolete Resource Fetcher Packages

In the rewrite, resource fetching/caching was moved directly into core (packages/react-native-executorch/src/fetcher/). The standalone fetcher packages only exist to support the legacy example apps and can be completely removed:

  • Delete packages/expo-resource-fetcher/ completely:
    rm -rf packages/expo-resource-fetcher
  • Delete packages/bare-resource-fetcher/ completely:
    rm -rf packages/bare-resource-fetcher

Documentation

  • Delete legacy versioned docs and sidebars:
    rm -rf docs/versioned_docs/version-0.10.0-legacy
    rm -rf docs/versioned_sidebars/version-0.10.0-legacy-sidebars.json
  • In docs/versions.json, remove "0.10.0-legacy".
  • In docs/docusaurus.config.js, remove:
    • lastVersion: 'current' (or revert to standard versioning)
    • '0.10.0-legacy' entry and comment under versions
    • The current label override if no longer needed
  • In docs/docs/01-fundamentals/03-migrating-from-v0-9.md, remove the legacy migration path Option A and link to 0.10.0-legacy.
  • In .gitattributes, remove **/legacy/** linguist-vendored and docs/versioned_docs/version-0.10.0-legacy/** linguist-vendored if present.

2. Files to Delete

  • packages/react-native-executorch/src/native/NativeETInstaller.ts
  • packages/react-native-executorch/android/src/main/java/com/swmansion/rnexecutorch/ETInstaller.kt
  • packages/react-native-executorch/android/src/main/java/com/swmansion/rnexecutorch/ETInstallerUnavailable.kt

3. Configuration Edits

Root package.json

  • Under "workspaces" -> "packages", remove:
    • "apps/legacy/*"
    • "// === LEGACY SUPPORT: workspaces ==="

Root .gitignore

  • Remove the # === LEGACY SUPPORT === section:
    apps/legacy/*/ios/
    apps/legacy/*/android/
    !apps/legacy/bare-rn/ios/
    !apps/legacy/bare-rn/android/

Root .eslintrc.js

  • Remove the overrides block targeting "packages/react-native-executorch/legacy/**/*" and "apps/legacy/**/*".

packages/react-native-executorch/package.json

  • In "exports", remove:
    • "./legacy": { ... }
    • "// === LEGACY SUPPORT: exports ==="
  • In "files", remove:
    • "legacy"
    • "!legacy/cpp/**/tests"
    • "// === LEGACY SUPPORT: files ==="
  • In "scripts", change "prepare" from:
    "prepare": "bob build && tsc -p legacy/tsconfig.json"
    to:
    "prepare": "bob build"
    and remove "// === LEGACY SUPPORT: prepare script ===".
  • In "dependencies", remove legacy-only dependencies:
    • "jsonrepair"
    • "jsonschema"
    • "react-native-device-info"
    • "zod"
    • "// === LEGACY SUPPORT: dependencies ==="
  • In "peerDependencies" and "peerDependenciesMeta", remove:
    • "@kesha-antonov/react-native-background-downloader"
    • "// === LEGACY SUPPORT: peerDependencies ==="

packages/react-native-executorch/tsconfig.json

  • Re-enable verbatimModuleSyntax: true (or remove verbatimModuleSyntax: false).

packages/react-native-executorch/tsconfig.build.json

  • In "exclude", remove "legacy".

packages/react-native-executorch/react-native-executorch.podspec

  • Remove the # === LEGACY SUPPORT === source files block:
    source_files += [
      "legacy/ios/**/*.{h,m,mm}",
      "legacy/cpp/**/*.{cpp,c,h,hpp}",
    ]
  • Remove the # === LEGACY SUPPORT === exclusion block:
    exclude_files += [
      "legacy/cpp/rnexecutorch/tests/**/*",
      "legacy/cpp/rnexecutorch/jsi/*.{h,hpp}",
    ]
    s.preserve_paths = "legacy/cpp/rnexecutorch/jsi/*.{h,hpp}"
  • Remove the # === LEGACY SUPPORT === header search path:
    "\"$(PODS_TARGET_SRCROOT)/legacy/cpp\"",

packages/react-native-executorch/android/CMakeLists.txt

  • Remove directory definitions:
    set(LEGACY_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../legacy/cpp")
    set(LEGACY_ANDROID_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../legacy/android")
  • Remove find_package(fbjni REQUIRED CONFIG).
  • Remove file(GLOB_RECURSE LEGACY_CPP_SOURCES ...).
  • Remove list(APPEND RNE_SOURCES ${LEGACY_CPP_SOURCES} ${LEGACY_ANDROID_DIR}/ETInstallerModule.cpp).
  • Remove ${LEGACY_CPP_DIR} and ${LEGACY_ANDROID_DIR} from target_include_directories.
  • In target_link_libraries, remove:
    ReactAndroid::reactnative
    fbjni::fbjni
    android

packages/react-native-executorch/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt

  • In getModule, remove the ETInstaller.NAME -> { ... } case.
  • In getReactModuleInfoProvider, remove the ETInstaller.NAME to ReactModuleInfo(...) entry.

4. Git Diff Verification Against rne-rewrite

Once the legacy support code and configurations have been removed, run a git diff against the rne-rewrite branch. These modified configuration and build files should be identical to rne-rewrite (i.e. produce zero diff):

# Verify modified configuration/build files are identical to rne-rewrite (must return 0 diff):
git diff --exit-code origin/rne-rewrite -- \
  package.json \
  .gitignore \
  .eslintrc.js \
  packages/react-native-executorch/package.json \
  packages/react-native-executorch/tsconfig.json \
  packages/react-native-executorch/tsconfig.build.json \
  packages/react-native-executorch/react-native-executorch.podspec \
  packages/react-native-executorch/android/CMakeLists.txt \
  packages/react-native-executorch/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt

# Check overall branch diff (should only show newly added docs or subsequent bugfixes):
git diff --stat origin/rne-rewrite

Ensure no leftover legacy markers remain in the repository:

git grep "LEGACY SUPPORT"

(This command should return 0 results after complete removal).


5. Verification After Removal

Run the following commands to confirm that the clean repository builds and passes all checks:

# 1. Re-link workspace dependencies
yarn install

# 2. Build bundles
yarn prepare

# 3. Typecheck
yarn typecheck

# 4. Run test suites
yarn workspace react-native-executorch test

# 5. Lint
yarn lint