MCPcopy Create free account
hub / github.com/TheOrcDev/orcish-fullstack-admin / readComponents

Function readComponents

cz-config.js:14–39  ·  view source on GitHub ↗
(relativePath)

Source from the content-addressed store, hash-verified

12};
13
14const readComponents = (relativePath) => {
15 let reactFiles = [];
16
17 const folderPath = !relativePath.startsWith(baseDir)
18 ? path.join(baseDir, relativePath)
19 : relativePath;
20
21 try {
22 const files = fs.readdirSync(folderPath);
23
24 files.forEach((file) => {
25 const filePath = path.join(folderPath, file);
26 const stat = fs.statSync(filePath);
27
28 if (stat.isDirectory()) {
29 reactFiles = reactFiles.concat(readComponents(filePath));
30 } else if (path.extname(file) === ".tsx") {
31 reactFiles.push(path.basename(file).replace(".tsx", ""));
32 }
33 });
34 } catch (error) {
35 console.error("Error while searching for .tsx files:", error);
36 }
37
38 return reactFiles;
39};
40
41const sharedUI = readComponents("ui");
42const features = readComponents("features");

Callers 1

cz-config.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected