mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-02-10 16:15:01 +00:00
* Personnalise la configuration ESLint pour les scripts * 👽 Déplace la traduction de l'explication SEO sur le simulateur salarié * Ajout d'une fonction rule dans sitePaths Permet de type-checker le nom de la règle pour éviter les liens morts * 👽 Ajoute un test pour la traduction des unités * 👽 Traduction BNC * 👽 fix translations
23 lines
900 B
JavaScript
23 lines
900 B
JavaScript
// It is currently not possible to automatically type yaml import with
|
|
// Typescript types, so we manually watch the yaml file containing the rules,
|
|
// convert it to json and persit it on the file system so that we can access the
|
|
// list of dotted names in the Typescript types.
|
|
//
|
|
// A fututre version of typescript may support "plugin" to type files such as
|
|
// yaml.
|
|
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
const yaml = require('js-yaml')
|
|
|
|
const sourcePath = path.resolve(__dirname, '../règles/base.yaml')
|
|
const outPath = path.resolve(__dirname, '../types/dottednames.json')
|
|
|
|
function persistJsonFileFromYaml() {
|
|
const source = fs.readFileSync(sourcePath)
|
|
const jsonString = JSON.stringify(yaml.safeLoad(source.toString()), null, 2)
|
|
fs.writeFileSync(outPath, jsonString)
|
|
}
|
|
|
|
persistJsonFileFromYaml()
|
|
exports.watchDottedNames = () => fs.watch(sourcePath, persistJsonFileFromYaml)
|