mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Implement a new announcement system with priority levels, role-based access, and store-specific filtering, replacing the customer order statistics card on the dashboard. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/biGr9ER
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Production deployment script
|
|
* Runs database migrations and starts the application
|
|
*/
|
|
|
|
const { execSync } = require('child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
async function deployToProduction() {
|
|
console.log('🚀 Starting production deployment...');
|
|
|
|
try {
|
|
// Check if we're in production environment
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
console.log('⚠️ Warning: NODE_ENV is not set to production');
|
|
}
|
|
|
|
// Check if DATABASE_URL is available
|
|
if (!process.env.DATABASE_URL) {
|
|
console.error('❌ DATABASE_URL environment variable is required for production');
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('✅ Environment variables verified');
|
|
|
|
// Run database migrations
|
|
console.log('🔄 Running database migrations...');
|
|
|
|
const migrateScriptPath = path.join(__dirname, 'migrations', 'migrate.js');
|
|
if (fs.existsSync(migrateScriptPath)) {
|
|
execSync(`node ${migrateScriptPath}`, { stdio: 'inherit' });
|
|
console.log('✅ Database migrations completed');
|
|
} else {
|
|
console.log('⚠️ No migration script found, skipping migrations');
|
|
}
|
|
|
|
// Start the application
|
|
console.log('🚀 Starting application...');
|
|
execSync('npm start', { stdio: 'inherit' });
|
|
|
|
} catch (error) {
|
|
console.error('❌ Deployment failed:', error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Execute if this script is run directly
|
|
if (require.main === module) {
|
|
deployToProduction();
|
|
}
|
|
|
|
module.exports = { deployToProduction }; |