@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
32 lines (24 loc) • 762 B
JavaScript
import { getStates } from '../../common/state/state.js';
import { PartGenerator } from './part/part-generator.js';
class DSFRGenerator {
async generate (settings) {
const states = await getStates();
for (const state of states) {
await this._generate(settings, state);
}
}
async _generate (settings, state) {
const partIds = settings.partIds ? state.partIds.filter(id => settings.partIds.includes(id)) : state.partIds;
this._parts = [];
for (const id of partIds) {
const partState = state.setPart(id);
const part = new PartGenerator(partState);
this._parts.push(part);
await part.read();
}
for (const part of this._parts) {
await part.write();
}
}
}
export { DSFRGenerator };