- After sign-in a 7-step spotlight tour shows students around (replay from the menu); ends on Esc or navigation - Course cards: edge-to-edge photo, student count (Course.enrolledCount), arrow that inverts on hover (fixes white-on-white hover in dark mode) - Landing: stats removed; How it works uses abstract CSS art; payment card grouped by mobile money, bank cards and from abroad; step 2 copy covers local and international payment - SEO: metadata (title template, description, keywords, canonical, Open Graph, Twitter), per-route titles, EducationalOrganization JSON-LD with founder Rezina Brhane and her TikTok, robots.txt, sitemap.xml; same tags on the waitlist page - Footers link the founder's TikTok - Backend issue drafted: design/issues/enrollment-counts.md - Smoke test: blocks third-party requests (Vimeo iframe stalled unloads), tolerates a missed load event; it caught a hook-order crash on the course page, fixed here Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
2.2 KiB
JavaScript
35 lines
2.2 KiB
JavaScript
// CI check: loads the inlined demo in jsdom with ALL network blocked and fails if the page
|
|
// tries to fetch or load any script (e.g. a lazy chunk or an RSC .txt payload), or throws.
|
|
// Usage: node tools/artifact-check.mjs dist/demo.html
|
|
import { JSDOM, VirtualConsole } from 'jsdom'; import fs from 'fs';
|
|
const file = process.argv[2] || 'dist/demo.html';
|
|
const errors = [], network = [];
|
|
const vc = new VirtualConsole();
|
|
vc.on('jsdomError', (e) => errors.push(String(e.message)));
|
|
const dom = new JSDOM(fs.readFileSync(file, 'utf8'), {
|
|
runScripts: 'dangerously', url: 'https://artifact.local/', virtualConsole: vc, pretendToBeVisual: true,
|
|
beforeParse(w) {
|
|
Object.assign(w, { TextEncoder, TextDecoder, MessageChannel, ReadableStream, structuredClone });
|
|
w.fetch = (u) => { network.push(`fetch ${u}`); return Promise.reject(new Error('blocked')); };
|
|
const create = w.document.createElement.bind(w.document);
|
|
w.document.createElement = (tag, ...rest) => {
|
|
const el = create(tag, ...rest);
|
|
if (tag === 'script') {
|
|
const d = Object.getOwnPropertyDescriptor(w.HTMLScriptElement.prototype, 'src');
|
|
Object.defineProperty(el, 'src', { set(v) { network.push(`script ${v}`); d.set.call(el, v); }, get() { return d.get.call(el); } });
|
|
}
|
|
return el;
|
|
};
|
|
},
|
|
});
|
|
const w = dom.window;
|
|
await new Promise((r) => setTimeout(r, 2000));
|
|
for (const route of ['#/am', '#/am/courses', '#/en/help']) { w.location.hash = route; await new Promise((r) => setTimeout(r, 300)); }
|
|
// React can re-insert hoisted <link>/<script> tags at hydration; jsdom doesn't fetch them, so scan the DOM too.
|
|
for (const el of w.document.querySelectorAll('link[href]:not([rel=canonical]):not([rel=author]):not([rel=alternate]),script[src]')) // canonical/author/alternate are metadata, never fetched
|
|
network.push(`${el.tagName.toLowerCase()} ${el.getAttribute('href') ?? el.getAttribute('src')}`);
|
|
const allowed = (u) => /^(link|script) data:/.test(u) || /^link https:\/\/fonts\.(googleapis|gstatic)\.com/.test(u) || /cdnjs\.cloudflare\.com|cdn\.jsdelivr\.net\/npm|fonts\.googleapis\.com|fonts\.gstatic\.com/.test(u);
|
|
const bad = network.filter((n) => !allowed(n));
|
|
console.log({ networkAttempts: bad, errors });
|
|
process.exit(bad.length || errors.length ? 1 : 0);
|