progresspulse-pwa
Version:
A modern PWA for tracking progress and achieving goals with iPhone-style design
75 lines (57 loc) โข 2.79 kB
JavaScript
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
console.log('๐ Starting deployment process...');
// Step 1: Increment version
console.log('๐ฆ Incrementing version...');
execSync('npm version patch', { stdio: 'inherit' });
// Step 2: Generate update manifest
console.log('๐ Generating update manifest...');
execSync('node scripts/generate-update-manifest.cjs', { stdio: 'inherit' });
// Step 3: Build the project
console.log('๐๏ธ Building project...');
execSync('npm run build', { stdio: 'inherit' });
// Step 4: Regenerate manifest for dist (in case build overwrote it)
console.log('๐ Regenerating manifest for dist...');
execSync('node scripts/generate-update-manifest.cjs', { stdio: 'inherit' });
// Step 5: Publish to NPM
console.log('๐ค Publishing to NPM...');
execSync('npm publish', { stdio: 'inherit' });
// Step 6: Create deployment instructions
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const newVersion = packageJson.version;
const deploymentInstructions = `
๐ DEPLOYMENT COMPLETE - Version ${newVersion}
๐ FILES TO UPLOAD TO YOUR DOMAIN:
Upload the entire 'dist/' folder contents to your web server
๐ CRITICAL FILES FOR UPDATES:
โ
dist/update-manifest.json (Contains version info)
โ
dist/version.json (For service worker)
โ
dist/sw-notifications.js (Background notifications)
โ
dist/sw.js (Main service worker)
๐ DEPLOYMENT STEPS:
1. Upload all files from 'dist/' to your domain
2. Ensure update-manifest.json is accessible at: https://yourdomain.com/update-manifest.json
3. Test by visiting: https://yourdomain.com/update-manifest.json
4. Users will automatically get update notifications within 24 hours
๐งช TESTING UPDATES:
1. Deploy this version to your domain
2. Wait 5 minutes for CDN cache to clear
3. Open your app in browser
4. Go to Settings โ Updates โ Check for Updates
5. Should show version ${newVersion} available
๐ฑ APK USERS:
- Will receive background notifications about the update
- Can update by visiting your domain in their APK browser
- Or download new APK from PWA Builder with this version
๐ NOTIFICATION TESTING:
- Daily reminders will work in background
- Update notifications will appear automatically
- Test notifications work immediately
โ
Your app is now ready for production deployment!
`;
console.log(deploymentInstructions);
// Write instructions to file
fs.writeFileSync('DEPLOYMENT_INSTRUCTIONS.txt', deploymentInstructions);
console.log('๐ Deployment instructions saved to DEPLOYMENT_INSTRUCTIONS.txt');