2026-11-07 17:34:12 +00:00
|
|
|
// Preview builds: set the background scene tier in dist/config.json (default 'low'); config.json
|
2026-11-07 20:25:02 +00:00
|
|
|
// in the repo stays 'off'. Previews are static directories with no SPA fallback, so they also switch
|
2026-11-08 07:51:56 +00:00
|
|
|
// 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:
|
|
|
|
|
// node scripts/preview-config.js [tier] [style] [--demo]
|
2026-11-07 17:34:12 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import { fileURLToPath } from 'url';
|
|
|
|
|
|
2026-11-07 18:49:59 +00:00
|
|
|
const args = process.argv.slice(2);
|
|
|
|
|
const demo = args.includes('--demo');
|
2026-11-08 07:51:56 +00:00
|
|
|
const [tier = 'low', style] = args.filter((a) => !a.startsWith('--'));
|
2026-11-07 17:34:12 +00:00
|
|
|
const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'dist', 'config.json');
|
|
|
|
|
const config = JSON.parse(fs.readFileSync(file, 'utf8'));
|
2026-11-07 20:25:02 +00:00
|
|
|
config.hashRouter = { enabled: true, basename: '/' };
|
scene: terrain style, a baked Phacelle height map on a displaced grid lit by the baked sky
style 'terrain' (WebGL2, tier-gated, dynamic import): height map baked once on the
GPU into RGBA8 (promoted from the terrain-tier-spike), a displaced grid, the baked
gradient as sky, baked sun/ambient/haze. Sky from option, ?sky=, or the stars'
night notion. Cadence guard, pauses, context loss and compile failure follow the
ridge scene. preview-config.js takes an optional style argument.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 18:36:18 +00:00
|
|
|
config.backgroundScene = { ...config.backgroundScene, tier, ...(style ? { style } : {}) };
|
2026-11-07 18:49:59 +00:00
|
|
|
if (demo) {
|
|
|
|
|
config.previewDemo = true;
|
|
|
|
|
config.defaultHomeserver = 0;
|
|
|
|
|
config.homeserverList = ['demo.invalid'];
|
|
|
|
|
config.allowCustomHomeservers = false;
|
|
|
|
|
config.featuredCommunities = {
|
|
|
|
|
openAsDefault: false,
|
|
|
|
|
spaces: ['#gamecult:demo.invalid'],
|
|
|
|
|
rooms: [],
|
|
|
|
|
servers: ['demo.invalid'],
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-11-07 17:34:12 +00:00
|
|
|
fs.writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`);
|
2026-11-08 07:51:56 +00:00
|
|
|
console.log(
|
|
|
|
|
`${file}: backgroundScene.tier = ${tier}${style ? `, style = ${style}` : ''}${demo ? ', previewDemo on' : ''}`
|
|
|
|
|
);
|