MCPcopy Create free account
hub / github.com/ValueCell-ai/ClawX / listJavaScriptFiles

Function listJavaScriptFiles

scripts/openclaw-self-import-patch.mjs:60–86  ·  view source on GitHub ↗
(rootDir)

Source from the content-addressed store, hash-verified

58}
59
60function listJavaScriptFiles(rootDir) {
61 const files = [];
62 const stack = [rootDir];
63
64 while (stack.length > 0) {
65 const current = stack.pop();
66 let entries;
67 try {
68 entries = fs.readdirSync(current, { withFileTypes: true });
69 } catch {
70 continue;
71 }
72
73 for (const entry of entries) {
74 const fullPath = path.join(current, entry.name);
75 if (entry.isDirectory()) {
76 stack.push(fullPath);
77 continue;
78 }
79 if (entry.isFile() && entry.name.endsWith('.js')) {
80 files.push(fullPath);
81 }
82 }
83 }
84
85 return files;
86}
87
88export function patchExtensionOpenClawSelfImports(outputDir) {
89 const distDir = path.join(outputDir, 'dist');

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected