mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 04:00:31 +00:00
Build comfyui-frontend-types library (#1725)
* Install vite-plugin-dts * Explicitly type workflowStore * Working rollup * Hide diff type * Inline primevue toast mesage types * Add prepare-types script to generate package.json for type package * Add global declaration * Add publish types Github action * Update litegraph * Add @comfyorg to package name
This commit is contained in:
40
scripts/prepare-types.js
Normal file
40
scripts/prepare-types.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const mainPackage = JSON.parse(fs.readFileSync('./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/litegraph': mainPackage.dependencies['@comfyorg/litegraph']
|
||||
},
|
||||
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)
|
||||
)
|
||||
|
||||
console.log('Types package.json have been prepared in the dist directory')
|
||||
Reference in New Issue
Block a user