@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
36 lines (31 loc) • 867 B
JavaScript
import { CopyIndexer } from './copy-indexer.js';
class Indexing {
constructor (state) {
this._state = state;
this._version = state.version.major;
}
getIndexers (version) {
switch (version) {
case 1:
return [
new CopyIndexer(this._state, '.config/colors.json', 'colors.yml', 'items'),
new CopyIndexer(this._state, '.config/icon.json', 'icon.yml'),
new CopyIndexer(this._state, '.config/pictogram.json', 'pictogram.yml'),
]
case 2:
return [
// v2 indexers
]
default:
throw new Error(`Unsupported version ${version}`);
}
}
read () {
this._indexers = this.getIndexers(this._version);
this._indexers.forEach(indexer => indexer.read());
}
write () {
this._indexers.forEach(indexer => indexer.write());
}
}
export { Indexing };