@expo/repack-app

中文文档
0.10.4发布于 2026/09/29MITTypeScriptCommonJS近 30 天下载 64.1万

Repacking tool for Expo apps

原始使用文档
文档目录6 节
  1. API Documentation
  2. CLI Usage
  3. Programmatic Usage
  4. Configuration Options
  5. Environment Variables
  6. TV apps

@expo/repack-app

Repacking tool for Expo apps

API Documentation

CLI Usage

repack-app [options] [project-root]

Options

  • -p, --platform <platform> (required): Platform to repack the app for (android or ios)
  • --source-app <path> (required): Path to the source app file (APK/AAB for Android, IPA for iOS)
  • --android-build-tools-dir <path>: Path to the Android build tools directory
  • -w, --working-directory <path>: Path to the working directory
  • -o, --output <path>: Path to the output artifact
  • -v, --verbose: Enable verbose logging

Android-specific Options

  • --ks <path>: Path to the keystore file
  • --ks-pass <password>: Keystore password (supported formats: pass:<password>, env:<name>, file:<file>)
  • --ks-key-alias <alias>: Keystore key alias
  • --ks-key-pass <password>: Keystore key password (supported formats: pass:<password>, env:<name>, file:<file>)

iOS-specific Options

  • --signing-identity <identity>: Code signing identity (fastlane backend, macOS only)
  • --provisioning-profile <path>: Path to the provisioning profile file(s)
  • --certificate <path>: Path to a .p12 signing identity. Signs with zsign instead of fastlane, in-process through WASM — no Xcode or keychain required, so it also works on Linux
  • --key-password <password>: Password for the .p12 signing identity

Bundle Options

  • --embed-bundle-assets: Force embedding of bundle assets
  • --bundle-assets-sourcemap-output <path>: Generate sourcemap at the specified path (used with --embed-bundle-assets)

Programmatic Usage

import { repackAppAndroidAsync, repackAppIosAsync } from '@expo/repack-app';

// For Android
await repackAppAndroidAsync({
  platform: 'android',
  projectRoot: '/path/to/project',
  sourceAppPath: '/path/to/source.apk',
  // Optional configurations
  workingDirectory: '/path/to/working/dir',
  outputPath: '/path/to/output.apk',
  verbose: true,
  androidSigningOptions: {
    keyStorePath: '/path/to/keystore.jks',
    keyStorePassword: 'pass:password', // or 'env:KEYSTORE_PASS' or 'file:/path/to/pass'
    keyAlias: 'alias',
    keyPassword: 'pass:key-password', // or 'env:KEY_PASS' or 'file:/path/to/key-pass'
  },
  androidBuildToolsDir: '/path/to/build-tools',
  exportEmbedOptions: {
    sourcemapOutput: '/path/to/sourcemap',
  },
  env: {
    // Additional environment variables
  },
});

// For iOS
await repackAppIosAsync({
  platform: 'ios',
  projectRoot: '/path/to/project',
  sourceAppPath: '/path/to/source.ipa',
  // Optional configurations
  workingDirectory: '/path/to/working/dir',
  outputPath: '/path/to/output.ipa',
  verbose: true,
  // Sign with fastlane and a macOS keychain identity (requires Xcode)
  iosSigningOptions: {
    signingIdentity: 'Apple Development: Name (Team ID)',
    provisioningProfile: '/path/to/profile.mobileprovision',
    keychainPath: '/path/to/keychain', // Optional
  },
  // ...or with zsign and a .p12, which needs no Xcode and runs on Linux:
  // iosSigningOptions: {
  //   backend: 'zsign',
  //   certificatePath: '/path/to/identity.p12',
  //   keyPassword: 'p12-password',
  //   provisioningProfile: '/path/to/profile.mobileprovision',
  // },
  exportEmbedOptions: {
    sourcemapOutput: '/path/to/sourcemap',
  },
  env: {
    // Additional environment variables
  },
});

Configuration Options

The following options are available when using the API programmatically:

