netlify-plugin-expo-qr
v1.0.16
Published
Netlify Build Plugin to automate Expo app updates and generate QR code pages for Expo Go
Maintainers
Readme
netlify-plugin-expo-qr
A Netlify Build Plugin that automates publishing Expo (React Native) app updates and generates QR code pages for Expo Go.
Features
- 🚀 Automated Expo Updates: Runs
eas updateorexpo publishduring Netlify builds - 📱 QR Code Generation: Creates scannable QR codes for easy app access
- 🌐 Static HTML Pages: Generates beautiful, responsive QR code pages
- ⚙️ Flexible Configuration: Supports both EAS and legacy publish modes
- 🔧 Environment Integration: Uses Netlify environment variables for configuration
How It Works
During a Netlify build, the plugin:
- Publishes Updates: Runs either
eas updateorexpo publishbased on configuration - Extracts URLs: Parses the JSON output to get the public Expo project URL
- Generates QR Codes: Creates a scannable QR code using the
qrcodepackage - Creates Static Files:
dist/expo-qr.html- Beautiful QR code page with instructionsdist/__expo-latest.txt- Latest Expo URL for programmatic access
Installation
Option 1: Install from npm (Recommended)
npm install netlify-plugin-expo-qrOption 2: Add to netlify.toml
[[plugins]]
package = "netlify-plugin-expo-qr"
[plugins.inputs]
mode = "eas"Configuration
Input Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| mode | string | "eas" | Update mode: "eas" or "publish" |
Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| EXPO_TOKEN | ✅ Yes | - | Your Expo access token |
| EAS_UPDATE_BRANCH | ❌ No | "preview" | Branch name for EAS updates |
Usage Examples
Basic EAS Mode (Recommended)
# netlify.toml
[[plugins]]
package = "netlify-plugin-expo-qr"
[plugins.inputs]
mode = "eas"
[build.environment]
EXPO_TOKEN = "your-expo-token-here"
EAS_UPDATE_BRANCH = "preview"Legacy Publish Mode
# netlify.toml
[[plugins]]
package = "netlify-plugin-expo-qr"
[plugins.inputs]
mode = "publish"
[build.environment]
EXPO_TOKEN = "your-expo-token-here"Custom Branch Configuration
# netlify.toml
[[plugins]]
package = "netlify-plugin-expo-qr"
[plugins.inputs]
mode = "eas"
[build.environment]
EXPO_TOKEN = "your-expo-token-here"
EAS_UPDATE_BRANCH = "production"🤖 Automation Scripts
This project includes powerful automation scripts to streamline development workflow:
Available Scripts
scripts/update-both-projects.sh- Main script to update both NetlifyPlugin and pluginTest projectsscripts/quick-update.sh- Quick update with automatic GitHub pushscripts/setup-aliases.sh- Set up convenient shell aliases
Quick Start
# Set up aliases (run once)
./scripts/setup-aliases.sh
# Quick update with push
quick-update "Add new feature" "1.0.12"
# Manual update without push
update-projects "Fix bug" "1.0.11"
# Update scripts only
update-scriptsWhat the Scripts Do
- Automatically navigate between both project directories
- Install plugin updates in pluginTest
- Commit changes with your custom message
- Push to GitHub (optional)
- Handle all git operations seamlessly
For detailed usage, see scripts/README.md.
Prerequisites
1. Expo CLI and EAS CLI
Ensure you have the necessary CLI tools installed:
npm install -g @expo/cli eas-cli2. Authentication
Set up your Expo token:
- Go to Expo's website
- Sign in to your account
- Go to Settings → Access Tokens
- Create a new token
- Add it to your Netlify environment variables
3. Project Configuration
Make sure your project has the necessary configuration files:
app.jsonorapp.config.jsfor Expo configurationeas.jsonfor EAS configuration (if using EAS mode)
Output Files
dist/expo-qr.html
A beautiful, responsive HTML page containing:
- 📱 Scannable QR code
- 🔗 Direct project URL
- 📋 Step-by-step instructions for Expo Go
- 🎨 Modern, clean design with system fonts
dist/__expo-latest.txt
A simple text file containing the latest Expo URL for programmatic access.
Build Process
The plugin runs during the onBuild lifecycle hook:
- Validation: Checks for required environment variables
- Execution: Runs the appropriate Expo command
- Parsing: Extracts the project URL from JSON output
- Generation: Creates QR code and HTML page
- Output: Writes files to the
distdirectory
Error Handling
The plugin includes comprehensive error handling:
- ✅ Validates required environment variables
- ✅ Gracefully handles command execution failures
- ✅ Provides clear error messages in build logs
- ✅ Fails builds appropriately when critical errors occur
Troubleshooting
Common Issues
Missing EXPO_TOKEN
- Ensure
EXPO_TOKENis set in Netlify environment variables - Verify the token is valid and has appropriate permissions
- Ensure
EAS Command Not Found
- Install EAS CLI:
npm install -g eas-cli - Ensure EAS CLI is available in the build environment
- Install EAS CLI:
Expo Publish Command Not Found
- Install Expo CLI:
npm install -g @expo/cli - Ensure Expo CLI is available in the build environment
- Install Expo CLI:
URL Extraction Failed
- Check that the Expo command completed successfully
- Verify the JSON output structure matches expected format
Debug Mode
Enable verbose logging by checking the Netlify build logs. The plugin provides detailed information about each step of the process.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
Changelog
v1.0.0
- Initial release
- Support for EAS and legacy publish modes
- QR code generation with embedded HTML
- Comprehensive error handling
- Modern, responsive UI design
