build: fix presets caching

This commit is contained in:
lowlighter
2022-01-27 01:42:53 -05:00
parent b1137b3973
commit 12ec9778aa
2 changed files with 4 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ for (const path of await fs.readdir(__presets)) {
//Example //Example
console.log(`generating: ${preset}/example.svg`) 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) await fs.writeFile(paths.join(__presets, path, "example.svg"), svg)
staged.add(paths.join(__presets, path, "example.svg")) staged.add(paths.join(__presets, path, "example.svg"))

View File

@@ -15,17 +15,13 @@ import setup from "../metrics/setup.mjs"
export default async function({sandbox} = {}) { export default async function({sandbox} = {}) {
//Load configuration settings //Load configuration settings
const {conf, Plugins, Templates} = await setup({sandbox}) 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 //Sandbox mode
if (sandbox) { if (sandbox) {
console.debug("metrics/app > sandbox mode is specified, enabling advanced features") console.debug("metrics/app > sandbox mode is specified, enabling advanced features")
conf.settings.extras = conf.settings.extras ?? {} Object.assign(conf.settings, {optimize: true, cached:0, "plugins.default":true, extras:{default:true}})
conf.settings.extras.default = true
conf.settings["plugins.default"] = true
conf.settings.optimize = 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 //Process mocking and default plugin state
for (const plugin of Object.keys(Plugins).filter(x => !["base", "core"].includes(x))) { for (const plugin of Object.keys(Plugins).filter(x => !["base", "core"].includes(x))) {