Generate metafile

This commit is contained in:
Adria Navarro 2023-06-16 14:16:32 +01:00
parent 42bc17b891
commit e286008e08
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ function runBuild(entry, outfile) {
loader: { loader: {
".svelte": "copy", ".svelte": "copy",
}, },
metafile: true,
packages: "external", packages: "external",
external: [ external: [
"deasync", "deasync",
@ -51,7 +52,7 @@ function runBuild(entry, outfile) {
...sharedConfig, ...sharedConfig,
platform: "node", platform: "node",
outfile, outfile,
}).then(() => { }).then(result => {
glob(`${process.cwd()}/src/**/*.hbs`, {}, (err, files) => { glob(`${process.cwd()}/src/**/*.hbs`, {}, (err, files) => {
for (const file of files) { for (const file of files) {
fs.copyFileSync(file, `${process.cwd()}/dist/${path.basename(file)}`) fs.copyFileSync(file, `${process.cwd()}/dist/${path.basename(file)}`)
@ -62,6 +63,11 @@ function runBuild(entry, outfile) {
`Build successfully in ${(Date.now() - start) / 1000} seconds` `Build successfully in ${(Date.now() - start) / 1000} seconds`
) )
}) })
fs.writeFileSync(
`dist/${path.basename(outfile)}.meta.json`,
JSON.stringify(result.metafile)
)
}) })
} }