Champ optionnel domain dans YAML carte-o-source : propage vers JSON et permet d'afficher un logo plateforme en bas-droite de chaque node (cercle blanc 18px + image clippee circulaire 14px) quand le zoom depasse 1.5x. V1.2-O par defaut : substack.com sur les 15 thematiques essais. Centre + projet TMIP gardent leur fill brut (encre / ocre). Toggle visibilite via callback zoom (opacity 0/1 sur .logo-overlay). A flagger : CDN Brandfetch retourne 403 en curl server-side avec le client ID fourni. A revalider en browser (origin trans-former.fr) — le CDN peut exiger un Origin header autorise. Si bloque, fallback prevu en V1.3 (proxy local ou logos packages dans /public/logos/). Files: - public/data/carte-o-source.yaml : +15 champs domain - scripts/build-carte-o.js : propagation domain -> JSON - src/components/vue/CarteO.vue : CarteNode.domain + logoUrl helper + logo-overlay (circle + image clip-path) + toggle visibilite zoom - public/data/carte-o.json : regenere (15/17 nodes ont domain)
105 lines
2.8 KiB
JavaScript
105 lines
2.8 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) {
|
|
const key = source < target ? `${source}|${target}` : `${target}|${source}`
|
|
if (edgeSet.has(key)) return
|
|
edgeSet.add(key)
|
|
edges.push({ source, target })
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
for (const proj of data.projets) {
|
|
addNode(proj)
|
|
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)
|