This commit introduces Firebase configuration files (.firebaserc, firebase.json) and updates the Makefile to include deployment commands for different environments (dev, staging). The .firebaserc file defines Firebase projects for development and staging, along with hosting targets. The firebase.json file configures hosting settings, including rewrites and ignores. It defines hosting targets for the main app in dev and staging, and a separate target for an internal launchpad. The Makefile is updated to include: - GCP project IDs for dev and staging. - Environment detection (ENV variable). - Conditional variables based on the environment (GCP_PROJECT_ID, FIREBASE_ALIAS, HOSTING_TARGET). - Deployment commands for the launchpad and the main app. - The build command now passes the environment variable to the frontend build process. The internal launchpad is added to firebase/internal-launchpad/index.html to provide quick access to application URLs and Firebase/GCP consoles for different environments. A patch script is added to inject the environment label into the Dashboard page. The index.html title is changed to KROW. These changes enable streamlined deployment and environment management for the KROW application.
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
const projectRoot = path.resolve(__dirname, '..');
|
||
const dashboardFilePath = path.join(projectRoot, 'frontend-web', 'src', 'pages', 'Dashboard.jsx');
|
||
|
||
const oldString = ` <PageHeader
|
||
title="Welcome to KROW"`;
|
||
|
||
const newString = ` <PageHeader
|
||
title={
|
||
<div className="flex items-center gap-2">
|
||
<span>Welcome to KROW</span>
|
||
{import.meta.env.VITE_APP_ENV === 'staging' && <Badge className="bg-yellow-100 text-yellow-800">Staging</Badge>}
|
||
{import.meta.env.VITE_APP_ENV === 'dev' && <Badge className="bg-slate-100 text-slate-800">Dev</Badge>}
|
||
</div>
|
||
}`;
|
||
|
||
try {
|
||
const content = fs.readFileSync(dashboardFilePath, 'utf8');
|
||
|
||
if (content.includes(oldString)) {
|
||
const newContent = content.replace(oldString, newString);
|
||
fs.writeFileSync(dashboardFilePath, newContent, 'utf8');
|
||
console.log('✅ Successfully patched Dashboard.jsx to include environment label.');
|
||
} else if (content.includes('VITE_APP_ENV')) {
|
||
console.log('ℹ️ Dashboard.jsx is already patched for environment labels. Skipping.');
|
||
} else {
|
||
console.error('❌ Patching Dashboard.jsx failed: Could not find the PageHeader title.');
|
||
process.exit(1);
|
||
}
|
||
} catch (error) {
|
||
console.error('❌ An error occurred during patching Dashboard.jsx:', error);
|
||
process.exit(1);
|
||
}
|