mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
- Introduced `menu.json` for menu component structure with bindings for trigger and content. - Created `password-input.json` for password input handling visibility and value changes. - Added `popover.json` for popover component with trigger and content bindings. feat: Implement custom hooks for UI interactions - Added `useAccordion` for managing accordion state with single/multiple item support. - Created `useBindingEditor` for managing bindings in a dynamic editor. - Implemented `useCopyState` for clipboard copy functionality with feedback. - Developed `useFileUpload` for handling file uploads with drag-and-drop support. - Introduced `useFocusState` for managing focus state in components. - Created `useImageState` for handling image loading and error states. - Added `useMenuState` for managing menu interactions and item clicks. - Implemented `usePasswordVisibility` for toggling password visibility. - Developed `usePopoverState` for managing popover visibility and interactions. feat: Add constants and interfaces for JSON UI components - Introduced constants for sizes, placements, styles, and object-fit handling. - Created interfaces for various components including Accordion, Binding Editor, Copy Button, Data Source Editor, File Upload, and more. - Added type definitions for menu items, popover props, and other UI elements to enhance type safety and maintainability.
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
#!/usr/bin/env tsx
|
|
/**
|
|
* Cleanup script to remove obsolete wrapper references from registry
|
|
*/
|
|
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
const REGISTRY_FILE = path.resolve(process.cwd(), 'json-components-registry.json')
|
|
|
|
async function cleanupRegistry() {
|
|
console.log('🧹 Cleaning up registry...\n')
|
|
|
|
// Read registry
|
|
const content = fs.readFileSync(REGISTRY_FILE, 'utf-8')
|
|
const registry = JSON.parse(content)
|
|
|
|
let cleanedCount = 0
|
|
const cleanedComponents: string[] = []
|
|
|
|
// Remove obsolete fields from all components
|
|
if (registry.components) {
|
|
for (const component of registry.components) {
|
|
let modified = false
|
|
|
|
if (component.wrapperRequired !== undefined) {
|
|
delete component.wrapperRequired
|
|
modified = true
|
|
}
|
|
|
|
if (component.wrapperComponent !== undefined) {
|
|
delete component.wrapperComponent
|
|
modified = true
|
|
}
|
|
|
|
if (modified) {
|
|
cleanedCount++
|
|
cleanedComponents.push(component.type || component.name || 'Unknown')
|
|
}
|
|
}
|
|
}
|
|
|
|
// Write back to file with proper formatting
|
|
fs.writeFileSync(REGISTRY_FILE, JSON.stringify(registry, null, 2) + '\n')
|
|
|
|
console.log(`✅ Cleaned ${cleanedCount} components\n`)
|
|
|
|
if (cleanedComponents.length > 0) {
|
|
console.log('📋 Cleaned components:')
|
|
cleanedComponents.slice(0, 10).forEach(name => {
|
|
console.log(` • ${name}`)
|
|
})
|
|
if (cleanedComponents.length > 10) {
|
|
console.log(` ... and ${cleanedComponents.length - 10} more`)
|
|
}
|
|
}
|
|
|
|
console.log('\n✨ Registry cleanup complete!')
|
|
}
|
|
|
|
cleanupRegistry().catch(error => {
|
|
console.error('❌ Cleanup failed:', error)
|
|
process.exit(1)
|
|
})
|