more build script cleanup

This commit is contained in:
Bruno Windels 2020-12-03 13:27:48 +01:00
parent 8eb6ea6d6c
commit 5704ade5dc

View file

@ -60,10 +60,8 @@ async function build() {
await assets.write(`bundle-legacy.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"])); await assets.write(`bundle-legacy.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"]));
await assets.write(`bundle.css`, await buildCss("css/main.css", assets)); await assets.write(`bundle.css`, await buildCss("css/main.css", assets));
await assets.writeUnhashed(".well-known/apple-app-site-association", buildAppleAssociatedAppsFile(createClients())); await assets.writeUnhashed(".well-known/apple-app-site-association", buildAppleAssociatedAppsFile(createClients()));
await assets.writeUnhashed("index.html", await buildHtml(assets));
const globalHash = assets.hashForAll(); const globalHash = assets.hashForAll();
await buildHtml(assets);
console.log(`built matrix.to ${version} (${globalHash}) successfully with ${assets.size} files`); console.log(`built matrix.to ${version} (${globalHash}) successfully with ${assets.size} files`);
} }
@ -77,10 +75,7 @@ async function buildHtml(assets) {
`<script type="text/javascript" nomodule>bundle.main(document.body);</script>` `<script type="text/javascript" nomodule>bundle.main(document.body);</script>`
]; ];
doc("script#main").replaceWith(mainScripts.join("")); doc("script#main").replaceWith(mainScripts.join(""));
const html = doc.html(); return doc.html();
// include in the global hash, even not hashed itself
assets.addToHashForAll("index.html", html);
await assets.writeUnhashed("index.html", html);
} }
function createReplaceUrlPlugin(assets) { function createReplaceUrlPlugin(assets) {