pages/fullcalendar-main/packages/core/scripts/generate-locale-iife.js
2024-03-06 14:33:17 +01:00

21 lines
640 B
JavaScript

import { join as joinPaths, basename } from 'path'
import { fileURLToPath } from 'url'
import { readFile } from 'fs/promises'
import handlebars from 'handlebars'
const thisPkgDir = joinPaths(fileURLToPath(import.meta.url), '../..')
const templatePath = joinPaths(thisPkgDir, 'src/locales/global.js.tpl')
export function getWatchPaths() {
return [templatePath, templatePath]
}
export default async function(config) {
const localeCode = basename(config.entryAlias)
const templateText = await readFile(templatePath, 'utf8')
const template = handlebars.compile(templateText)
const code = template({ localeCode })
return code
}