netlify-plugin-expo-qr
Version:
Netlify Build Plugin to automate Expo app updates and generate QR code pages for Expo Go
109 lines (84 loc) • 3.52 kB
Markdown
# Project Summary: netlify-plugin-expo-qr
## What Has Been Created
This project contains a complete Netlify Build Plugin that automates Expo app updates and generates QR code pages. Here's what's included:
### Core Plugin Files
- **`index.js`** - Main plugin implementation with `onBuild` lifecycle hook
- **`manifest.yml`** - Plugin manifest defining inputs and configuration
- **`package.json`** - NPM package configuration with dependencies
### Documentation & Examples
- **`README.md`** - Comprehensive documentation and usage guide
- **`example-netlify.toml`** - Example configuration file
- **`LICENSE`** - MIT license file
- **`.gitignore`** - Git ignore patterns
### Publishing Tools
- **`scripts/publish.sh`** - Automated publishing script for npm releases
## Plugin Features
✅ **Dual Mode Support**: EAS (recommended) and legacy publish modes
✅ **QR Code Generation**: Embedded QR codes using the `qrcode` package
✅ **Beautiful HTML Pages**: Responsive design with system fonts
✅ **Environment Integration**: Uses Netlify environment variables
✅ **Error Handling**: Comprehensive error handling and logging
✅ **Node 18+ Compatible**: Modern Node.js support
## How It Works
1. **During Netlify Build**: Plugin runs `eas update` or `expo publish`
2. **URL Extraction**: Parses JSON output to get Expo project URL
3. **QR Generation**: Creates scannable QR code as Data URI
4. **File Output**: Generates `dist/expo-qr.html` and `dist/__expo-latest.txt`
## Quick Start
### 1. Install the Plugin
```bash
npm install netlify-plugin-expo-qr
```
### 2. Configure netlify.toml
```toml
[[plugins]]
package = "netlify-plugin-expo-qr"
[plugins.inputs]
mode = "eas"
```
### 3. Set Environment Variables
- `EXPO_TOKEN` (required) - Your Expo access token
- `EAS_UPDATE_BRANCH` (optional) - Branch name, defaults to "preview"
## File Structure
```
NetlifyPlugin/
├── index.js # Main plugin implementation
├── manifest.yml # Plugin manifest
├── package.json # NPM package configuration
├── README.md # Comprehensive documentation
├── example-netlify.toml # Example configuration
├── LICENSE # MIT license
├── .gitignore # Git ignore patterns
├── scripts/
│ └── publish.sh # Publishing automation script
└── PROJECT_SUMMARY.md # This file
```
## Next Steps
### For Development
1. Test the plugin locally with your Expo project
2. Verify QR code generation works correctly
3. Test both EAS and publish modes
### For Publishing
1. Update repository URLs in `package.json`
2. Run `./scripts/publish.sh` to publish to npm
3. Create GitHub release and documentation
### For Users
1. Install from npm: `npm install netlify-plugin-expo-qr`
2. Add to `netlify.toml` configuration
3. Set required environment variables
4. Deploy and enjoy automatic QR code generation!
## Technical Details
- **Node.js Version**: 18.0.0+
- **Dependencies**: `qrcode` for QR code generation
- **Build Hook**: `onBuild` lifecycle hook
- **Output Format**: HTML with embedded Data URI QR codes
- **Error Handling**: Graceful failure with clear error messages
## Support & Contributing
- 📖 Read the full documentation in `README.md`
- 🐛 Report issues or suggest improvements
- 🤝 Contribute code or documentation
- ⭐ Star the repository if you find it useful
---
**Created**: December 2024
**License**: MIT
**Status**: Ready for npm publishing