mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +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
|
||||
run: |
|
||||
npm ci
|
||||
npm run fetch-templates
|
||||
npm run build
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
import { expect } from '@playwright/test'
|
||||
import fs from 'fs'
|
||||
import { Page, expect } from '@playwright/test'
|
||||
|
||||
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.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
@@ -12,32 +21,32 @@ test.describe('Templates', () => {
|
||||
test('should have a JSON workflow file for each template', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
test.slow()
|
||||
const templates = await comfyPage.templates.getAllTemplates()
|
||||
for (const template of templates) {
|
||||
const workflowPath = comfyPage.templates.getTemplatePath(
|
||||
const exists = await checkTemplateFileExists(
|
||||
comfyPage.page,
|
||||
`${template.name}.json`
|
||||
)
|
||||
expect(
|
||||
fs.existsSync(workflowPath),
|
||||
`Missing workflow: ${template.name}`
|
||||
).toBe(true)
|
||||
expect(exists, `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
|
||||
}) => {
|
||||
test.slow()
|
||||
const templates = await comfyPage.templates.getAllTemplates()
|
||||
for (const template of templates) {
|
||||
const { name, mediaSubtype, thumbnailVariant } = template
|
||||
const baseMedia = `${name}-1.${mediaSubtype}`
|
||||
const basePath = comfyPage.templates.getTemplatePath(baseMedia)
|
||||
|
||||
// Check base thumbnail
|
||||
expect(
|
||||
fs.existsSync(basePath),
|
||||
`Missing base thumbnail: ${baseMedia}`
|
||||
).toBe(true)
|
||||
const baseExists = await checkTemplateFileExists(
|
||||
comfyPage.page,
|
||||
baseMedia
|
||||
)
|
||||
expect(baseExists, `Missing base thumbnail: ${baseMedia}`).toBe(true)
|
||||
|
||||
// Check second thumbnail for variants that need it
|
||||
if (
|
||||
@@ -45,9 +54,12 @@ test.describe('Templates', () => {
|
||||
thumbnailVariant === 'hoverDissolve'
|
||||
) {
|
||||
const secondMedia = `${name}-2.${mediaSubtype}`
|
||||
const secondPath = comfyPage.templates.getTemplatePath(secondMedia)
|
||||
const secondExists = await checkTemplateFileExists(
|
||||
comfyPage.page,
|
||||
secondMedia
|
||||
)
|
||||
expect(
|
||||
fs.existsSync(secondPath),
|
||||
secondExists,
|
||||
`Missing second thumbnail: ${secondMedia} required for ${thumbnailVariant}`
|
||||
).toBe(true)
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
"lint:fix": "eslint src --fix",
|
||||
"locale": "lobe-i18n locale",
|
||||
"collect-i18n": "playwright test --config=playwright.i18n.config.ts",
|
||||
"json-schema": "tsx scripts/generate-json-schema.ts",
|
||||
"fetch-templates": "tsx scripts/fetch-templates.ts"
|
||||
"json-schema": "tsx scripts/generate-json-schema.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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