diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 5b3f509b4..da9931e31 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,9 +2,8 @@ "recommendations": [ "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", - "ban.spellright", "styled-components.vscode-styled-components", - "tamasfe.even-better-toml", - "mikestead.dotenv" + "mikestead.dotenv", + "emilerolley.publicodes-language-server" ] } diff --git a/exoneration-covid/règles/exonération-covid.yaml b/exoneration-covid/règles/exonération-covid.publicodes similarity index 100% rename from exoneration-covid/règles/exonération-covid.yaml rename to exoneration-covid/règles/exonération-covid.publicodes diff --git a/modele-social/règles/artiste-auteur.yaml b/modele-social/règles/artiste-auteur.publicodes similarity index 100% rename from modele-social/règles/artiste-auteur.yaml rename to modele-social/règles/artiste-auteur.publicodes diff --git a/modele-social/règles/base.yaml b/modele-social/règles/base.publicodes similarity index 100% rename from modele-social/règles/base.yaml rename to modele-social/règles/base.publicodes diff --git a/modele-social/règles/bénéficiaire.yaml b/modele-social/règles/bénéficiaire.publicodes similarity index 100% rename from modele-social/règles/bénéficiaire.yaml rename to modele-social/règles/bénéficiaire.publicodes diff --git a/modele-social/règles/declarations-indépendant/charges-sociales-formulaire.yaml b/modele-social/règles/declarations-indépendant/charges-sociales-formulaire.publicodes similarity index 100% rename from modele-social/règles/declarations-indépendant/charges-sociales-formulaire.yaml rename to modele-social/règles/declarations-indépendant/charges-sociales-formulaire.publicodes diff --git a/modele-social/règles/declarations-indépendant/charges-sociales-résultats.yaml b/modele-social/règles/declarations-indépendant/charges-sociales-résultats.publicodes similarity index 100% rename from modele-social/règles/declarations-indépendant/charges-sociales-résultats.yaml rename to modele-social/règles/declarations-indépendant/charges-sociales-résultats.publicodes diff --git a/modele-social/règles/dirigeant/auto-entrepreneur.yaml b/modele-social/règles/dirigeant/auto-entrepreneur.publicodes similarity index 100% rename from modele-social/règles/dirigeant/auto-entrepreneur.yaml rename to modele-social/règles/dirigeant/auto-entrepreneur.publicodes diff --git a/modele-social/règles/dirigeant/conjoint-collaborateur.yaml b/modele-social/règles/dirigeant/conjoint-collaborateur.publicodes similarity index 100% rename from modele-social/règles/dirigeant/conjoint-collaborateur.yaml rename to modele-social/règles/dirigeant/conjoint-collaborateur.publicodes diff --git a/modele-social/règles/dirigeant/dirigeant.yaml b/modele-social/règles/dirigeant/dirigeant.publicodes similarity index 100% rename from modele-social/règles/dirigeant/dirigeant.yaml rename to modele-social/règles/dirigeant/dirigeant.publicodes diff --git a/modele-social/règles/dirigeant/exonération-covid.yaml b/modele-social/règles/dirigeant/exonération-covid.publicodes similarity index 100% rename from modele-social/règles/dirigeant/exonération-covid.yaml rename to modele-social/règles/dirigeant/exonération-covid.publicodes diff --git a/modele-social/règles/dirigeant/exonérations.yaml b/modele-social/règles/dirigeant/exonérations.publicodes similarity index 100% rename from modele-social/règles/dirigeant/exonérations.yaml rename to modele-social/règles/dirigeant/exonérations.publicodes diff --git a/modele-social/règles/dirigeant/indépendant.yaml b/modele-social/règles/dirigeant/indépendant.publicodes similarity index 100% rename from modele-social/règles/dirigeant/indépendant.yaml rename to modele-social/règles/dirigeant/indépendant.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CARCDSF.yaml b/modele-social/règles/dirigeant/professions-libérales/CARCDSF.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CARCDSF.yaml rename to modele-social/règles/dirigeant/professions-libérales/CARCDSF.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CARMF.yaml b/modele-social/règles/dirigeant/professions-libérales/CARMF.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CARMF.yaml rename to modele-social/règles/dirigeant/professions-libérales/CARMF.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CARPIMKO.yaml b/modele-social/règles/dirigeant/professions-libérales/CARPIMKO.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CARPIMKO.yaml rename to modele-social/règles/dirigeant/professions-libérales/CARPIMKO.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CAVEC.yaml b/modele-social/règles/dirigeant/professions-libérales/CAVEC.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CAVEC.yaml rename to modele-social/règles/dirigeant/professions-libérales/CAVEC.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CAVP.yaml b/modele-social/règles/dirigeant/professions-libérales/CAVP.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CAVP.yaml rename to modele-social/règles/dirigeant/professions-libérales/CAVP.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CIPAV.yaml b/modele-social/règles/dirigeant/professions-libérales/CIPAV.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CIPAV.yaml rename to modele-social/règles/dirigeant/professions-libérales/CIPAV.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CNAVPL.yaml b/modele-social/règles/dirigeant/professions-libérales/CNAVPL.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CNAVPL.yaml rename to modele-social/règles/dirigeant/professions-libérales/CNAVPL.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/CNBF.yaml b/modele-social/règles/dirigeant/professions-libérales/CNBF.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/CNBF.yaml rename to modele-social/règles/dirigeant/professions-libérales/CNBF.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/PAMC.yaml b/modele-social/règles/dirigeant/professions-libérales/PAMC.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/PAMC.yaml rename to modele-social/règles/dirigeant/professions-libérales/PAMC.publicodes diff --git a/modele-social/règles/dirigeant/professions-libérales/profession-libérale.yaml b/modele-social/règles/dirigeant/professions-libérales/profession-libérale.publicodes similarity index 100% rename from modele-social/règles/dirigeant/professions-libérales/profession-libérale.yaml rename to modele-social/règles/dirigeant/professions-libérales/profession-libérale.publicodes diff --git a/modele-social/règles/entreprise/activité.yaml b/modele-social/règles/entreprise/activité.publicodes similarity index 100% rename from modele-social/règles/entreprise/activité.yaml rename to modele-social/règles/entreprise/activité.publicodes diff --git a/modele-social/règles/entreprise/catégorie-juridique.yaml b/modele-social/règles/entreprise/catégorie-juridique.publicodes similarity index 100% rename from modele-social/règles/entreprise/catégorie-juridique.yaml rename to modele-social/règles/entreprise/catégorie-juridique.publicodes diff --git a/modele-social/règles/entreprise/coût-création.yaml b/modele-social/règles/entreprise/coût-création.publicodes similarity index 100% rename from modele-social/règles/entreprise/coût-création.yaml rename to modele-social/règles/entreprise/coût-création.publicodes diff --git a/modele-social/règles/entreprise/entreprise.yaml b/modele-social/règles/entreprise/entreprise.publicodes similarity index 100% rename from modele-social/règles/entreprise/entreprise.yaml rename to modele-social/règles/entreprise/entreprise.publicodes diff --git a/modele-social/règles/entreprise/imposition.yaml b/modele-social/règles/entreprise/imposition.publicodes similarity index 100% rename from modele-social/règles/entreprise/imposition.yaml rename to modele-social/règles/entreprise/imposition.publicodes diff --git a/modele-social/règles/entreprise/établissement.yaml b/modele-social/règles/entreprise/établissement.publicodes similarity index 100% rename from modele-social/règles/entreprise/établissement.yaml rename to modele-social/règles/entreprise/établissement.publicodes diff --git a/modele-social/règles/impôt.yaml b/modele-social/règles/impôt.publicodes similarity index 100% rename from modele-social/règles/impôt.yaml rename to modele-social/règles/impôt.publicodes diff --git a/modele-social/règles/protection-sociale.yaml b/modele-social/règles/protection-sociale.publicodes similarity index 100% rename from modele-social/règles/protection-sociale.yaml rename to modele-social/règles/protection-sociale.publicodes diff --git a/modele-social/règles/période.yaml b/modele-social/règles/période.publicodes similarity index 100% rename from modele-social/règles/période.yaml rename to modele-social/règles/période.publicodes diff --git a/modele-social/règles/salarié/activité-partielle.yaml b/modele-social/règles/salarié/activité-partielle.publicodes similarity index 100% rename from modele-social/règles/salarié/activité-partielle.yaml rename to modele-social/règles/salarié/activité-partielle.publicodes diff --git a/modele-social/règles/salarié/aides-employeur.yaml b/modele-social/règles/salarié/aides-employeur.publicodes similarity index 100% rename from modele-social/règles/salarié/aides-employeur.yaml rename to modele-social/règles/salarié/aides-employeur.publicodes diff --git a/modele-social/règles/salarié/contrat.yaml b/modele-social/règles/salarié/contrat.publicodes similarity index 100% rename from modele-social/règles/salarié/contrat.yaml rename to modele-social/règles/salarié/contrat.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/bâtiment.yaml b/modele-social/règles/salarié/conventions-collectives/bâtiment.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/bâtiment.yaml rename to modele-social/règles/salarié/conventions-collectives/bâtiment.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/experts-comptables.yaml b/modele-social/règles/salarié/conventions-collectives/experts-comptables.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/experts-comptables.yaml rename to modele-social/règles/salarié/conventions-collectives/experts-comptables.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/hôtels-cafés-restaurants.yaml b/modele-social/règles/salarié/conventions-collectives/hôtels-cafés-restaurants.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/hôtels-cafés-restaurants.yaml rename to modele-social/règles/salarié/conventions-collectives/hôtels-cafés-restaurants.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/optique.yaml b/modele-social/règles/salarié/conventions-collectives/optique.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/optique.yaml rename to modele-social/règles/salarié/conventions-collectives/optique.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/spectacle-vivant.yaml b/modele-social/règles/salarié/conventions-collectives/spectacle-vivant.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/spectacle-vivant.yaml rename to modele-social/règles/salarié/conventions-collectives/spectacle-vivant.publicodes diff --git a/modele-social/règles/salarié/conventions-collectives/sport.yaml b/modele-social/règles/salarié/conventions-collectives/sport.publicodes similarity index 100% rename from modele-social/règles/salarié/conventions-collectives/sport.yaml rename to modele-social/règles/salarié/conventions-collectives/sport.publicodes diff --git a/modele-social/règles/salarié/cotisations.yaml b/modele-social/règles/salarié/cotisations.publicodes similarity index 100% rename from modele-social/règles/salarié/cotisations.yaml rename to modele-social/règles/salarié/cotisations.publicodes diff --git a/modele-social/règles/salarié/rémunération.yaml b/modele-social/règles/salarié/rémunération.publicodes similarity index 100% rename from modele-social/règles/salarié/rémunération.yaml rename to modele-social/règles/salarié/rémunération.publicodes diff --git a/modele-social/règles/salarié/salarié.yaml b/modele-social/règles/salarié/salarié.publicodes similarity index 100% rename from modele-social/règles/salarié/salarié.yaml rename to modele-social/règles/salarié/salarié.publicodes diff --git a/modele-social/règles/salarié/temps-de-travail.yaml b/modele-social/règles/salarié/temps-de-travail.publicodes similarity index 100% rename from modele-social/règles/salarié/temps-de-travail.yaml rename to modele-social/règles/salarié/temps-de-travail.publicodes diff --git a/modele-social/règles/situation-personnelle.yaml b/modele-social/règles/situation-personnelle.publicodes similarity index 100% rename from modele-social/règles/situation-personnelle.yaml rename to modele-social/règles/situation-personnelle.publicodes diff --git a/scripts/build-rules.js b/scripts/build-rules.js index 3501a8f15..6b499bdf1 100644 --- a/scripts/build-rules.js +++ b/scripts/build-rules.js @@ -1,11 +1,11 @@ -import { writeFileSync } from 'fs' +import { existsSync, mkdirSync, writeFileSync } from 'fs' import path from 'path' import { getModelFromSource } from '@publicodes/tools/compilation' import Engine from 'publicodes' const outDir = './dist' -const rules = getModelFromSource(path.resolve('./règles/**/*.yaml'), { +const rules = getModelFromSource(path.resolve('./règles'), { verbose: true, }) @@ -13,6 +13,11 @@ export default function writeJSFile() { const json = JSON.stringify(JSON.stringify(rules)) const names = Object.keys(new Engine(rules).getParsedRules()) const jsString = `export const json = /*@__PURE__*/ ${json};\nexport default /*@__PURE__*/ JSON.parse(json);` + // Create folder if doesn't exist + const folder = path.resolve(outDir) + if (!existsSync(folder)) { + mkdirSync(folder) + } writeFileSync(path.resolve(outDir, 'index.js'), jsString) writeFileSync( path.resolve(outDir, 'names.ts'),