mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1const path = require('path')
2const fs = require('fs')
3
4const projectRoot = path.join(__dirname, '..')
5const templateFile = path.join(
6 projectRoot,
7 'bskyweb',
8 'templates',
9 'scripts.html',
10)
11
12const {entrypoints} = require(path.join(
13 projectRoot,
14 'web-build/asset-manifest.json',
15))
16
17console.log(`Found ${entrypoints.length} entrypoints`)
18console.log(`Writing ${templateFile}`)
19
20const outputFile = entrypoints
21 .map(name => {
22 const file = path.basename(name)
23 return `<script defer="defer" src="/static/js/${file}"></script>`
24 })
25 .join('\n')
26fs.writeFileSync(templateFile, outputFile)