File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
handlers/file-manager/file-struct Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,7 @@ export class FileStructureAndArchitectureHandler
514514 } ;
515515 }
516516
517+ // add shadcn and check if missing must have path like "src/index.tsx"
517518 let added_structure = '' ;
518519 try {
519520 added_structure = mergePaths ( fileStructureJsonContent ) ;
Original file line number Diff line number Diff line change @@ -58,13 +58,22 @@ export const SHADCN_COMPONENT_PATHS: string[] = [
5858 * and write the result to a new JSON file.
5959 */
6060export function mergePaths ( input : string ) {
61+ const INDEX_PATH = 'src/index.tsx' ;
6162 try {
6263 // Parse the input string into a JSON object
6364 const parsedData = JSON . parse ( input ) as { Paths : string [ ] } ;
6465
65- // Merge the existing paths with the SHADCN components
66+ // Create a Set to avoid duplicates
67+ const pathSet = new Set ( [ ...parsedData . Paths , ...SHADCN_COMPONENT_PATHS ] ) ;
68+
69+ // Check if src/index.tsx exists, if not, add it
70+ if ( ! pathSet . has ( INDEX_PATH ) ) {
71+ pathSet . add ( INDEX_PATH ) ;
72+ }
73+
74+ // Convert Set back to array
6675 const updatedPaths = {
67- Paths : [ ... parsedData . Paths , ... SHADCN_COMPONENT_PATHS ] ,
76+ Paths : Array . from ( pathSet ) ,
6877 } ;
6978
7079 // Convert back to JSON string with formatting
You can’t perform that action at this time.
0 commit comments