mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 21:48:18 +01:00
- Fix currency defaults (SATS → CHF) across forms, configs, and API routes - Remove @ts-nocheck from socialService.ts and improve type safety - Replace console.log statements with proper logger utility in production code - Additional type safety improvements and code quality enhancements - Documentation updates for improved maintainability All changes follow DRY, SSOT, and separation of concerns principles.
144 lines
3.3 KiB
JavaScript
144 lines
3.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* 📢 OrangeCat Deployment Notifications
|
|
*
|
|
* Sends notifications about deployment status.
|
|
*/
|
|
|
|
import { execSync } from 'child_process';
|
|
import chalk from 'chalk';
|
|
|
|
// Configuration
|
|
const CONFIG = {
|
|
productionUrl: 'https://www.orangecat.ch',
|
|
githubRepo: process.env.GITHUB_REPOSITORY || 'g-but/orangecat',
|
|
};
|
|
|
|
// Colors
|
|
const colors = {
|
|
success: chalk.bold.green,
|
|
error: chalk.bold.red,
|
|
warning: chalk.bold.yellow,
|
|
info: chalk.cyan,
|
|
dim: chalk.dim,
|
|
};
|
|
|
|
/**
|
|
* Send success notification
|
|
*/
|
|
function notifySuccess(deploymentInfo) {
|
|
const message = `
|
|
🎉 **OrangeCat Deployment Successful!**
|
|
|
|
🌐 **Production URL**: ${CONFIG.productionUrl}
|
|
⏱️ **Duration**: ${deploymentInfo.duration} minutes
|
|
📅 **Completed**: ${new Date().toLocaleString()}
|
|
|
|
🔍 **Verification Results**:
|
|
✅ Code quality checks passed
|
|
✅ GitHub Actions successful
|
|
✅ Browser verification completed
|
|
✅ Production site live
|
|
|
|
📊 **Monitoring**:
|
|
- GitHub Actions: https://github.com/${CONFIG.githubRepo}/actions
|
|
- Vercel Dashboard: https://vercel.com/dashboard
|
|
- Production Site: ${CONFIG.productionUrl}
|
|
|
|
🚀 **Ready for users!**
|
|
`;
|
|
|
|
console.log(colors.success(message));
|
|
|
|
// TODO: Add Slack/Discord notifications here
|
|
// TODO: Add email notifications here
|
|
}
|
|
|
|
/**
|
|
* Send failure notification
|
|
*/
|
|
function notifyFailure(error, deploymentInfo) {
|
|
const message = `
|
|
🚨 **OrangeCat Deployment Failed**
|
|
|
|
❌ **Error**: ${error.message}
|
|
⏱️ **Duration**: ${deploymentInfo.duration || 'unknown'} minutes
|
|
📅 **Failed**: ${new Date().toLocaleString()}
|
|
|
|
🔧 **Troubleshooting**:
|
|
1. Check GitHub Actions logs
|
|
2. Run diagnostics: \`npm run deploy:diagnose\`
|
|
3. Check Vercel deployment status
|
|
4. Verify production site manually
|
|
|
|
📱 **Monitoring Links**:
|
|
- GitHub Actions: https://github.com/${CONFIG.githubRepo}/actions
|
|
- Vercel Dashboard: https://vercel.com/dashboard
|
|
- Production Site: ${CONFIG.productionUrl}
|
|
|
|
🆘 **Need Help?**
|
|
- Check docs/deployment/DEPLOYMENT_PROCESS.md
|
|
- Contact deployment team
|
|
`;
|
|
|
|
console.log(colors.error(message));
|
|
|
|
// TODO: Add urgent notifications for failures
|
|
}
|
|
|
|
/**
|
|
* Send progress notification
|
|
*/
|
|
function notifyProgress(stage, status) {
|
|
const timestamp = new Date().toLocaleTimeString();
|
|
const message = `[${timestamp}] ${stage}: ${status}`;
|
|
|
|
console.log(colors.info(message));
|
|
}
|
|
|
|
/**
|
|
* Main notification function
|
|
*/
|
|
function main() {
|
|
const args = process.argv.slice(2);
|
|
const command = args[0];
|
|
|
|
switch (command) {
|
|
case 'success':
|
|
const successInfo = JSON.parse(args[1] || '{}');
|
|
notifySuccess(successInfo);
|
|
break;
|
|
|
|
case 'failure':
|
|
const error = new Error(args[1] || 'Unknown error');
|
|
const failureInfo = JSON.parse(args[2] || '{}');
|
|
notifyFailure(error, failureInfo);
|
|
break;
|
|
|
|
case 'progress':
|
|
const stage = args[1];
|
|
const status = args[2];
|
|
notifyProgress(stage, status);
|
|
break;
|
|
|
|
default:
|
|
console.log('Usage:');
|
|
console.log(' node notify.js success <deploymentInfo>');
|
|
console.log(' node notify.js failure <error> <deploymentInfo>');
|
|
console.log(' node notify.js progress <stage> <status>');
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Export functions for use in other scripts
|
|
export { notifySuccess, notifyFailure, notifyProgress };
|
|
|
|
// Run if called directly
|
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
main();
|
|
}
|
|
|
|
|
|
|