|
| 1 | +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ |
| 2 | +/* eslint-disable @typescript-eslint/no-unsafe-argument */ |
| 3 | +import fs from 'node:fs'; |
| 4 | +import path from 'node:path'; |
| 5 | + |
| 6 | +/** |
| 7 | + * Verify the app build for the current platform. |
| 8 | + * Check that all required paths are present. |
| 9 | + */ |
| 10 | +const PATHS = { |
| 11 | + mac: { |
| 12 | + base: 'dist/mac-arm64/ComfyUI.app/Contents/Resources', |
| 13 | + required: ['ComfyUI', 'ComfyUI/custom_nodes/ComfyUI-Manager', 'UI', 'uv/macos/uv', 'uv/macos/uvx'], |
| 14 | + }, |
| 15 | + windows: { |
| 16 | + base: 'dist/win-unpacked/resources', |
| 17 | + required: [ |
| 18 | + // Add Windows-specific paths here |
| 19 | + 'ComfyUI', |
| 20 | + 'ComfyUI/custom_nodes/ComfyUI-Manager', |
| 21 | + 'UI', |
| 22 | + 'uv/win/uv.exe', |
| 23 | + 'uv/win/uvx.exe', |
| 24 | + ], |
| 25 | + }, |
| 26 | +}; |
| 27 | + |
| 28 | +function verifyConfig(config) { |
| 29 | + const missingPaths = []; |
| 30 | + |
| 31 | + for (const requiredPath of config.required) { |
| 32 | + const fullPath = path.join(config.base, requiredPath); |
| 33 | + if (!fs.existsSync(fullPath)) { |
| 34 | + missingPaths.push(requiredPath); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + if (missingPaths.length > 0) { |
| 39 | + console.error('❌ Build verification failed!'); |
| 40 | + console.error('Missing required paths:'); |
| 41 | + for (const p of missingPaths) console.error(` - ${p}`); |
| 42 | + process.exit(1); |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +function verifyBuild() { |
| 47 | + const platform = process.platform; |
| 48 | + |
| 49 | + if (platform === 'darwin') { |
| 50 | + console.log('🔍 Verifying build for Macos...'); |
| 51 | + verifyConfig(PATHS.mac); |
| 52 | + } else if (platform === 'win32') { |
| 53 | + console.log('🔍 Verifying build for Windows...'); |
| 54 | + verifyConfig(PATHS.windows); |
| 55 | + } else { |
| 56 | + console.error('❌ Unsupported platform:', platform); |
| 57 | + process.exit(1); |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +verifyBuild(); |
0 commit comments