0.0.1 • Published 5 years ago
node-dev-utils v0.0.1
clutil (command line utilities)
Utility functions for writing useful command line applications
import {
getProjects,
getProjectMap,
listFiles,
Project,
File
} from 'clutil';
const root: string = '(some directory to recursively search for node projects)';
const projects: Project[] = getProjects(root);
'path' can really be any directory. Here, it is some directory under 'root' containing a package.json file.
const files: File[] = listFiles(projects[0].path);
const map: any = getProjectMap(projects[0].path);
getProjectMap
returns an object with arrays of file names and nested objects representing subdirectories.
{
files: ["package.json", "index.ts", ...],
subdirectory {
files: ["somefile.ts"],
subdirectory: {
...
}
},
anothersubdirectory: {
files: [],
subdirectory: {
...
}
}
}
0.0.1
5 years ago