Teardown

prebuild

Generate native iOS and Android projects from configuration.

The prebuild command generates native iOS and Android projects based on your teardown.config.ts configuration.

Usage

teardown prebuild [options]

Options

OptionDescriptionDefault
-p, --platform <platform>Target platform: ios, android, or allall
-c, --cleanClean native directories before prebuildfalse
-d, --dry-runPreview changes without applyingfalse
-v, --verboseEnable verbose loggingfalse
--skip-validationSkip configuration validationfalse

Examples

Build All Platforms

teardown prebuild

Generates both ios/ and android/ directories.

Build Single Platform

# iOS only
teardown prebuild --platform ios

# Android only
teardown prebuild --platform android

Clean Build

teardown prebuild --clean

Removes existing native directories before generating new ones.

Preview Changes

teardown prebuild --dry-run

Shows what would be generated without actually creating files.

What Gets Generated

iOS (ios/)

  • Xcode project and workspace
  • Podfile with dependencies
  • Info.plist configuration
  • App icons and launch screen
  • Native modules from plugins

Android (android/)

  • Gradle project structure
  • AndroidManifest.xml
  • build.gradle files
  • App icons and resources
  • Native modules from plugins

Plugin Processing

Plugins modify the native projects during prebuild:

// teardown.config.ts
export default defineConfig({
  plugins: [
    "camera",
    ["location", { 
      permission: "We need your location for navigation" 
    }],
  ],
});

Each plugin:

  1. Adds required native dependencies
  2. Configures permissions
  3. Modifies native files as needed

Build Pipeline

The prebuild runs these phases:

  1. Validate - Check configuration
  2. Clean (if --clean) - Remove existing native dirs
  3. Generate - Create native project structure
  4. Configure - Apply settings from config
  5. Plugins - Run plugin modifications
  6. Finalize - Complete setup

Incremental Builds

Subsequent prebuilds are incremental by default:

  • Existing files are updated, not recreated
  • Plugin changes are applied
  • Use --clean for a fresh start

After Prebuild

iOS

Install CocoaPods dependencies:

cd ios && pod install

Or let teardown run ios handle it automatically.

Android

No additional steps needed. Gradle syncs automatically.

Troubleshooting

Validation Errors

Failed to load configuration

Check your teardown.config.ts for errors:

teardown validate

Plugin Errors

Unknown plugin: xyz

Use teardown plugins list to see available plugins.

Clean Build Issues

If you see strange errors after changes:

teardown prebuild --clean

iOS Pods Not Found

After prebuild, if pods are missing:

cd ios && pod install --repo-update

Best Practices

  1. Version control - Add ios/ and android/ to .gitignore
  2. Clean builds - Use --clean when updating plugins or major config
  3. Dry run first - Preview changes with --dry-run on production configs
  4. Check logs - Use --verbose to debug issues