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), );