Something went wrong. Try again.
Bluesky app fork with some witchin' additions 💫 forked from jollywhoppers.com/witchsky.app
Something went wrong. Try again.
1.4 kB · 48 lines
JavaScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849const path = require('path')const fs = require('fs')
const projectRoot = path.join(__dirname, '..')const templateFile = path.join( projectRoot, 'bskyweb', 'templates', 'scripts.html',)
const {entrypoints} = require( path.join(projectRoot, 'web-build/asset-manifest.json'),)
console.log(`Found ${entrypoints.length} entrypoints`)console.log(`Writing ${templateFile}`)
const outputFile = entrypoints .map(name => { const file = path.basename(name) const ext = path.extname(file)
if (ext === '.js') { return `<script defer="defer" src="{{ staticCDNHost }}/static/js/${file}"></script>` } if (ext === '.css') { return `<link rel="stylesheet" href="{{ staticCDNHost }}/static/css/${file}">` }
return '' }) .join('\n')fs.writeFileSync(templateFile, outputFile)
function copyFiles(sourceDir, targetDir) { const files = fs.readdirSync(path.join(projectRoot, sourceDir)) files.forEach(file => { const sourcePath = path.join(projectRoot, sourceDir, file) const targetPath = path.join(projectRoot, targetDir, file) fs.copyFileSync(sourcePath, targetPath) console.log(`Copied ${sourcePath} to ${targetPath}`) })}
copyFiles('web-build/static/js', 'bskyweb/static/js')copyFiles('web-build/static/css', 'bskyweb/static/css')copyFiles('web-build/static/media', 'bskyweb/static/media')