chore: change extension of publicodes files
parent
71da738c73
commit
c20a7cb80d
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Reference in New Issue