preview-config: pin the preview scene style (ridge unless given) now that config.json says terrain
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 4m5s

Soul: the repo config now carries the live style, so previews would have turned terrain.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Void 2026-11-11 21:08:53 +00:00
commit 4b7697aaeb

View file

@ -1,5 +1,6 @@
// Preview builds: set the background scene tier in dist/config.json (default 'low'); config.json
// in the repo is the live chat.gamecult.org config. Previews are static directories with no SPA fallback, so they also switch
// in the repo is the live chat.gamecult.org config (style terrain), so previews pin the style too, ridge unless
// given. Previews are static directories with no SPA fallback, so they also switch
// to the hash router: a reload on /login/matrix.org would otherwise be an nginx 404. With --demo it
// also switches on the pretend homeserver (src/preview-demo): previewDemo true, and the pretend
// server as the only homeserver. Usage:
@ -10,11 +11,11 @@ import { fileURLToPath } from 'url';
const args = process.argv.slice(2);
const demo = args.includes('--demo');
const [tier = 'low', style] = args.filter((a) => !a.startsWith('--'));
const [tier = 'low', style = 'ridge'] = args.filter((a) => !a.startsWith('--'));
const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'dist', 'config.json');
const config = JSON.parse(fs.readFileSync(file, 'utf8'));
config.hashRouter = { enabled: true, basename: '/' };
config.backgroundScene = { ...config.backgroundScene, tier, ...(style ? { style } : {}) };
config.backgroundScene = { ...config.backgroundScene, tier, style };
if (demo) {
config.previewDemo = true;
config.defaultHomeserver = 0;
@ -29,5 +30,5 @@ if (demo) {
}
fs.writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`);
console.log(
`${file}: backgroundScene.tier = ${tier}${style ? `, style = ${style}` : ''}${demo ? ', previewDemo on' : ''}`
`${file}: backgroundScene.tier = ${tier}, style = ${style}${demo ? ', previewDemo on' : ''}`
);