Move webmanifest files into 'public' directory

This commit is contained in:
Pieter Vander Vennet 2023-02-09 16:19:08 +01:00
parent df92bda151
commit 90f69bdd93
2 changed files with 10 additions and 6 deletions

2
.gitignore vendored
View file

@ -36,3 +36,5 @@ service-worker.js
# Built Visual Studio Code Extensions # Built Visual Studio Code Extensions
*.vsix *.vsix
public/*.webmanifest
public/assets/generated/

View file

@ -23,7 +23,7 @@ async function createIcon(iconPath: string, size: number, alreadyWritten: string
name = name.substr(2) name = name.substr(2)
} }
const newname = `assets/generated/images/${name.replace(/\//g, "_")}${size}.png` const newname = `public/assets/generated/images/${name.replace(/\//g, "_")}${size}.png`
if (alreadyWritten.indexOf(newname) >= 0) { if (alreadyWritten.indexOf(newname) >= 0) {
return newname return newname
@ -60,7 +60,7 @@ async function createSocialImage(layout: LayoutConfig, template: "" | "Wide"): P
) )
return undefined return undefined
} }
const path = `./assets/generated/images/social_image_${layout.id}_${template}.svg` const path = `./public/assets/generated/images/social_image_${layout.id}_${template}.svg`
if (existsSync(path)) { if (existsSync(path)) {
return path return path
} }
@ -121,7 +121,7 @@ async function createManifest(
// This is an svg. Lets create the needed pngs and do some checkes! // This is an svg. Lets create the needed pngs and do some checkes!
const whiteBackgroundPath = const whiteBackgroundPath =
"./assets/generated/images/theme_" + layout.id + "_white_background.svg" "./public/assets/generated/images/theme_" + layout.id + "_white_background.svg"
{ {
const svg = await ScriptUtils.ReadSvg(icon) const svg = await ScriptUtils.ReadSvg(icon)
const width: string = svg.$.width const width: string = svg.$.width
@ -136,7 +136,7 @@ async function createManifest(
let path = layout.icon let path = layout.icon
if (layout.icon.startsWith("<")) { if (layout.icon.startsWith("<")) {
// THis is already the svg // THis is already the svg
path = "./assets/generated/images/" + layout.id + "_logo.svg" path = "./public/assets/generated/images/" + layout.id + "_logo.svg"
writeFileSync(path, layout.icon) writeFileSync(path, layout.icon)
} }
@ -235,7 +235,7 @@ async function createLandingPage(layout: LayoutConfig, manifest, whiteIcons, alr
let icon = layout.icon let icon = layout.icon
if (icon.startsWith("<?xml") || icon.startsWith("<svg")) { if (icon.startsWith("<?xml") || icon.startsWith("<svg")) {
// This already is an svg // This already is an svg
icon = `./assets/generated/images/${layout.id}_icon.svg` icon = `./public/assets/generated/images/${layout.id}_icon.svg`
writeFileSync(icon, layout.icon) writeFileSync(icon, layout.icon)
} }
@ -311,7 +311,9 @@ async function main(): Promise<void> {
createDir("./assets/generated") createDir("./assets/generated")
createDir("./assets/generated/layers") createDir("./assets/generated/layers")
createDir("./assets/generated/themes") createDir("./assets/generated/themes")
createDir("./assets/generated/images") createDir("./public/assets/")
createDir("./public/assets/generated")
createDir("./public/assets/generated/images")
const blacklist = [ const blacklist = [
"", "",