MCPcopy Create free account
hub / github.com/dataform-co/dataform / walkDirectoryForFilenames

Function walkDirectoryForFilenames

testing/run_core.ts:133–148  ·  view source on GitHub ↗
(projectDir: string, relativePath: string = "")

Source from the content-addressed store, hash-verified

131}
132
133function walkDirectoryForFilenames(projectDir: string, relativePath: string = ""): string[] {
134 let paths: string[] = [];
135 fs.readdirSync(path.join(projectDir, relativePath), { withFileTypes: true })
136 .filter(directoryEntry => directoryEntry.name !== "node_modules")
137 .forEach(directoryEntry => {
138 if (directoryEntry.isDirectory()) {
139 paths = paths.concat(walkDirectoryForFilenames(projectDir, directoryEntry.name));
140 return;
141 }
142 const fileExtension = directoryEntry.name.split(".").slice(-1)[0];
143 if (directoryEntry.isFile() && SOURCE_EXTENSIONS.includes(fileExtension)) {
144 paths.push(directoryEntry.name);
145 }
146 });
147 return paths.map(filename => path.join(relativePath, filename));
148}

Callers 1

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected