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
| Option | Description | Default |
|---|---|---|
-p, --platform <platform> | Target platform: ios, android, or all | all |
-c, --clean | Clean native directories before prebuild | false |
-d, --dry-run | Preview changes without applying | false |
-v, --verbose | Enable verbose logging | false |
--skip-validation | Skip configuration validation | false |
Examples
Build All Platforms
teardown prebuildGenerates both ios/ and android/ directories.
Build Single Platform
# iOS only
teardown prebuild --platform ios
# Android only
teardown prebuild --platform androidClean Build
teardown prebuild --cleanRemoves existing native directories before generating new ones.
Preview Changes
teardown prebuild --dry-runShows what would be generated without actually creating files.
What Gets Generated
iOS (ios/)
- Xcode project and workspace
Podfilewith dependenciesInfo.plistconfiguration- App icons and launch screen
- Native modules from plugins
Android (android/)
- Gradle project structure
AndroidManifest.xmlbuild.gradlefiles- 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:
- Adds required native dependencies
- Configures permissions
- Modifies native files as needed
Build Pipeline
The prebuild runs these phases:
- Validate - Check configuration
- Clean (if
--clean) - Remove existing native dirs - Generate - Create native project structure
- Configure - Apply settings from config
- Plugins - Run plugin modifications
- Finalize - Complete setup
Incremental Builds
Subsequent prebuilds are incremental by default:
- Existing files are updated, not recreated
- Plugin changes are applied
- Use
--cleanfor a fresh start
After Prebuild
iOS
Install CocoaPods dependencies:
cd ios && pod installOr let teardown run ios handle it automatically.
Android
No additional steps needed. Gradle syncs automatically.
Troubleshooting
Validation Errors
Failed to load configurationCheck your teardown.config.ts for errors:
teardown validatePlugin Errors
Unknown plugin: xyzUse teardown plugins list to see available plugins.
Clean Build Issues
If you see strange errors after changes:
teardown prebuild --cleaniOS Pods Not Found
After prebuild, if pods are missing:
cd ios && pod install --repo-updateBest Practices
- Version control - Add
ios/andandroid/to.gitignore - Clean builds - Use
--cleanwhen updating plugins or major config - Dry run first - Preview changes with
--dry-runon production configs - Check logs - Use
--verboseto debug issues
Related
- Configuration - Configure your app
- Plugins - Available plugins
- run - Run on devices