Created
September 11, 2019 08:02
-
-
Save chenyong/0fdfc451157516eeb01aa447547d1823 to your computer and use it in GitHub Desktop.
temp script for find out deps
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
fs = require 'fs' | |
_ = require 'lodash' | |
data = JSON.parse fs.readFileSync 'data.text', 'utf8' | |
dict = data.map (list) -> | |
[list[0], list[1..].flat() ] | |
dictObj = {} | |
dict.forEach (pair) -> | |
dictObj[pair[0]] = pair[1] | |
root = 'main.tsx' | |
grabByRoot = (parent) -> | |
children = dictObj[parent] | |
# console.log 'found children', children | |
if !children? | |
console.warn "Failed for", parent | |
else | |
deepChildren = children.flatMap (child) -> | |
grabByRoot child | |
children.concat deepChildren | |
allFiles = grabByRoot(root) | |
console.log (_.uniq allFiles).join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment