Refactoring: attempt to fix build

This commit is contained in:
Pieter Vander Vennet 2023-07-16 03:26:43 +02:00
parent b6a1246bbe
commit cacc078042
3 changed files with 13 additions and 16 deletions

View file

@ -77,7 +77,9 @@ async function createSocialImage(layout: LayoutConfig, template: "" | "Wide"): P
}
delete svg["defs"]
delete svg["$"]
let templateSvg = await ScriptUtils.ReadSvg("./assets/SocialImageTemplate" + template + ".svg")
let templateSvg = await ScriptUtils.ReadSvg(
"./public/assets/SocialImageTemplate" + template + ".svg"
)
templateSvg = Utils.WalkJson(
templateSvg,
(leaf) => {
@ -287,8 +289,8 @@ async function createLandingPage(layout: LayoutConfig, manifest, whiteIcons, alr
)
.replace(
'<script type="module" src="./index.ts"></script>',
`<script type="module" src='./index_${layout.id}.ts'></script>`
'<script src="./src/index.ts" type="module"></script>',
`<script type="module" src='./index_${layout.id}.ts'></script>`
)
return output
@ -296,7 +298,8 @@ async function createLandingPage(layout: LayoutConfig, manifest, whiteIcons, alr
async function createIndexFor(theme: LayoutConfig) {
const filename = "index_" + theme.id + ".ts"
writeFileSync(filename, `import layout from "./assets/generated/themes/${theme.id}.json"\n`)
writeFileSync(filename, `import layout from "./src/assets/generated/themes/${theme.id}.json"\n`)
appendFileSync(filename, codeTemplate)
}
@ -308,9 +311,6 @@ function createDir(path) {
async function main(): Promise<void> {
const alreadyWritten = []
createDir("./assets/generated")
createDir("./assets/generated/layers")
createDir("./assets/generated/themes")
createDir("./public/assets/")
createDir("./public/assets/generated")
createDir("./public/assets/generated/images")
@ -359,6 +359,7 @@ async function main(): Promise<void> {
// Create a landing page for the given theme
const landing = await createLandingPage(layout, manifest, whiteIcons, alreadyWritten)
writeFile(enc(layout.id) + ".html", landing, err)
await createIndexFor(layout)
}

View file

@ -1,11 +1,7 @@
import { Utils } from "./Utils"
import ThemeViewState from "./Models/ThemeViewState"
import SvelteUIElement from "./UI/Base/SvelteUIElement"
import ThemeViewGUI from "./UI/ThemeViewGUI.svelte"
import LayoutConfig from "./Models/ThemeConfig/LayoutConfig";
// Miscelleanous
Utils.DisableLongPresses()
import ThemeViewState from "./src/Models/ThemeViewState"
import SvelteUIElement from "./src/UI/Base/SvelteUIElement"
import ThemeViewGUI from "./src/UI/ThemeViewGUI.svelte"
import LayoutConfig from "./src/Models/ThemeConfig/LayoutConfig";
const state = new ThemeViewState(new LayoutConfig(<any> layout))
const main = new SvelteUIElement(ThemeViewGUI, { state })

View file

@ -96,7 +96,7 @@
</script>
<script src="./index.ts" type="module"></script>
<script src="./src/index.ts" type="module"></script>
<script async data-goatcounter="https://pietervdvn.goatcounter.com/count" src="//gc.zgo.at/count.js"></script>
<script>