🗑️ Deprecate deploy-pokedex.js in favor of deploy.sh and update environment variable validation messages

This commit is contained in:
2026-01-30 11:29:28 -05:00
parent fee8fe2551
commit 84f1fcb42a
3 changed files with 51 additions and 36 deletions

View File

@@ -42,7 +42,9 @@ function findBuiltAssets() {
} }
const files = fs.readdirSync(distPath); const files = fs.readdirSync(distPath);
const jsFiles = files.filter(f => f.endsWith('.js') && f.startsWith('index-')); const jsFiles = files.filter(
f => f.endsWith('.js') && f.startsWith('index-')
);
if (jsFiles.length === 0) { if (jsFiles.length === 0) {
throw new Error('No built JavaScript files found in dist/assets/'); throw new Error('No built JavaScript files found in dist/assets/');
@@ -121,13 +123,18 @@ function verifyBuild() {
log('blue', '', `Expected: ${expectedUri}`); log('blue', '', `Expected: ${expectedUri}`);
log('blue', '', `Found: ${foundUri}`); log('blue', '', `Found: ${foundUri}`);
console.log('\n❌ Build verification failed\n'); console.log('\n❌ Build verification failed\n');
console.log('This usually means the wrong .env.{mode} file was used during build.'); console.log(
console.log('Check that you\'re using the correct Vite mode flag:\n'); 'This usually means the wrong .env.{mode} file was used during build.'
console.log(' vite build --mode docker-local (for local Docker deployment)'); );
console.log(' vite build --mode production (for Synology deployment)\n'); console.log("Check that you're using the correct Vite mode flag:\n");
console.log(
' vite build --mode docker-local (for local Docker deployment)'
);
console.log(
' vite build --mode production (for Synology deployment)\n'
);
process.exit(1); process.exit(1);
} }
} catch (error) { } catch (error) {
log('red', '❌', `Verification error: ${error.message}`); log('red', '❌', `Verification error: ${error.message}`);
process.exit(1); process.exit(1);

View File

@@ -41,15 +41,21 @@ const REQUIRED_ENV_VARS = {
if (!target) return true; // Skip validation if target not set yet if (!target) return true; // Skip validation if target not set yet
if (target === 'dev' && !val.includes('localhost:5173')) { if (target === 'dev' && !val.includes('localhost:5173')) {
console.error('⚠️ FRONTEND_URL should be http://localhost:5173 for dev target'); console.error(
'⚠️ FRONTEND_URL should be http://localhost:5173 for dev target'
);
return false; return false;
} }
if (target === 'docker-local' && !val.includes('localhost:8099')) { if (target === 'docker-local' && !val.includes('localhost:8099')) {
console.error('⚠️ FRONTEND_URL should be http://localhost:8099 for docker-local target'); console.error(
'⚠️ FRONTEND_URL should be http://localhost:8099 for docker-local target'
);
return false; return false;
} }
if (target === 'production' && !val.includes('app.pokedex.online')) { if (target === 'production' && !val.includes('app.pokedex.online')) {
console.error('⚠️ FRONTEND_URL should be https://app.pokedex.online for production target'); console.error(
'⚠️ FRONTEND_URL should be https://app.pokedex.online for production target'
);
return false; return false;
} }
@@ -137,7 +143,9 @@ export function validateOrExit(exitOnError = true) {
// Print validation results // Print validation results
console.log('\n🔍 Environment Validation:'); console.log('\n🔍 Environment Validation:');
console.log(` DEPLOYMENT_TARGET: ${process.env.DEPLOYMENT_TARGET || 'not set'}`); console.log(
` DEPLOYMENT_TARGET: ${process.env.DEPLOYMENT_TARGET || 'not set'}`
);
console.log(` NODE_ENV: ${process.env.NODE_ENV || 'not set'}`); console.log(` NODE_ENV: ${process.env.NODE_ENV || 'not set'}`);
console.log(` PORT: ${process.env.PORT || 'not set'}`); console.log(` PORT: ${process.env.PORT || 'not set'}`);
console.log(` FRONTEND_URL: ${process.env.FRONTEND_URL || 'not set'}`); console.log(` FRONTEND_URL: ${process.env.FRONTEND_URL || 'not set'}`);