UNPKG

netlify-plugin-expo-qr

Version:

Netlify Build Plugin to automate Expo app updates and generate QR code pages for Expo Go

58 lines (46 loc) โ€ข 1.46 kB
#!/usr/bin/env node // Simple test script to verify the plugin's QR code generation const QRCode = require('qrcode'); const fs = require('fs'); const path = require('path'); async function testQRCodeGeneration() { console.log('๐Ÿงช Testing QR code generation...'); try { // Test URL const testUrl = 'exp://exp.host/@username/project?release-channel=preview'; // Generate QR code const qrCodeDataUri = await QRCode.toDataURL(testUrl, { errorCorrectionLevel: 'M', margin: 2, width: 300 }); console.log('โœ… QR code generated successfully'); console.log(`๐Ÿ“ฑ Data URI length: ${qrCodeDataUri.length} characters`); // Create test HTML const testHtml = `<!DOCTYPE html> <html> <head> <title>Test QR Code</title> </head> <body> <h1>Test QR Code</h1> <img src="${qrCodeDataUri}" alt="Test QR Code" /> <p>URL: ${testUrl}</p> </body> </html>`; // Write test file const testDir = path.join(process.cwd(), 'test-output'); if (!fs.existsSync(testDir)) { fs.mkdirSync(testDir, { recursive: true }); } const testPath = path.join(testDir, 'test-qr.html'); fs.writeFileSync(testPath, testHtml); console.log(`โœ… Test HTML written to: ${testPath}`); console.log('๐ŸŽ‰ All tests passed!'); } catch (error) { console.error('โŒ Test failed:', error.message); process.exit(1); } } // Run test testQRCodeGeneration();