Skip to content

Commit ea65d7f

Browse files
refactor(scripts): remove obsolete blog i18n verification checks
Remove verifyRenderedBlogI18nControls and its helpers from verify-blog-i18n-build.mjs since BlogI18nControls was removed from the listing page. Remove route-continuity assertions between zh and en blog indexes from verify-blog-sidebar-i18n.mjs. Co-Authored-By: Hagicode <noreply@hagicode.com> Signed-off-by: newbe36524 <newbe36524@qq.com>
1 parent 71e1c84 commit ea65d7f

2 files changed

Lines changed: 0 additions & 65 deletions

File tree

scripts/verify-blog-i18n-build.mjs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,6 @@
1-
import fs from 'node:fs';
2-
import path from 'node:path';
3-
41
import { REQUIRED_BLOG_LOCALES, validateBlogI18nCompleteness } from './verify-blog-i18n-completeness.mjs';
52
import './verify-blog-sidebar-i18n.mjs';
63

7-
const distDir = path.resolve(process.cwd(), 'dist');
8-
9-
function readBuildFile(relativePath) {
10-
const fullPath = path.join(distDir, relativePath);
11-
if (!fs.existsSync(fullPath)) {
12-
throw new Error(`Missing build artifact: ${relativePath}`);
13-
}
14-
15-
return fs.readFileSync(fullPath, 'utf8');
16-
}
17-
18-
function getBlogIndexPath(locale) {
19-
return locale.routeLocale === 'root'
20-
? 'blog/index.html'
21-
: path.join(locale.routeLocale, 'blog/index.html');
22-
}
23-
24-
function assertIncludes(html, expected, route) {
25-
if (!html.includes(expected)) {
26-
throw new Error(`${route} is missing expected blog i18n output: ${expected}`);
27-
}
28-
}
29-
30-
function assertExcludes(html, unexpected, route) {
31-
if (html.includes(unexpected)) {
32-
throw new Error(`${route} still renders deprecated blog i18n output: ${unexpected}`);
33-
}
34-
}
35-
36-
function verifyRenderedBlogI18nControls() {
37-
for (const locale of REQUIRED_BLOG_LOCALES) {
38-
const route = getBlogIndexPath(locale);
39-
const html = readBuildFile(route);
40-
41-
assertExcludes(html, '/blog/rss.xml', route);
42-
assertIncludes(html, '/blog/rss.zh-CN.xml', route);
43-
assertIncludes(html, '/blog/rss.en.xml', route);
44-
assertIncludes(html, '/blog/rss.ja-JP.xml', route);
45-
assertIncludes(html, '/blog/rss.ru-RU.xml', route);
46-
assertIncludes(html, `aria-current=\"page\"`, route);
47-
}
48-
}
49-
504
const completeness = await validateBlogI18nCompleteness();
515
if (!completeness.ok) {
526
for (const diagnostic of completeness.diagnostics) {
@@ -55,5 +9,4 @@ if (!completeness.ok) {
559
throw new Error(`Blog i18n completeness failed with ${completeness.diagnostics.length} diagnostics.`);
5610
}
5711

58-
verifyRenderedBlogI18nControls();
5912
console.log(`Verified blog i18n build output for ${REQUIRED_BLOG_LOCALES.length} desktop languages.`);

scripts/verify-blog-sidebar-i18n.mjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,6 @@ function verifyNavigation() {
109109
);
110110
});
111111

112-
runCheck('route_continuity_zh_to_en', zhRoute, () => {
113-
const zhToEnPattern = /(?:href|value)=["']\/en-US\/blog\/["']/i;
114-
assert(
115-
zhToEnPattern.test(zhBlogIndex),
116-
'Chinese blog index is missing route continuity link to /en-US/blog/.',
117-
zhRoute
118-
);
119-
});
120-
121-
runCheck('route_continuity_en_to_zh', enRoute, () => {
122-
const enToZhPattern = /(?:href|value)=["']\/blog\/["']/i;
123-
assert(
124-
enToZhPattern.test(enBlogIndex),
125-
'English blog index is missing route continuity link to /blog/.',
126-
enRoute
127-
);
128-
});
129-
130112
runCheck('zh_sidebar_i18n_keys_resolved', zhRoute, () => {
131113
assert(
132114
!hasUnresolvedBlogI18nKey(zhBlogIndex),

0 commit comments

Comments
 (0)