mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 10:54:49 +00:00
21 lines
600 B
TypeScript
21 lines
600 B
TypeScript
import { join, resolve } from 'node:path'
|
|
import { promises as fsp } from 'node:fs'
|
|
import { globby } from 'globby'
|
|
|
|
const r = (...path: string[]) => resolve(join(__dirname, '..', ...path))
|
|
|
|
async function main () {
|
|
const templates = await globby(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)
|
|
}
|
|
}
|
|
|
|
main().catch(console.error)
|