1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 04:05:01 +00:00
mon-entreprise/site/scripts/utils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
437 B
JavaScript
Raw Normal View History

2021-12-07 13:46:03 +01:00
import { existsSync, mkdirSync, writeFileSync } from 'fs'
import { join } from 'path'
import { fileURLToPath } from 'url'
2022-02-21 16:19:53 +01:00
const dataDir = join(
fileURLToPath(import.meta.url),
'..',
'..',
'source',
2022-08-03 17:00:50 +02:00
'public',
2022-02-21 16:19:53 +01:00
'data'
)
2021-12-07 13:46:03 +01:00
export function createDataDir() {
if (!existsSync(dataDir)) {
mkdirSync(dataDir)
}
}
2021-12-07 13:46:03 +01:00
export function writeInDataDir(filename, data) {
writeFileSync(join(dataDir, filename), JSON.stringify(data, null, 2))
}