mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
21 lines
614 B
TypeScript
21 lines
614 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { promises as fsp } from 'node:fs'
|
|
import { glob } from 'tinyglobby'
|
|
|
|
const templatesRoot = fileURLToPath(new URL('..', import.meta.url))
|
|
|
|
async function main () {
|
|
const templates = await glob(['dist/templates/*.js'], { cwd: templatesRoot })
|
|
for (const file of templates) {
|
|
const { template } = await import(file)
|
|
const updated = template({
|
|
// messages: {},
|
|
name: '{{ name }}', // TODO
|
|
})
|
|
await fsp.mkdir(file.replace('.js', ''))
|
|
await fsp.writeFile(file.replace('.js', '/index.html'), updated)
|
|
}
|
|
}
|
|
|
|
main().catch(console.error)
|