Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/collect-i18n-general.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as fs from 'fs'

// Import Vite define shim to make __DISTRIBUTION__ and other define variables available
import './vite-define-shim'

import { DESKTOP_DIALOGS } from '../apps/desktop-ui/src/constants/desktopDialogs'
import { comfyPageFixture as test } from '../browser_tests/fixtures/ComfyPage'
import {
Expand Down
33 changes: 33 additions & 0 deletions scripts/vite-define-shim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Shim for Vite define variables to make them available during Playwright test execution
* This file should be imported before any code that uses Vite define variables
*/

// Define global constants that Vite would normally replace at build time
declare global {
const __COMFYUI_FRONTEND_VERSION__: string
const __SENTRY_ENABLED__: boolean
const __SENTRY_DSN__: string
const __ALGOLIA_APP_ID__: string
const __ALGOLIA_API_KEY__: string
const __USE_PROD_CONFIG__: boolean
const __DISTRIBUTION__: 'desktop' | 'localhost' | 'cloud'
}

// Set default values for Playwright test environment
;(globalThis as any).__COMFYUI_FRONTEND_VERSION__ =
process.env.npm_package_version || '1.0.0'
;(globalThis as any).__SENTRY_ENABLED__ = false
;(globalThis as any).__SENTRY_DSN__ = ''
;(globalThis as any).__ALGOLIA_APP_ID__ = ''
;(globalThis as any).__ALGOLIA_API_KEY__ = ''
;(globalThis as any).__USE_PROD_CONFIG__ = false
;(globalThis as any).__DISTRIBUTION__ = 'localhost'

// Provide a minimal window shim for Node environment
// This is needed for code that checks window existence during imports
if (typeof window === 'undefined') {
;(globalThis as any).window = {}
}

export {}
Loading