Files
ComfyUI_frontend/vite.electron.config.mts
snomiao c004a2b8bd chore(tsconfig): ensure complete TypeScript coverage for all project files (#5655)
## Summary
- Added missing directories and files to tsconfig.json to ensure
complete TypeScript type checking coverage
- Expanded config file patterns to include all .mts configuration files
- Verified all 908 TypeScript files in the project are now properly
covered

## Changes
- Added `scripts/**/*.ts` to cover all TypeScript files in scripts
directory (i18n collection, CI/CD scripts)
- Added `build/**/*.ts` to cover customIconCollection.ts and future
build scripts
- Changed `vite.config.mts` to `*.config.mts` to include all vite config
files (vite.electron.config.mts, vite.types.config.mts)

## Test plan
- [x] Run `pnpm typecheck` to verify no TypeScript errors
- [x] Verified all TypeScript files are covered by tsconfig patterns
- [x] browser_tests/ directory confirmed to have its own extending
tsconfig

🤖 Generated with [Claude Code](https://claude.ai/code)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5655-chore-tsconfig-ensure-complete-TypeScript-coverage-for-all-project-files-2736d73d36508103acbadc53ca2b2913)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2025-09-23 09:31:30 -07:00

90 lines
2.8 KiB
TypeScript

import { defineConfig, mergeConfig } from 'vite'
import type { Plugin } from 'vite'
import baseConfig from './vite.config.mts'
const mockElectronAPI: Plugin = {
name: 'mock-electron-api',
transformIndexHtml() {
return [
{
tag: 'script',
children: `window.electronAPI = {
restartApp: () => {
alert('restartApp')
},
sendReady: () => {},
onShowSelectDirectory: () => {},
onFirstTimeSetupComplete: () => {},
onProgressUpdate: () => {},
onLogMessage: () => {},
isFirstTimeSetup: () => Promise.resolve(true),
getSystemPaths: () =>
Promise.resolve({
appData: 'C:/Users/username/AppData/Roaming',
appPath: 'C:/Program Files/comfyui-electron/resources/app',
defaultInstallPath: 'bad'
}),
validateInstallPath: (path) => {
if (path === 'bad') {
return { isValid: false, error: 'Bad path!' }
}
return { isValid: true }
},
migrationItems: () =>
Promise.resolve([
{
id: 'user_files',
label: 'User Files',
description: 'Settings and user-created workflows'
}
]),
validateComfyUISource: (path) => {
if (path === 'bad') {
return { isValid: false, error: 'Bad path!' }
}
return { isValid: true }
},
showDirectoryPicker: () => Promise.resolve('C:/Users/username/comfyui-electron/1'),
DownloadManager: {
getAllDownloads: () => Promise.resolve([]),
onDownloadProgress: () => {}
},
getElectronVersion: () => Promise.resolve('1.0.0'),
getComfyUIVersion: () => '9.9.9',
getPlatform: () => 'win32',
changeTheme: () => {},
Config: {
setWindowStyle: () => {},
getWindowStyle: () => Promise.resolve('default'),
getDetectedGpu: () => Promise.resolve('nvidia')
},
Events: {
trackEvent: (event_name, event_data) => {
console.log('trackEvent', event_name, event_data)
},
incrementUserProperty: (property, value) => {
console.log('incrementUserProperty', property, value)
}
},
NetWork: {
canAccessUrl: (url) => {
const canAccess = url.includes('good')
console.log('canAccessUrl', url, canAccess)
return new Promise((resolve) => setTimeout(() => resolve(canAccess), 10000))
}
},
setMetricsConsent: (consent) => {}
};`
}
]
}
}
export default mergeConfig(
baseConfig,
defineConfig({
plugins: [mockElectronAPI]
})
)