From 12ec9778aac22c3e446bfe91b6064d737c69f8bb Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Thu, 27 Jan 2022 01:42:53 -0500 Subject: [PATCH] build: fix presets caching --- .github/scripts/presets_examples.mjs | 2 +- source/app/web/instance.mjs | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/scripts/presets_examples.mjs b/.github/scripts/presets_examples.mjs index 9d1d9f7b..914d8923 100644 --- a/.github/scripts/presets_examples.mjs +++ b/.github/scripts/presets_examples.mjs @@ -44,7 +44,7 @@ for (const path of await fs.readdir(__presets)) { //Example console.log(`generating: ${preset}/example.svg`) - const svg = await web.run({ config_presets: `@${preset}`, plugins_errors_fatal: true, verify: true, optimize: "css, xml" }) + const svg = await web.run({ config_presets: `@${preset}`, plugins_errors_fatal: true }) await fs.writeFile(paths.join(__presets, path, "example.svg"), svg) staged.add(paths.join(__presets, path, "example.svg")) diff --git a/source/app/web/instance.mjs b/source/app/web/instance.mjs index 8df66cd2..872b1523 100644 --- a/source/app/web/instance.mjs +++ b/source/app/web/instance.mjs @@ -15,17 +15,13 @@ import setup from "../metrics/setup.mjs" export default async function({sandbox} = {}) { //Load configuration settings const {conf, Plugins, Templates} = await setup({sandbox}) - const {token, maxusers = 0, restricted = [], debug = false, cached = 30 * 60 * 1000, port = 3000, ratelimiter = null, plugins = null} = conf.settings - const mock = sandbox || conf.settings.mocked - //Sandbox mode if (sandbox) { console.debug("metrics/app > sandbox mode is specified, enabling advanced features") - conf.settings.extras = conf.settings.extras ?? {} - conf.settings.extras.default = true - conf.settings["plugins.default"] = true - conf.settings.optimize = true + Object.assign(conf.settings, {optimize: true, cached:0, "plugins.default":true, extras:{default:true}}) } + const {token, maxusers = 0, restricted = [], debug = false, cached = 30 * 60 * 1000, port = 3000, ratelimiter = null, plugins = null} = conf.settings + const mock = sandbox || conf.settings.mocked //Process mocking and default plugin state for (const plugin of Object.keys(Plugins).filter(x => !["base", "core"].includes(x))) {