feat: enable GH Pages stable plus deploy externe Vercel/Netlify

This commit is contained in:
Clément SAILLANT
2026-03-02 09:06:47 +01:00
parent ca0904824a
commit 58a94001f8
128 changed files with 84616 additions and 399 deletions
+36
View File
@@ -0,0 +1,36 @@
import fs from 'node:fs';
import path from 'node:path';
import { execSync } from 'node:child_process';
const targetSiteUrl =
process.env.PUBLIC_SITE_URL ||
process.env.EXTERNAL_SITE_URL ||
'https://electron-rare.github.io/';
const normalizeUrl = (value) => (value.endsWith('/') ? value : `${value}/`);
process.env.PUBLIC_SITE_URL = normalizeUrl(targetSiteUrl);
const run = (command) => {
execSync(command, {
stdio: 'inherit',
env: process.env
});
};
console.log(`[build-astro-external] Using PUBLIC_SITE_URL=${process.env.PUBLIC_SITE_URL}`);
run('npm run lab:build');
run('npm run build');
const labSource = path.resolve(process.cwd(), 'lab');
const labDestination = path.resolve(process.cwd(), 'dist', 'lab');
if (fs.existsSync(labSource)) {
fs.rmSync(labDestination, { recursive: true, force: true });
fs.cpSync(labSource, labDestination, { recursive: true });
console.log('[build-astro-external] Included lab/ output in dist/lab.');
} else {
console.warn('[build-astro-external] Warning: lab/ not found; skipping lab route packaging.');
}
console.log('[build-astro-external] External Astro build done.');
+45
View File
@@ -0,0 +1,45 @@
import fs from 'node:fs';
const htmlPath = new URL('../index.html', import.meta.url);
const html = fs.readFileSync(htmlPath, 'utf8');
const expectedPrimary = [
'cta_hero_projets',
'cta_hero_contact',
'cta_hero_profile',
'outbound_linkedin_contact',
'outbound_malt_contact',
'outbound_bandcamp_contact',
'outbound_github_contact',
'outbound_github_project_rtc_bl_phone',
'outbound_github_project_zacus',
'outbound_github_project_site',
'outbound_github_lab_more',
'cta_lab_interactif_open'
];
const expectedLegacy = ['outbound_github_project', 'outbound_github_contact'];
const dataTrackMatches = [...html.matchAll(/data-track="([^"]+)"/g)].map((m) => m[1]);
const dataLegacyMatches = [...html.matchAll(/data-track-legacy="([^"]+)"/g)].map((m) => m[1]);
const uniqueDataTrack = [...new Set(dataTrackMatches)];
const uniqueLegacyTrack = [...new Set(dataLegacyMatches)];
const missingPrimary = expectedPrimary.filter((eventName) => !uniqueDataTrack.includes(eventName));
const missingLegacy = expectedLegacy.filter((eventName) => !uniqueLegacyTrack.includes(eventName));
if (missingPrimary.length || missingLegacy.length) {
console.error('Tracking contract validation failed.');
if (missingPrimary.length) {
console.error(`Missing primary events: ${missingPrimary.join(', ')}`);
}
if (missingLegacy.length) {
console.error(`Missing legacy events: ${missingLegacy.join(', ')}`);
}
process.exit(1);
}
console.log('Tracking contract validation passed.');
console.log(`Primary events found (${uniqueDataTrack.length}): ${uniqueDataTrack.join(', ')}`);
console.log(`Legacy events found (${uniqueLegacyTrack.length}): ${uniqueLegacyTrack.join(', ')}`);