Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

1.9 KB
Raw Blame
import { describe, it, expect } from 'vitest';
import { readFileSync, existsSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';

import { BUILD_HINT, DIST_DIR as dist, HAS_FRONTEND_BUILD } from './helpers/dist-built.js';

const __dirname = dirname(fileURLToPath(import.meta.url));
const repoRoot = resolve(__dirname, '..');

// The deploy chain writes sub-artifacts into dist/ before the frontend build
// runs, so the directory existing proved nothing: on a tree built only that far
// this suite failed on every page it looked for. HAS_FRONTEND_BUILD asks the
// question that matters.
if (!HAS_FRONTEND_BUILD) console.warn(`[build-asset-paths] skipping: ${BUILD_HINT}`);

// Guards against the regression where /style.css 404'd in production
// because public/* HTML rollup inputs collide with the public-dir copy.
// If you see this fail, the deployed site is likely about to break the
// same way studio did on 2026-04-27.
describe.skipIf(!HAS_FRONTEND_BUILD)('build asset paths', () => {

	it('serves /style.css from dist root', () => {
		expect(existsSync(resolve(dist, 'style.css'))).toBe(true);
	});

	const pagesReferencingStyleCss = [
		'studio/index.html',
		'discover/index.html',
		'widgets-gallery/index.html',
		'docs-widgets.html',
	];

	for (const rel of pagesReferencingStyleCss) {
		it(`${rel} references a resolvable stylesheet`, () => {
			const file = resolve(dist, rel);
			if (!existsSync(file)) return; // page may not exist in this build target
			const html = readFileSync(file, 'utf8');
			const refs = [...html.matchAll(/href="([^"]+\.css)"/g)].map((m) => m[1]);
			for (const href of refs) {
				if (!href.startsWith('/')) continue;
				const local = resolve(dist, href.slice(1));
				expect(
					existsSync(local),
					`${rel} references ${href} which is not present in dist/`,
				).toBe(true);
			}
		});
	}
});