Common Options

  • platform: 'android' | 'ios' - The platform to repack the app for
  • projectRoot: string - Path to the project root directory
  • sourceAppPath: string - Path to the prebuilt app file (APK/AAB/IPA)
  • workingDirectory?: string - Working directory for temporary files
  • outputPath?: string - Path to the output app file (defaults to projectRoot/repacked.apk or projectRoot/repacked.ipa)
  • verbose?: boolean - Enable verbose logging
  • exportEmbedOptions?: ExportEmbedOptions - Options for embedding JS bundle. When specified, repack will generate bundle assets.
  • skipWorkingDirCleanup?: boolean - Skip working directory cleanup
  • env?: Record<string, string | undefined> - Environment variables

Android-specific Options

  • androidSigningOptions?: AndroidSigningOptions - Options for signing the Android app
    • keyStorePath: string - Path to the keystore file
    • keyStorePassword: string - Keystore password (supported formats: pass:<password>, env:<name>, file:<file>)
    • keyAlias?: string - Keystore key alias
    • keyPassword?: string - Keystore key password (supported formats: pass:<password>, env:<name>, file:<file>)
  • androidBuildToolsDir?: string - Path to Android SDK build-tools directory
  • When sourceAppPath is an .aab, repack uses bundletool from PATH to convert it into a universal APK first and still outputs an APK.

iOS-specific Options

  • iosSigningOptions?: IosSigningOptions - Options for signing the iOS app. A union discriminated by backend:

    backend: 'fastlane' (the default) signs with fastlane's resign action and a macOS keychain identity, so it requires Xcode:

    • signingIdentity: string - Code signing identity
    • provisioningProfile: string | Record<string, string> - Path to provisioning profile file(s)
    • keychainPath?: string - Path to the keychain file for codesign

    backend: 'zsign' signs with zsign in-process through zsign-wasm. No Xcode, keychain, or external binary, so it also works on Linux:

    • certificatePath: string - Path to a .p12 signing identity, as exported from Keychain Access or downloaded from the Apple Developer portal. It holds the private key together with the certificate chain, including the Apple WWDR intermediate that iOS requires at install time
    • keyPassword?: string - Password protecting the .p12
    • provisioningProfile: string | Record<string, string> - Path to provisioning profile file(s)

Environment Variables

  • ANDROID_SDK_ROOT: Path to the Android SDK root directory (required for Android builds)
  • bundletool: Required on PATH for Android .aab inputs
  • UNSTABLE_REPACK_APP_ICON: Set to 1 or true to enable experimental app icon repacking

TV apps

App icon repacking supports Apple TV and Android TV. Repack detects a TV app from the source artifact — UIDeviceFamily in the iOS Info.plist, and the leanback launcher entries in AndroidManifest.xml — so there is no extra option to set. When the source app is a TV app, repack also runs its internal expo prebuild with EXPO_TV=1.

Repack does not generate TV images. It reuses what expo prebuild writes, so the icon comes from the @react-native-tvos/config-tv plugin options:

  • Apple TV: appleTVImages, which needs all seven images. Without it the asset catalog has no .brandassets, and repack keeps the source icon and logs a warning.
  • Android TV: androidTVBanner and androidTVIcon.

版本与发布记录

@expo/repack-app 共发布 63 个版本,首次发布于 2024/05/02;过去 12 个月发布了 24 个版本。

版本发布日期距今
0.10.4latest2026/09/291 个月前
0.10.32026/09/032 个月前
0.10.22026/09/022 个月前
0.10.12026/08/292 个月前
0.10.02026/08/212 个月前
0.9.02026/08/212 个月前

关于 @expo/repack-app 的常见问题

@expo/repack-app 是什么?

Repacking tool for Expo apps

如何安装 @expo/repack-app?

在项目目录运行 npm install @expo/repack-app,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 repack-app,可以用 npx repack-app 直接运行。

@expo/repack-app 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@expo/repack-app 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@expo/repack-app 可以商用吗?

@expo/repack-app 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@expo/repack-app 的下载量有多少?

根据 npm 官方下载统计,@expo/repack-app 在 2026/10/14 – 2026/11/12 这 30 天内被下载 640,507 次,日均约 21,350 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@expo/repack-app 还在维护吗?

最新版本 0.10.4 发布于 2026/09/29(1 个月前);至今共发布 63 个版本,其中过去 12 个月发布了 24 个;首次发布于 2024/05/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。