mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 21:54:56 +00:00
Fix: Inline deleted JSON components to resolve build errors
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,6 @@ async function analyzeComponent(category: string, component: string): Promise<vo
|
||||
// Check if it's pure composition (only uses UI primitives)
|
||||
const hasBusinessLogic = /useState|useEffect|useCallback|useMemo|useReducer|useRef/.test(content)
|
||||
const hasComplexLogic = /if\s*\(.*\{|switch\s*\(|for\s*\(|while\s*\(/.test(content)
|
||||
const hasCustomFunctions = /function\s+\w+\(|const\s+\w+\s*=\s*\([^)]*\)\s*=>/.test(content)
|
||||
|
||||
// Extract what it imports
|
||||
const imports = content.match(/import\s+\{[^}]+\}\s+from\s+['"][^'"]+['"]/g) || []
|
||||
|
||||
@@ -38,12 +38,11 @@ const targetComponents = {
|
||||
atoms: ['Input']
|
||||
}
|
||||
|
||||
async function refactorFile(filePath: string): Promise<boolean> {
|
||||
export async function refactorFile(filePath: string): Promise<boolean> {
|
||||
let content = await fs.readFile(filePath, 'utf-8')
|
||||
let modified = false
|
||||
|
||||
// Find all imports to replace
|
||||
const importLines: string[] = []
|
||||
const componentsToLoad = new Set<string>()
|
||||
|
||||
for (const [category, components] of Object.entries(targetComponents)) {
|
||||
|
||||
Reference in New Issue
Block a user