110 lignes
5.7 KiB
JavaScript
110 lignes
5.7 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { execSync } = require('child_process');
|
|
|
|
const SITE_DIR = path.resolve(__dirname, '..');
|
|
const ACTUAL_DIR = path.resolve(SITE_DIR, '../Actual_Website');
|
|
|
|
const OLD_VER = '0.3.5';
|
|
const NEW_VER = '0.4.0';
|
|
|
|
const OLD_HASH = '6B2935E732A35175D01F586D7D8578DF63FB445444460464039FEBC7EA841CCA';
|
|
const NEW_HASH = 'FB2AF27C5509D220E18BD40219192D137368203A11D9B789BF5E1DA6C50B70F6';
|
|
|
|
console.log(`[DEPLOY-v0.4.0] Updating _Site to v${NEW_VER}...`);
|
|
|
|
// 1. gws/index.html
|
|
const gwsPath = path.join(SITE_DIR, 'gws/index.html');
|
|
let gwsContent = fs.readFileSync(gwsPath, 'utf8');
|
|
|
|
gwsContent = gwsContent.replaceAll(OLD_VER, NEW_VER);
|
|
gwsContent = gwsContent.replaceAll(OLD_HASH, NEW_HASH);
|
|
|
|
// Add v0.4.0 changelog in gws/index.html if not present
|
|
const gwsTimelineMarker = '<div class="changelog-timeline">';
|
|
const gwsV040Entry = `<div class="changelog-timeline">
|
|
|
|
<!-- v0.4.0 -->
|
|
<article class="timeline-item current">
|
|
<div class="timeline-header">
|
|
<span class="timeline-tag current">Dernière version</span>
|
|
<h3 class="timeline-version">Version 0.4.0 · Format .gws & Écosystème Connecté</h3>
|
|
<span class="timeline-date">23 septembre 2026</span>
|
|
</div>
|
|
<p class="timeline-summary">Introduction du système de mise à jour instantanée par paquets .gws, cartographie épurée avec infobulles compactes, guide interactif au premier lancement et nouveau hub officiel.</p>
|
|
<ul class="changelog-items">
|
|
<li><strong>Mises à jour instantanées (.gws) :</strong> Déploiement et association de fichier native pour les paquets <code>.gws</code>. Installation par simple glisser-déposer dans l'interface sans relancer d'installeur Windows ni déclencher de faux positifs SmartScreen. Permutation atomique et vérification SHA-256.</li>
|
|
<li><strong>Cartographie haute lisibilité :</strong> Refonte complète des infobulles au survol des sites (affichage compact nom, classification thermique et taille de dépression). Épuration du bandeau textuel et suppression du bouton "+ Point" (création directe par clic droit ou appui long).</li>
|
|
<li><strong>Prise en main express :</strong> Nouveau guide de démarrage rapide au premier lancement pour accompagner la prise en main de l'interface Studio (accessible à tout moment depuis les Paramètres).</li>
|
|
<li><strong>Hub officiel & Guide Defender :</strong> Déploiement du sas de téléchargement sur <code>gastinel.me/gws/</code> avec contrôle d'intégrité en un clic et explications pédagogiques sur les certificats indépendants.</li>
|
|
</ul>
|
|
</article>`;
|
|
|
|
if (!gwsContent.includes('Version 0.4.0')) {
|
|
gwsContent = gwsContent.replace(gwsTimelineMarker, gwsV040Entry);
|
|
// remove 'current' class from old 0.3.5 entry
|
|
gwsContent = gwsContent.replace('<article class="timeline-item current">', '<article class="timeline-item">');
|
|
gwsContent = gwsContent.replace('<span class="timeline-tag current">Dernière version</span>', '<span class="timeline-tag">Version précédente</span>');
|
|
}
|
|
|
|
fs.writeFileSync(gwsPath, gwsContent, 'utf8');
|
|
console.log('✓ gws/index.html updated to v0.4.0');
|
|
|
|
// 2. index.html
|
|
const indexPath = path.join(SITE_DIR, 'index.html');
|
|
let indexContent = fs.readFileSync(indexPath, 'utf8');
|
|
|
|
indexContent = indexContent.replaceAll(OLD_VER, NEW_VER);
|
|
indexContent = indexContent.replaceAll(OLD_HASH, NEW_HASH);
|
|
|
|
// Add v0.4.0 in SPA section changelog
|
|
const spaTimelineMarker = '<div class="changelog-timeline">';
|
|
if (!indexContent.includes('Version 0.4.0 · Format .gws')) {
|
|
indexContent = indexContent.replace(spaTimelineMarker, gwsV040Entry);
|
|
indexContent = indexContent.replace('<article class="timeline-item current">', '<article class="timeline-item">');
|
|
indexContent = indexContent.replace('<span class="timeline-tag current">Dernière version</span>', '<span class="timeline-tag">Version précédente</span>');
|
|
}
|
|
|
|
fs.writeFileSync(indexPath, indexContent, 'utf8');
|
|
console.log('✓ index.html updated to v0.4.0');
|
|
|
|
// 3. Update test-verify.js
|
|
const testVerifyPath = path.join(SITE_DIR, 'tools/test-verify.js');
|
|
let testContent = fs.readFileSync(testVerifyPath, 'utf8');
|
|
testContent = testContent.replaceAll(OLD_VER, NEW_VER);
|
|
testContent = testContent.replaceAll(OLD_HASH, NEW_HASH);
|
|
fs.writeFileSync(testVerifyPath, testContent, 'utf8');
|
|
console.log('✓ tools/test-verify.js updated to v0.4.0');
|
|
|
|
// 4. Synchronize Actual_Website
|
|
function copyDirSync(src, dest) {
|
|
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
for (const entry of entries) {
|
|
const srcPath = path.join(src, entry.name);
|
|
const destPath = path.join(dest, entry.name);
|
|
if (entry.isDirectory()) {
|
|
if (entry.name === '.git' || entry.name === 'node_modules') continue;
|
|
copyDirSync(srcPath, destPath);
|
|
} else {
|
|
fs.copyFileSync(srcPath, destPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
copyDirSync(path.join(SITE_DIR, 'gws'), path.join(ACTUAL_DIR, 'gws'));
|
|
fs.copyFileSync(indexPath, path.join(ACTUAL_DIR, 'index.html'));
|
|
fs.copyFileSync(path.join(SITE_DIR, 'sitemap.xml'), path.join(ACTUAL_DIR, 'sitemap.xml'));
|
|
fs.copyFileSync(path.join(SITE_DIR, 'llms.txt'), path.join(ACTUAL_DIR, 'llms.txt'));
|
|
console.log('✓ Synchronized with Actual_Website');
|
|
|
|
// 5. Precompress
|
|
console.log('[DEPLOY-v0.4.0] Running precompression...');
|
|
execSync('node ' + path.join(SITE_DIR, 'tools/precompress.js'), { stdio: 'inherit', cwd: SITE_DIR });
|
|
|
|
// 6. Test verification
|
|
console.log('[DEPLOY-v0.4.0] Running validation tests...');
|
|
execSync('node ' + path.join(SITE_DIR, 'tools/test-verify.js'), { stdio: 'inherit', cwd: SITE_DIR });
|
|
|
|
console.log('[DEPLOY-v0.4.0] All done successfully!');
|