@gouvfr/dsfr-forge
Version:
Le module `dsfr-forge` offre des outils et utilitaires de développement partagés entre les différents modules du Système de Design de l’État - DSFR.
31 lines (23 loc) • 761 B
JavaScript
import fs from 'fs';
import path from 'path';
import { GeneratorOutput } from './generator-output.js';
class Generator {
constructor (dest) {
this._dest = dest;
this._load();
}
_load () {
const pkg = JSON.parse(fs.readFileSync(new URL(`${process.cwd()}/package.json`, import.meta.url), 'utf-8'));
this._banner = `/*!\n * ${pkg.name} v${pkg.version}\n * 2025 Système de Design de l'État\n * ${ pkg.license }\n * restricted use (see terms and conditions)\n */\n\n`;
}
get banner () {
return this._banner;
}
create ({filepath, content}) {
return new GeneratorOutput({ filepath: path.join(this._dest, filepath), content: `${this._banner}${content}`})
}
async output () {
return [];
}
}
export { Generator };