From 32cfd6c51330062a9648d80f4c9172a72ca63237 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:59:00 +0800 Subject: [PATCH] fix: normalize remaining Windows gate paths --- scripts/repo-files.ts | 9 +++++---- scripts/verify-translation-pairing.ts | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/repo-files.ts b/scripts/repo-files.ts index e6d50e7627..8642b9963f 100644 --- a/scripts/repo-files.ts +++ b/scripts/repo-files.ts @@ -1,7 +1,7 @@ /** Shared repository file discovery and line-oriented reference scanning. */ import { globSync, readFileSync, realpathSync } from 'node:fs' -import { relative, resolve } from 'node:path' +import { relative, resolve, sep } from 'node:path' /** One authored path plus its canonical target for symlink deduplication. */ export interface RepoFile { @@ -37,8 +37,9 @@ export function uniqueRepoFiles( const files: RepoFile[] = [] for (const pattern of patterns) { for (const match of globSync(pattern, { cwd: root })) { - if (isExcluded(match)) continue - const abs = resolve(root, match) + const repoPath = match.split(sep).join('/') + if (isExcluded(repoPath)) continue + const abs = resolve(root, repoPath) const real = realpathSync(abs) if (seen.has(real)) continue seen.add(real) @@ -65,7 +66,7 @@ export function findReferenceViolations( normalize: (raw: string) => string, isViolation: (ref: string) => boolean, ): ReferenceViolation[] { - const file = relative(root, absPath) + const file = relative(root, absPath).split(sep).join('/') const out: ReferenceViolation[] = [] const lines = readFileSync(absPath, 'utf8').split('\n') for (let i = 0; i < lines.length; i++) { diff --git a/scripts/verify-translation-pairing.ts b/scripts/verify-translation-pairing.ts index eaeacb34d2..4aaf7de79b 100644 --- a/scripts/verify-translation-pairing.ts +++ b/scripts/verify-translation-pairing.ts @@ -9,7 +9,7 @@ import { createHash } from 'node:crypto' import { existsSync, globSync, readFileSync, writeFileSync } from 'node:fs' -import { basename, join, resolve } from 'node:path' +import { basename, join, resolve, sep } from 'node:path' import { fromMarkdown } from 'mdast-util-from-markdown' import { gfmFromMarkdown } from 'mdast-util-gfm' import { gfm } from 'micromark-extension-gfm' @@ -176,7 +176,7 @@ function parse(content: string): Nodes { // Enumerate the scope once. const files = new Set() for (const pattern of SCOPE_PATTERNS) { - for (const match of globSync(pattern, { cwd: root })) files.add(match) + for (const match of globSync(pattern, { cwd: root })) files.add(match.split(sep).join('/')) } const translations = [...files].filter(f => f.endsWith('.zh.md')).sort() const metas = [...files].filter(f => f.endsWith('.i18n.yaml')).sort()