landing
This commit is contained in:
@@ -1,33 +1,22 @@
|
||||
#!/usr/bin/env bun
|
||||
import plugin from 'bun-plugin-tailwind';
|
||||
import { config as dotenv } from 'dotenv';
|
||||
import { existsSync } from 'fs';
|
||||
import { rm } from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { buildConfig } from './helpers';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const envPath = path.resolve(__dirname, '../../.env');
|
||||
dotenv({ path: envPath });
|
||||
|
||||
const outdir = path.join(process.cwd(), 'build/landing');
|
||||
const outdir = path.join(process.cwd(), 'dist_landing');
|
||||
|
||||
if (existsSync(outdir)) {
|
||||
console.log(`🗑️ Cleaning previous build at ${outdir}`);
|
||||
await rm(outdir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
console.log('\n🚀 Starting landing page build...\n');
|
||||
|
||||
const start = performance.now();
|
||||
|
||||
const configPath = 'src/workspaces/config/src/index.ts';
|
||||
if (existsSync(configPath)) {
|
||||
console.log('🔧 Generating config with environment values...');
|
||||
buildConfig(configPath, 'landing');
|
||||
}
|
||||
|
||||
const entrypoints = [...new Bun.Glob('**.html').scanSync('src/apps/officer-web')]
|
||||
.map((a) => path.resolve('src/apps/officer-web', a))
|
||||
const entrypoints = [...new Bun.Glob('**.html').scanSync('src/apps/landing')]
|
||||
.map((a) => path.resolve('src/apps/landing', a))
|
||||
.filter((dir) => !dir.includes('node_modules'));
|
||||
console.log(`📄 Found ${entrypoints.length} HTML ${entrypoints.length === 1 ? 'file' : 'files'} to process\n`);
|
||||
|
||||
@@ -35,12 +24,10 @@ const formatFileSize = (bytes: number): string => {
|
||||
const units = ['B', 'KB', 'MB', 'GB'];
|
||||
let size = bytes;
|
||||
let unitIndex = 0;
|
||||
|
||||
while (size >= 1024 && unitIndex < units.length - 1) {
|
||||
size /= 1024;
|
||||
unitIndex++;
|
||||
}
|
||||
|
||||
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
||||
};
|
||||
|
||||
@@ -65,6 +52,4 @@ const outputTable = result.outputs.map((output) => ({
|
||||
}));
|
||||
|
||||
console.table(outputTable);
|
||||
const buildTime = (end - start).toFixed(2);
|
||||
|
||||
console.log(`\n✅ Build completed in ${buildTime}ms\n`);
|
||||
console.log(`\n✅ Build completed in ${(end - start).toFixed(2)}ms\n`);
|
||||
|
||||
Reference in New Issue
Block a user