mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Remove fetch-templates script (#3500)
This commit is contained in:
1
.github/workflows/test-ui.yaml
vendored
1
.github/workflows/test-ui.yaml
vendored
@@ -39,7 +39,6 @@ jobs:
|
|||||||
- name: Build ComfyUI_frontend
|
- name: Build ComfyUI_frontend
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
npm run fetch-templates
|
|
||||||
npm run build
|
npm run build
|
||||||
working-directory: ComfyUI_frontend
|
working-directory: ComfyUI_frontend
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
import { expect } from '@playwright/test'
|
import { Page, expect } from '@playwright/test'
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
||||||
|
|
||||||
|
async function checkTemplateFileExists(
|
||||||
|
page: Page,
|
||||||
|
filename: string
|
||||||
|
): Promise<boolean> {
|
||||||
|
const response = await page.request.head(
|
||||||
|
new URL(`/templates/${filename}`, page.url()).toString()
|
||||||
|
)
|
||||||
|
return response.ok()
|
||||||
|
}
|
||||||
|
|
||||||
test.describe('Templates', () => {
|
test.describe('Templates', () => {
|
||||||
test.beforeEach(async ({ comfyPage }) => {
|
test.beforeEach(async ({ comfyPage }) => {
|
||||||
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
|
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
|
||||||
@@ -12,32 +21,32 @@ test.describe('Templates', () => {
|
|||||||
test('should have a JSON workflow file for each template', async ({
|
test('should have a JSON workflow file for each template', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
|
test.slow()
|
||||||
const templates = await comfyPage.templates.getAllTemplates()
|
const templates = await comfyPage.templates.getAllTemplates()
|
||||||
for (const template of templates) {
|
for (const template of templates) {
|
||||||
const workflowPath = comfyPage.templates.getTemplatePath(
|
const exists = await checkTemplateFileExists(
|
||||||
|
comfyPage.page,
|
||||||
`${template.name}.json`
|
`${template.name}.json`
|
||||||
)
|
)
|
||||||
expect(
|
expect(exists, `Missing workflow: ${template.name}`).toBe(true)
|
||||||
fs.existsSync(workflowPath),
|
|
||||||
`Missing workflow: ${template.name}`
|
|
||||||
).toBe(true)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test.skip('should have all required thumbnail media for each template', async ({
|
test('should have all required thumbnail media for each template', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
|
test.slow()
|
||||||
const templates = await comfyPage.templates.getAllTemplates()
|
const templates = await comfyPage.templates.getAllTemplates()
|
||||||
for (const template of templates) {
|
for (const template of templates) {
|
||||||
const { name, mediaSubtype, thumbnailVariant } = template
|
const { name, mediaSubtype, thumbnailVariant } = template
|
||||||
const baseMedia = `${name}-1.${mediaSubtype}`
|
const baseMedia = `${name}-1.${mediaSubtype}`
|
||||||
const basePath = comfyPage.templates.getTemplatePath(baseMedia)
|
|
||||||
|
|
||||||
// Check base thumbnail
|
// Check base thumbnail
|
||||||
expect(
|
const baseExists = await checkTemplateFileExists(
|
||||||
fs.existsSync(basePath),
|
comfyPage.page,
|
||||||
`Missing base thumbnail: ${baseMedia}`
|
baseMedia
|
||||||
).toBe(true)
|
)
|
||||||
|
expect(baseExists, `Missing base thumbnail: ${baseMedia}`).toBe(true)
|
||||||
|
|
||||||
// Check second thumbnail for variants that need it
|
// Check second thumbnail for variants that need it
|
||||||
if (
|
if (
|
||||||
@@ -45,9 +54,12 @@ test.describe('Templates', () => {
|
|||||||
thumbnailVariant === 'hoverDissolve'
|
thumbnailVariant === 'hoverDissolve'
|
||||||
) {
|
) {
|
||||||
const secondMedia = `${name}-2.${mediaSubtype}`
|
const secondMedia = `${name}-2.${mediaSubtype}`
|
||||||
const secondPath = comfyPage.templates.getTemplatePath(secondMedia)
|
const secondExists = await checkTemplateFileExists(
|
||||||
|
comfyPage.page,
|
||||||
|
secondMedia
|
||||||
|
)
|
||||||
expect(
|
expect(
|
||||||
fs.existsSync(secondPath),
|
secondExists,
|
||||||
`Missing second thumbnail: ${secondMedia} required for ${thumbnailVariant}`
|
`Missing second thumbnail: ${secondMedia} required for ${thumbnailVariant}`
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@
|
|||||||
"lint:fix": "eslint src --fix",
|
"lint:fix": "eslint src --fix",
|
||||||
"locale": "lobe-i18n locale",
|
"locale": "lobe-i18n locale",
|
||||||
"collect-i18n": "playwright test --config=playwright.i18n.config.ts",
|
"collect-i18n": "playwright test --config=playwright.i18n.config.ts",
|
||||||
"json-schema": "tsx scripts/generate-json-schema.ts",
|
"json-schema": "tsx scripts/generate-json-schema.ts"
|
||||||
"fetch-templates": "tsx scripts/fetch-templates.ts"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.8.0",
|
"@eslint/js": "^9.8.0",
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import fs from 'fs-extra'
|
|
||||||
import { execSync } from 'node:child_process'
|
|
||||||
import path from 'node:path'
|
|
||||||
|
|
||||||
const workflowTemplatesRepo = 'https://github.com/Comfy-Org/workflow_templates'
|
|
||||||
const tempRepoDir = './templates_repo'
|
|
||||||
|
|
||||||
// Clone the repository
|
|
||||||
execSync(`git clone ${workflowTemplatesRepo} --depth 1 ${tempRepoDir}`)
|
|
||||||
|
|
||||||
// Create public/templates directory if it doesn't exist
|
|
||||||
fs.ensureDirSync('public/templates')
|
|
||||||
|
|
||||||
// Copy templates from repo to public/templates
|
|
||||||
const sourceDir = path.join(tempRepoDir, 'templates')
|
|
||||||
const targetDir = 'public/templates'
|
|
||||||
|
|
||||||
// Copy entire directory at once
|
|
||||||
fs.copySync(sourceDir, targetDir)
|
|
||||||
|
|
||||||
// Remove the temporary repository directory
|
|
||||||
fs.removeSync(tempRepoDir)
|
|
||||||
|
|
||||||
console.log('Templates fetched successfully')
|
|
||||||
Reference in New Issue
Block a user