mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
22 lines
620 B
TypeScript
22 lines
620 B
TypeScript
|
import { resolve, join } from 'path'
|
||
|
import { promises as fsp } from 'fs'
|
||
|
import glob from 'globby'
|
||
|
|
||
|
const r = (...path: string[]) => resolve(join(__dirname, '..', ...path))
|
||
|
|
||
|
async function main () {
|
||
|
const templates = await glob(r('dist/templates/*.mjs'))
|
||
|
for (const file of templates) {
|
||
|
const { template } = await import(file)
|
||
|
const updated = template({
|
||
|
// messages: {},
|
||
|
name: '{{ name }}' // TODO
|
||
|
})
|
||
|
await fsp.mkdir(file.replace('.mjs', ''))
|
||
|
await fsp.writeFile(file.replace('.mjs', '/index.html'), updated)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// eslint-disable-next-line no-console
|
||
|
main().catch(console.error)
|