CLI Overview
The ota-publish CLI tool automates OTA update publishing with intelligent version tracking and changelog generation.
What It Does
bash
npx ota-publish --channel productionAutomatically:
- 📖 Reads current
ota-version.json - 🔢 Increments version number
- 📝 Generates changelog from git commits
- 💾 Updates
ota-version.json - 🚀 Publishes to EAS
Key Features
Version Strategies
Choose how versions increment:
build(default) —1.0.0-prod.42→1.0.0-prod.43semver—1.0.0-prod.42→1.0.1-prod.43date—1.0.0-prod.20250107
Changelog Sources
Auto-generate from multiple sources:
- Git commits (default) — Last N commits
- Manual input — Interactive prompts
- File — Read from CHANGELOG.md
- Custom — Via hooks
Interactive Mode
bash
npx ota-publish --interactiveGuided prompts for:
- Channel selection
- Changelog input
- Publish confirmation
Dry Run
bash
npx ota-publish --channel production --dry-runPreview changes without publishing.
Hooks System
Run custom logic at different stages:
javascript
hooks: {
beforePublish: async (version) => {
// Run tests, linting
},
afterPublish: async (version) => {
// Send notifications
}
}Quick Start
1. Initialize
bash
npx ota-publish initCreates ota-updates.config.js in your project root.
2. Configure
javascript
// ota-updates.config.js
export default {
versionStrategy: 'build',
changelog: {
source: 'git',
commitCount: 10,
},
channels: ['development', 'preview', 'production'],
}3. Publish
bash
# Development
npx ota-publish --channel development
# Production
npx ota-publish --channel productionnpm Scripts
Add to your package.json:
json
{
"scripts": {
"ota:dev": "npx ota-publish --channel development",
"ota:preview": "npx ota-publish --channel preview",
"ota:prod": "npx ota-publish --channel production"
}
}Then run:
bash
npm run ota:dev
npm run ota:preview
npm run ota:prod