Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/website/e2e/website.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('pricing page shows 4 plan cards', async ({ page }) => {
test('pricing page lead form validates required fields', async ({ page }) => {
await page.goto('/pricing');
await page.click('button[type="submit"]');
await expect(page.locator('form')).toBeVisible();
await expect(page.locator('form').first()).toBeVisible();
});

test('docs page renders sidebar and content', async ({ page }) => {
Expand Down
16 changes: 15 additions & 1 deletion scripts/assemble-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* npx tsx scripts/assemble-examples.ts --skip-build
*/
import { execSync } from 'child_process';
import { cpSync, mkdirSync, rmSync, existsSync, writeFileSync } from 'fs';
import { cpSync, mkdirSync, rmSync, existsSync, writeFileSync, readFileSync } from 'fs';
import { resolve } from 'path';

const root = resolve(__dirname, '..');
Expand Down Expand Up @@ -54,6 +54,20 @@ for (const cap of capabilities) {

mkdirSync(dest, { recursive: true });
cpSync(src, dest, { recursive: true });

// Fix <base href="/"> to point to the correct subpath so assets resolve correctly.
// Without this, main.js/styles.css/chunks load from the root (/) instead of
// /{product}/{topic}/ and return 404 in production.
const indexPath = resolve(dest, 'index.html');
if (existsSync(indexPath)) {
const html = readFileSync(indexPath, 'utf-8');
const fixed = html.replace(
'<base href="/">',
`<base href="/${cap.product}/${cap.topic}/">`,
);
writeFileSync(indexPath, fixed);
}

console.log(`✅ ${cap.product}/${cap.topic}`);
}

Expand Down