UNPKG

@gouvfr/dsfr-nexus

Version:

Le module `dsfr-nexus` est l'interface de ligne de commande (CLI) centrale du Système de Design de l’État - DSFR. Il offre des outils pour gérer et compiler les ressources du DSFR

153 lines (122 loc) 2.83 kB
import yaml from 'yaml'; import { normalize } from '@gouvfr/dsfr-kit'; class Front { constructor (data) { if (!data.title) { throw new Error('Missing title in front'); } this._title = data.title; this._titleId = data.titleId; this._titleTemplate = data.titleTemplate; this._shortTitle = data.shortTitle ?? data.title; this._cover = data.cover; this._description = data.description ?? data.excerpt ?? data.summary; this._shortDescription = data.shortDescription ?? data.description ?? data.excerpt ?? data.summary; this._keywords = data.keywords; this._summary = data.summary ?? data.excerpt ?? data.description; this._excerpt = data.excerpt ?? data.description ?? data.summary; this._boost = data.boost ?? 1; this._sort = data.sort; this._version = data.version; this._order = data.order; this._priority = data.priority; this._published = data.published; this._segment = data.isRoot ? null : normalize(data.segment ?? data.title); this._template = data.template; this._analytics = data.analytics; this._toc = data.toc; this._list = data.list; this._scripts = data.scripts ?? []; this._styles = data.styles ?? []; this._meta = data.meta; this._badge = data.badge; this._sitemap = data.sitemap; this._mesh = data.mesh; this._requireCGU = data.requireCGU !== false; } get title () { return this._title; } get titleId () { return this._titleId; } get titleTemplate () { return this._titleTemplate; } get shortTitle () { return this._shortTitle; } get cover () { return this._cover; } get description () { return this._description; } get shortDescription () { return this._shortDescription; } get keywords () { return this._keywords; } get summary () { return this._summary; } get excerpt () { return this._excerpt; } get boost () { return this._boost; } get sort () { return this._sort; } get version () { return this._version; } get order () { return this._order; } get priority () { return this._priority; } get published () { return this._published; } get template () { return this._template; } get analytics () { return this._analytics; } get toc () { return this._toc; } get list () { return this._list; } get scripts () { return this._scripts; } get styles () { return this._styles; } get segment () { return this._segment; } get meta () { return this._meta; } get badge () { return this._badge; } get sitemap () { return this._sitemap; } get mesh () { return this._mesh; } get requireCGU () { return this._requireCGU; } } export { Front };