Package Exports
- rnotaupdatesi
- rnotaupdatesi/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rnotaupdatesi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rnotaupdates CLI
A command-line tool for managing React Native OTA (Over-The-Air) updates with bundle upload functionality and secure token-based authentication.
Installation
Install the package globally using npm:
npm install -g rnotaupdatesAuthentication
CLI Token Login
The CLI supports secure token-based authentication for both interactive use and CI/CD pipelines.
# Login using environment variable
rnotaupdates login --token "$(CodePushToken)"
Getting Your CLI Token
Method 1: Generate via API
curl -X POST http://your-api-server.com/sat/api/generate-token \
-H "Content-Type: application/json" \
-d '{
"email": "your-email@domain.com",
"password": "your-password"
}'Method 2: Contact your administrator
Request a CLI token from your CodePush server administrator.
Environment Variables
Set up environment variables for seamless CI/CD integration:
# Option 1: Using CodePushToken
export CodePushToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
# Then use in commands
rnotaupdates login --token "$(CodePushToken)"Usage
Authentication First
Always authenticate before running bundle commands:
# Step 1: Login
rnotaupdates login --token "your-token"
# Step 2: Upload bundles
rnotaupdates bundle upload -platform ios -tv "1.0.3"Bundle Upload Command
Upload your React Native bundles for OTA updates using the following command format:
rnotaupdates bundle upload [flags]Command Examples
Complete Workflow Examples
Basic Workflow
# 1. Authenticate
rnotaupdates login --token "$(CodePushToken)"
# 2. Upload with minimal required flags
rnotaupdates bundle upload -platform ios -tv "1.0.3"Production Deployment
# 1. Authenticate
rnotaupdates login --token "$(CodePushToken)"
# 2. Deploy production release
rnotaupdates bundle upload -platform android -tv "2.0.0" -m true -desc "Major release with new features"CI/CD Pipeline Example
# Environment setup (in your CI/CD system)
export CodePushToken="your-long-lived-token"
# Deployment script
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "$BUILD_VERSION" -desc "Automated build $BUILD_NUMBER"Legacy Examples (Basic Upload)
# Upload with minimal required flags (bundle version auto-generated)
rnotaupdates bundle upload -platform ios -tv "1.0.3"
# Upload with minimal required flags for Android
rnotaupdates bundle upload -platform android -tv "1.0.3"Upload with All Options
# Upload with all available flags
rnotaupdates bundle upload -platform android -tv "1.0.3" -m false -e true -assets false -desc "Bug fixes and improvements"
# Upload with custom bundle version
rnotaupdates bundle upload -platform android -tv "1.0.3" -bv "2.1.0" -desc "New features and enhancements"Real-world Examples
# Production release with mandatory update
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform ios -tv "2.1.0" -m true -desc "Critical security fixes"
# Development release with custom bundle version
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "1.5.2" -bv "1.5.2-beta.1" -m false -desc "Beta release with new UI components"
# Disabled update (for testing)
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform ios -tv "1.8.0" -e false -desc "Testing deployment pipeline"Command Reference
Login Command
| Command | Description | Example |
|---|---|---|
rnotaupdates login --token <token> |
Authenticate with CLI token | rnotaupdates login --token "eyJhbGci..." |
rnotaupdates login --token "$(VAR)" |
Authenticate using environment variable | rnotaupdates login --token "$(CodePushToken)" |
Bundle Upload Flags
| Flag | Required | Type | Default | Description |
|---|---|---|---|---|
-platform |
✅ Yes | string |
- | Target platform: android or ios |
-tv |
✅ Yes | string |
- | Target app version (e.g., "1.0.3") |
-bv |
❌ No | string |
auto-generated | Bundle version (auto-generated if not provided) |
-m |
❌ No | boolean |
false |
Mandatory update flag |
-e |
❌ No | boolean |
true |
Enable/disable the update |
-assets |
❌ No | boolean |
true |
Enable/disable the assets folder |
-desc |
❌ No | string |
- | Update description (wrap in quotes) |
CI/CD Integration
GitHub Actions
name: Deploy CodePush Update
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install CLI
run: npm install -g rnotaupdates
- name: Deploy to CodePush
env:
CodePushToken: ${{ secrets.CODEPUSH_TOKEN }}
run: |
rnotaupdates login --token "$CodePushToken"
rnotaupdates bundle upload -platform android -tv "${{ github.ref_name }}" -desc "Auto-deploy from ${{ github.sha }}"Azure DevOps
- task: NodeTool@0
inputs:
versionSpec: '16.x'
- script: npm install -g rnotaupdates
displayName: 'Install CLI'
- script: |
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "$(Build.BuildNumber)" -desc "Build $(Build.BuildId)"
displayName: 'Deploy to CodePush'
env:
CodePushToken: $(CodePushToken)Jenkins
pipeline {
agent any
environment {
CLI_TOKEN = credentials('codepush-cli-token')
}
stages {
stage('Deploy') {
steps {
sh '''
npm install -g rnotaupdates
rnotaupdates login --token "$CLI_TOKEN"
rnotaupdates bundle upload -platform android -tv "${BUILD_NUMBER}" -desc "Jenkins build ${BUILD_ID}"
'''
}
}
}
}Flag Details
Platform (-platform)
- Required: Yes
- Values:
android|ios - Example:
-platform android
Target Version (-tv)
- Required: Yes
- Format: Semantic version string
- Example:
-tv "1.0.3"
Bundle Version (-bv)
- Required: No
- Format: Custom version string
- Default: Auto-generated based on timestamp or increment
Mandatory Update (-m)
- Required: No
- Values:
true|false - Default:
false - Example:
-m true - Usage: Forces users to update before continuing to use the app
Enabled (-e)
- Required: No
- Values:
true|false - Default:
true - Example:
-e false - Usage: Controls whether the update is active/available to users
Assets (-assets)
- Required: No
- Values:
true|false - Default:
true - Example:
-assets false - Usage: Controls whether the assets folder to be included in the updates to users or not
Description (-desc)
- Required: No
- Format: String (wrap in quotes for multi-word descriptions)
- Example:
-desc "Bug fixes and performance improvements" - Usage: Provides update information to users
Common Workflows
1. Quick Development Update
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "1.0.0"2. Production Release
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform ios -tv "2.0.0" -m true -desc "Major update with new features"3. Beta Testing
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "1.5.0" -bv "1.5.0-beta.2" -desc "Beta release for testing"4. Emergency Hotfix
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform ios -tv "1.2.1" -m true -desc "Critical bug fixes"5. Staged Rollout (Disabled Initially)
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -tv "2.1.0" -e false -desc "Preparing for staged rollout"6. Assets included in the updates
rnotaupdates login --token "$(CodePushToken)"
rnotaupdates bundle upload -platform android -assets false -tv "1.0" -m false -e true -desc "Bug fixes and improvement"Security Best Practices
Token Management
- Never commit tokens to version control
- Use environment variables or secrets management
- Rotate tokens periodically
- Use different tokens for different environments (dev/staging/prod)
Environment Setup
# ✅ Good: Use environment variables
export CodePushToken="your-token"
# ❌ Bad: Don't hardcode in scripts
rnotaupdates login --token "hardcoded-token-here"CI/CD Security
- Store tokens as encrypted secrets in your CI/CD system
- Use least-privilege tokens (request minimal required access)
- Monitor token usage and set up alerts for unusual activity
Error Handling
The CLI will provide clear error messages for:
- Missing authentication (401 Unauthorized)
- Invalid or expired tokens
- Missing required flags
- Invalid platform values
- Invalid version formats
- Network connectivity issues
- Server errors
Common Error Solutions
Authentication Required
Error: 401 Unauthorized
Solution: Run 'rnotaupdates login --token "your-token"' firstInvalid Token
Error: Invalid or expired token
Solution: Generate a new token from your server administratorMissing Required Flags
Error: Missing required flag -platform
Solution: Add -platform android or -platform iosSupport
For issues, feature requests, or contributions, please visit the project repository or contact the development team.
Version
Current CLI version: Check with rnotaupdates --version
Note:
- Always authenticate with a valid CLI token before running upload commands
- Ensure you have proper network access to your CodePush server
- Keep your tokens secure and never share them publicly
- CLI tokens are long-lived (1 year) and perfect for automation