MCPcopy Create free account
hub / github.com/d1ll0n/stack-packer / parseDirectory

Function parseDirectory

src/parser/parser.ts:192–209  ·  view source on GitHub ↗
(_dirPath)

Source from the content-addressed store, hash-verified

190}
191
192export function parseDirectory(_dirPath) {
193 const filePaths = recursiveDirectorySearch(_dirPath);
194 let structs = [];
195 for (let filePath of filePaths) {
196 const data = fs.readFileSync(filePath, 'utf8');
197 try {
198 const _structs = parseFile(data);
199 if (_structs.length) {
200 const relativePath = filePath.replace(_dirPath, '');
201 structs = structs.concat(_structs.map(x => ({...x, fromFile: relativePath})))
202 }
203 } catch(err) {
204 console.log(`Caught error parsing ${filePath}`)
205 throw err;
206 }
207 }
208 return structs;
209}

Callers

nothing calls this directly

Calls 2

recursiveDirectorySearchFunction · 0.85
parseFileFunction · 0.85

Tested by

no test coverage detected