From 8e60963584e64904c6dc689de2775d1e9fab9882 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:49:52 -0400 Subject: [PATCH 01/13] fix(ci): vercel --- .github/scripts/preview.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 8763bec790b..c50af8246e1 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -56,7 +56,6 @@ fs.copyFile(paths.join(__web, "style.vars.css"), paths.join(__preview_css, "styl fs.copyFile(paths.join(__node_modules, "prismjs/themes/prism-tomorrow.css"), paths.join(__preview_css, "style.prism.css")) //Scripts fs.writeFile(paths.join(__preview_js, "app.js"), `${await fs.readFile(paths.join(__web, "app.js"))}`) -fs.writeFile(paths.join(__preview_js, "app.placeholder.js"), `${await fs.readFile(paths.join(__web, "app.placeholder.js"))}`) fs.copyFile(paths.join(__node_modules, "ejs/ejs.min.js"), paths.join(__preview_js, "ejs.min.js")) fs.writeFile(paths.join(__preview_js, "faker.min.js"), "import {faker} from '/.js/faker/index.mjs';globalThis.faker=faker;globalThis.placeholder.init(globalThis)") for (const path of [[], ["locale"]]) { @@ -76,8 +75,13 @@ fs.copyFile(paths.join(__node_modules, "prismjs/components/prism-yaml.min.js"), fs.copyFile(paths.join(__node_modules, "prismjs/components/prism-markdown.min.js"), paths.join(__preview_js, "prism.markdown.min.js")) fs.copyFile(paths.join(__node_modules, "clipboard/dist/clipboard.min.js"), paths.join(__preview_js, "clipboard.min.js")) //Meta +fs.writeFile(paths.join(__preview, ".modes"), JSON.stringify(["embed", "insights"])) fs.writeFile(paths.join(__preview, ".version"), JSON.stringify(`${conf.package.version}-preview`)) fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", link: "https://github.com/lowlighter/metrics"})) +//Embed +fs.writeFile(paths.join(__preview_js, "embed/index.html"), `${await fs.readFile(paths.join(__web, "embed/index.html"))}`) +fs.writeFile(paths.join(__preview_js, "embed/app.js"), `${await fs.readFile(paths.join(__web, "embed/app.js"))}`) +fs.writeFile(paths.join(__preview_js, "embed/app.placeholder.js"), `${await fs.readFile(paths.join(__web, "embed/app.placeholder.js"))}`) //Insights for (const insight of ["insights", "about"]) { const __web_insights = paths.join(paths.join(__web, insight)) From 90df0cffd8dc5ca7011e619feee4d79a2cc04e5c Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:53:32 -0400 Subject: [PATCH 02/13] Update preview.mjs --- .github/scripts/preview.mjs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index c50af8246e1..3f2df554d23 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -79,9 +79,16 @@ fs.writeFile(paths.join(__preview, ".modes"), JSON.stringify(["embed", "insights fs.writeFile(paths.join(__preview, ".version"), JSON.stringify(`${conf.package.version}-preview`)) fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", link: "https://github.com/lowlighter/metrics"})) //Embed -fs.writeFile(paths.join(__preview_js, "embed/index.html"), `${await fs.readFile(paths.join(__web, "embed/index.html"))}`) -fs.writeFile(paths.join(__preview_js, "embed/app.js"), `${await fs.readFile(paths.join(__web, "embed/app.js"))}`) -fs.writeFile(paths.join(__preview_js, "embed/app.placeholder.js"), `${await fs.readFile(paths.join(__web, "embed/app.placeholder.js"))}`) +{ + const __web_embed = paths.join(paths.join(__web, "embed")) + const __preview_embed = paths.join(__preview, `${insight}/.statics`) + const __preview_embed_js = paths.join(__preview_embed, ".js/embed") + await fs.mkdir(__preview_embed, {recursive: true}) + await fs.mkdir(__preview_embed_js, {recursive: true}) + fs.writeFile(paths.join(__preview_embed, "index.html"), `${await fs.readFile(paths.join(__web_embed, "index.html"))}`) + fs.writeFile(paths.join(__preview_embed_js, "app.js"), `${await fs.readFile(paths.join(__web_embed, "app.js"))}`) + fs.writeFile(paths.join(__preview_embed_js, "app.placeholder.js"), `${await fs.readFile(paths.join(__web_embed, "app.placeholder.js"))}`) +} //Insights for (const insight of ["insights", "about"]) { const __web_insights = paths.join(paths.join(__web, insight)) From 251a7e6647bc71298e8645de5f8fd93fd0c7563f Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:54:40 -0400 Subject: [PATCH 03/13] Update preview.mjs --- .github/scripts/preview.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 3f2df554d23..02a273a4c82 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -90,12 +90,12 @@ fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", li fs.writeFile(paths.join(__preview_embed_js, "app.placeholder.js"), `${await fs.readFile(paths.join(__web_embed, "app.placeholder.js"))}`) } //Insights -for (const insight of ["insights", "about"]) { - const __web_insights = paths.join(paths.join(__web, insight)) - const __preview_insights = paths.join(__preview, `${insight}/.statics`) +for (const insights of ["insights", "about"]) { + const __web_insights = paths.join(paths.join(__web, "insight")) + const __preview_insights = paths.join(__preview, `${insights}/.statics`) await fs.mkdir(__preview_insights, {recursive: true}) - fs.copyFile(paths.join(__web, insight, "index.html"), paths.join(__preview, insight, "index.html")) + fs.copyFile(paths.join(__web, insights, "index.html"), paths.join(__preview, insights, "index.html")) for (const file of await fs.readdir(__web_insights)) { if (file !== ".statics") fs.copyFile(paths.join(__web_insights, file), paths.join(__preview_insights, file)) From 795bd462dace629d63be35e5ead3766475c7eb7a Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:56:52 -0400 Subject: [PATCH 04/13] Update preview.mjs --- .github/scripts/preview.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 02a273a4c82..221d87a93a7 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -81,7 +81,7 @@ fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", li //Embed { const __web_embed = paths.join(paths.join(__web, "embed")) - const __preview_embed = paths.join(__preview, `${insight}/.statics`) + const __preview_embed = paths.join(__preview, "embed") const __preview_embed_js = paths.join(__preview_embed, ".js/embed") await fs.mkdir(__preview_embed, {recursive: true}) await fs.mkdir(__preview_embed_js, {recursive: true}) From 8b9620576cc51dd96d6efa38deccc133550296c8 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:58:30 -0400 Subject: [PATCH 05/13] Update preview.mjs --- .github/scripts/preview.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 221d87a93a7..8bde82eaeae 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -91,7 +91,7 @@ fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", li } //Insights for (const insights of ["insights", "about"]) { - const __web_insights = paths.join(paths.join(__web, "insight")) + const __web_insights = paths.join(paths.join(__web, "insights")) const __preview_insights = paths.join(__preview, `${insights}/.statics`) await fs.mkdir(__preview_insights, {recursive: true}) From 6f08f913080eef0891be38ff83a86f27194ccb65 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Wed, 6 Jul 2022 00:01:34 -0400 Subject: [PATCH 06/13] update --- .github/scripts/preview.mjs | 2 +- source/app/web/statics/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 8bde82eaeae..66ad3ffdea4 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -82,7 +82,7 @@ fs.writeFile(paths.join(__preview, ".hosted"), JSON.stringify({by: "metrics", li { const __web_embed = paths.join(paths.join(__web, "embed")) const __preview_embed = paths.join(__preview, "embed") - const __preview_embed_js = paths.join(__preview_embed, ".js/embed") + const __preview_embed_js = paths.join(__preview_js, "embed") await fs.mkdir(__preview_embed, {recursive: true}) await fs.mkdir(__preview_embed_js, {recursive: true}) fs.writeFile(paths.join(__preview_embed, "index.html"), `${await fs.readFile(paths.join(__web_embed, "index.html"))}`) diff --git a/source/app/web/statics/index.html b/source/app/web/statics/index.html index 10c9b0a9b2a..2b0469cf3ef 100644 --- a/source/app/web/statics/index.html +++ b/source/app/web/statics/index.html @@ -65,7 +65,7 @@