From e4bdb95f6d7feaaa1cdb1fc23b56795640e2aebf Mon Sep 17 00:00:00 2001 From: kdletters Date: Sun, 21 Jun 2026 19:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=BD=90=E6=A1=8C=E9=9D=A2=E5=A3=B3?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9B=AE=E5=BD=95=E6=89=AB=E6=8F=8F=E8=BE=B9?= =?UTF-8?q?=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 排除 Tauri gen 目录进入桌面壳生产源码扫描 排除 Tauri autogenerated 权限目录进入替身词扫描 保留生成权限漂移和未跟踪文件门禁 --- apps/desktop-shell/scripts/check-config.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/desktop-shell/scripts/check-config.mjs b/apps/desktop-shell/scripts/check-config.mjs index dbaba5999..1dc6062e0 100644 --- a/apps/desktop-shell/scripts/check-config.mjs +++ b/apps/desktop-shell/scripts/check-config.mjs @@ -220,6 +220,10 @@ const productionFileExtensions = new Set(['.json', '.mjs', '.plist', '.rs', '.to const productionSourceExcludedDirectories = new Set([ 'target', ]); +const productionSourceExcludedRelativePaths = new Set([ + 'src-tauri/gen', + 'src-tauri/permissions/autogenerated', +]); const devScaffoldTerms = [ 'mo' + 'ck', 'fa' + 'ke', @@ -590,6 +594,11 @@ function assertCargoLockDirectDependency( function collectProductionSourceFiles(entry) { const stats = fs.statSync(entry); if (stats.isDirectory()) { + const relativePath = pathRelativeToDesktopShell(entry); + if (productionSourceExcludedRelativePaths.has(relativePath)) { + return []; + } + const directory = entry.href.endsWith('/') ? entry : new URL(`${entry.href}/`); return fs .readdirSync(entry, { withFileTypes: true }) @@ -616,6 +625,18 @@ function collectProductionSourceFiles(entry) { return [entry]; } +function pathRelativeToDesktopShell(entry) { + const desktopShellRoot = new URL('../', import.meta.url); + return pathRelative(desktopShellRoot.pathname, entry.pathname); +} + +function pathRelative(fromPath, toPath) { + return toPath + .slice(fromPath.length) + .replace(/^\/+/, '') + .replace(/\/$/, ''); +} + const productionSourceFiles = productionSourceRoots.flatMap((root) => collectProductionSourceFiles(root), );