Files
ComfyUI_frontend/scripts/prepare-types.js
Benjamin Lu f718200bb4 [backport core/1.45] Move Comfy Desktop bridge types into frontend (#12857) (#12991)
## Summary

Backports #12857 to core/1.45 so the Desktop bridge types package and
publish workflow are available for the host telemetry stack.

## Changes

- **What**: Adds the @comfyorg/comfyui-desktop-bridge-types workspace
package, publish workflow, generated types dependency handling, and
Desktop bridge remote-mode type usage.
- **Dependencies**: Adds the frontend app dependency on
@comfyorg/comfyui-desktop-bridge-types via workspace:*.

## Review Focus

Cherry-pick conflict was limited to pnpm-workspace.yaml; resolved by
keeping the core/1.45 overrides block unchanged because #12857 only
changed a comment on main for preexisting security overrides.

Validation: pnpm typecheck via commit hook; pnpm test:unit
src/platform/missingModel/missingModelDownload.test.ts.
2026-06-18 22:25:47 -07:00

45 lines
1.1 KiB
JavaScript

import fs from 'fs'
import path from 'path'
const mainPackage = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
const desktopBridgeTypesPackage = JSON.parse(
fs.readFileSync(
'./packages/comfyui-desktop-bridge-types/package.json',
'utf8'
)
)
// Create the types-only package.json
const typesPackage = {
name: `${mainPackage.name}-types`,
version: mainPackage.version,
types: './index.d.ts',
files: ['index.d.ts'],
publishConfig: {
access: 'public'
},
repository: mainPackage.repository,
homepage: mainPackage.homepage,
description: `TypeScript definitions for ${mainPackage.name}`,
license: mainPackage.license,
dependencies: {
'@comfyorg/comfyui-desktop-bridge-types': desktopBridgeTypesPackage.version
},
peerDependencies: {
vue: mainPackage.dependencies.vue,
zod: mainPackage.dependencies.zod
}
}
// Ensure dist directory exists
const distDir = './dist'
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true })
}
// Write the new package.json to the dist directory
fs.writeFileSync(
path.join(distDir, 'package.json'),
JSON.stringify(typesPackage, null, 2)
)