- YAML carte-o-source : label central -> 'Une medecine du corps social pour
ecrire un nouveau contrat social' (phrase pleine 3 lignes)
- YAML : projet TMIP gagne lien_central:true (edge explicite centre <-> projet)
- build-carte-o.js : addEdge accepte opts.central=true pour tagger les edges
rattachees au noeud central (permet tuning force-link cote Vue)
- carte-o.json regenere : 17 nodes, 20 edges (vs 19 V1.2-O), tous les edges
central->thematiques + central->tmip portent flag central:true
- CarteO.vue : noeud central rendu en RECT 300x64 fill encre (vs cercle r30),
label blanc multi-tspan 3 lignes 13px font-weight 500 line-height 1.35
- CarteO.vue : splitCentralLabel reecrit pour wrap intelligent (3 lignes
~30 chars), preserve compat ' + ' (V1.2)
- CarteO.vue : force tuning V1.3 -> alphaDecay 0.025, velocityDecay 0.4,
forceCollide +12 (CENTRAL_COLLIDE_RADIUS=160 pour le rect), forceX/Y
strength 0.05 rappel cadre, link distance/strength differencies
(central->projet = 90/0.6, central->essai = 200/0.3)
- CarteO.vue : hover handler selector etendu rect|circle
- CarteOWrapper.vue : CarteEdge gagne champ central?:boolean
- ColCentre.astro : tabs Chatbot retires (ChatbotV2 import retire aussi),
remplaces par header bandeau 'Sommaire editorial d'architecture
d'ecologie politique' (gauche, monospace 12px) + legende 3 symboles
(publie ● / a venir ○ / projet 🟠) en droite
Build SSR : 5 pages prerender, 0 warning, 4.35s.
113 lines
3.3 KiB
JavaScript
113 lines
3.3 KiB
JavaScript
#!/usr/bin/env node
|
|
import fs from 'node:fs/promises'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import yaml from 'js-yaml'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
const REPO_ROOT = path.resolve(__dirname, '..')
|
|
const SOURCE = path.join(REPO_ROOT, 'public/data/carte-o-source.yaml')
|
|
const OUTPUT = path.join(REPO_ROOT, 'public/data/carte-o.json')
|
|
|
|
// radius par niveau + nature (V1.2-N palette minimaliste)
|
|
function getRadius(niveau, nature) {
|
|
if (niveau === 0) return 30
|
|
if (nature === 'projet') return 18
|
|
if (niveau === 1) return 16
|
|
return 12
|
|
}
|
|
|
|
// compat backward : nature -> family
|
|
function getFamily(nature) {
|
|
return nature === 'projet' ? 'ressource' : 'concept'
|
|
}
|
|
|
|
// V1.2-N : noeud central fusionne -> toutes les thematiques sont rattachees au centre
|
|
// (les anciens groupes NCS_THEMATIQUES / MDCS_THEMATIQUES sont supprimes avec leurs sous-noeuds)
|
|
|
|
async function main() {
|
|
const raw = await fs.readFile(SOURCE, 'utf-8')
|
|
const data = yaml.load(raw)
|
|
|
|
const nodes = []
|
|
const edges = []
|
|
const edgeSet = new Set()
|
|
|
|
function addEdge(source, target, opts = {}) {
|
|
const key = source < target ? `${source}|${target}` : `${target}|${source}`
|
|
if (edgeSet.has(key)) return
|
|
edgeSet.add(key)
|
|
const edge = { source, target }
|
|
// V1.3-D : tag les edges au noeud central pour permettre tuning force-link
|
|
// (TMIP relie au centre = link court/fort, autres essais = link standard)
|
|
if (opts.central) edge.central = true
|
|
edges.push(edge)
|
|
}
|
|
|
|
function addNode(obj) {
|
|
const node = {
|
|
id: obj.id,
|
|
label: obj.label,
|
|
niveau: obj.niveau,
|
|
nature: obj.nature,
|
|
statut: obj.statut,
|
|
resume: obj.resume || null,
|
|
radius: getRadius(obj.niveau, obj.nature),
|
|
family: getFamily(obj.nature),
|
|
}
|
|
// V1.2-O : propage le champ optionnel domain (logo plateforme via Brandfetch CDN)
|
|
if (obj.domain) node.domain = obj.domain
|
|
nodes.push(node)
|
|
}
|
|
|
|
const centreId = data.centre.id
|
|
addNode(data.centre)
|
|
|
|
// concepts_force vide en V1.2-N (fusionne dans le centre)
|
|
for (const cf of (data.concepts_force || [])) {
|
|
addNode(cf)
|
|
addEdge(centreId, cf.id)
|
|
}
|
|
|
|
// toutes les thematiques rattachees directement au noeud central
|
|
for (const th of data.thematiques) {
|
|
addNode(th)
|
|
addEdge(centreId, th.id, { central: true })
|
|
}
|
|
|
|
for (const proj of data.projets) {
|
|
addNode(proj)
|
|
// V1.3-D : edge explicite projet -> central (pont vision <-> pratique)
|
|
if (proj.lien_central) {
|
|
addEdge(centreId, proj.id, { central: true })
|
|
}
|
|
for (const thId of (proj.liens_thematiques || [])) {
|
|
addEdge(proj.id, thId)
|
|
}
|
|
}
|
|
|
|
await fs.mkdir(path.dirname(OUTPUT), { recursive: true })
|
|
await fs.writeFile(
|
|
OUTPUT,
|
|
JSON.stringify({
|
|
version: data.version,
|
|
generatedAt: new Date().toISOString(),
|
|
nodes,
|
|
edges,
|
|
}, null, 2),
|
|
'utf-8',
|
|
)
|
|
|
|
console.log(`[carte-o] OK : ${nodes.length} nodes / ${edges.length} edges -> ${OUTPUT}`)
|
|
}
|
|
|
|
main().catch(err => {
|
|
console.error('[carte-o] FAIL', err)
|
|
process.exit(1)
|
|
})
|
|
|
|
// V1 scrape vault - reactiver en V1.2 pour enrichissement automatique
|
|
// Source : scripts/build-carte-o.js@be7fc09 (scrape AEP/Articles globby + gray-matter + wikilinks edges)
|