Last active
March 10, 2020 10:48
-
-
Save FermiDirak/23994a223cf5ee2c24b319bd72dc5072 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {getSourceFilesIterator, lsFiles} from "react-codestats"; | |
const sourceFileIterator = getSourceFilesIterator("~/flexport/javascripts", { | |
extensions: ["js", "jsx"], | |
withParser: "flow", | |
}); | |
let formulaOneImports = 0; | |
let formComponentImports = 0; | |
const formComponents = lsFiles("~/flexport/open_source/latitude/form") | |
.map(file => file.split(".")[0]); | |
sourceFileIterator(({fileName, path, ast}, i) => { | |
formulaOneImports += ast | |
.find(j.ImportDeclaration, {source: {value: "formula-one"}}) | |
.length; | |
formComponents.forEach(formComponent => { | |
formComponentImports += ast | |
.findComponent({ | |
export: "Form", | |
sourcePath: "latitude/TextInput", | |
}) | |
.length; | |
}); | |
console.log(`${i} file(s) parsed.`); | |
}); | |
console.log("finished!", formulaOneImports, formComponentImports); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment