- 统一语义 token、排版、容器与共享组件样式,新增 Header / Footer / Section - 首页改为五段叙事:首屏、三栏文稿演示、人机协作价值、生态摘要、结束行动区 - 保留并完善「从一篇文稿开始」三栏演示:四种模式、状态共享、输入校验、CLI 实测依据 - 页脚改为双栏各自居中、头像位于姓名之上的悬挂式结构 - 文档导航直达 Gitea Wiki;/docs/ 与 /en/docs/ 改为迁移页,移除 Pagefind 与重复文档 - 下载中心以 Marqdo / MQDH 两个产品入口开始,发行数据契约不变 - 生态、研究、反馈、隐私、关于页按新体系重构;新增真实 404 入口 - 更新 verify-dist、Playwright 用例、README、index.mq.md、架构与运维说明 - 新增 EdgeOne Pages 发布流水线与部署验收脚本
65 lines
2.7 KiB
JavaScript
65 lines
2.7 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
// Verifies a production deployment produced by
|
|
// `edgeone makers deploy --json`. The deployment URL carries a one-time
|
|
// `eo_token`/`eo_time` pair: the first request answers 302 and sets cookies,
|
|
// later requests use the cookie. Every probe therefore performs its own
|
|
// handshake, and the token query is kept for the 404 probe.
|
|
|
|
const file = process.argv[2] ?? 'deploy-result.json';
|
|
const lines = readFileSync(file, 'utf8').trim().split('\n').filter(line => line.startsWith('{'));
|
|
assert.ok(lines.length > 0, `${file}: no JSON deployment result`);
|
|
const result = JSON.parse(lines[lines.length - 1]);
|
|
|
|
assert.equal(result.status, 'success', `Deployment did not succeed: ${JSON.stringify(result)}`);
|
|
assert.ok(result.deploymentId, 'Deployment result is missing deploymentId');
|
|
assert.ok(result.projectId, 'Deployment result is missing projectId');
|
|
assert.match(result.url ?? '', /^https:\/\//, 'Deployment result is missing an https url');
|
|
|
|
const timeout = 30_000;
|
|
|
|
function probeURL(pathname) {
|
|
const url = new URL(result.url);
|
|
url.pathname = pathname;
|
|
return url;
|
|
}
|
|
|
|
async function probe(pathname) {
|
|
const entry = probeURL(pathname);
|
|
let response = await fetch(entry, { redirect: 'manual', signal: AbortSignal.timeout(timeout) });
|
|
if (response.status >= 300 && response.status < 400) {
|
|
const location = response.headers.get('location');
|
|
assert.ok(location, `${pathname}: redirect without location`);
|
|
const cookie = response.headers.getSetCookie().map(value => value.split(';')[0]).join('; ');
|
|
assert.ok(cookie, `${pathname}: access token redirect without cookie`);
|
|
response = await fetch(new URL(location, entry), {
|
|
redirect: 'manual',
|
|
headers: { cookie },
|
|
signal: AbortSignal.timeout(timeout),
|
|
});
|
|
}
|
|
return { status: response.status, body: await response.text() };
|
|
}
|
|
|
|
const home = await probe('/');
|
|
assert.equal(home.status, 200, `Home returned HTTP ${home.status}`);
|
|
for (const marker of ['Marqdo', '\u00a9 2026 CFLMY', '\u8c6bICP\u59072025120352\u53f7-6']) {
|
|
assert.ok(home.body.includes(marker), `Home is missing marker: ${marker}`);
|
|
}
|
|
|
|
const english = await probe('/en/');
|
|
assert.equal(english.status, 200, `English home returned HTTP ${english.status}`);
|
|
assert.ok(english.body.includes('Marqdo'), 'English home is missing the site title');
|
|
|
|
const missing = await probe('/__verify_absent__');
|
|
assert.equal(missing.status, 404, `Absent path returned HTTP ${missing.status}`);
|
|
|
|
console.log(JSON.stringify({
|
|
status: 'verified',
|
|
projectId: result.projectId,
|
|
deploymentId: result.deploymentId,
|
|
url: result.url,
|
|
checked: ['home', 'english-home', 'not-found'],
|
|
}));
|