Last active
November 18, 2018 19:30
-
-
Save egoarka/d137d121606de25bf9838ed558062e4c to your computer and use it in GitHub Desktop.
collect all dependencies from js file
This file contains 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
const s = process.argv[2]; | |
const searchString = (string, pattern) => | |
string | |
.match(new RegExp(pattern.source, pattern.flags)) | |
.map(match => new RegExp(pattern.source, pattern.flags).exec(match)); | |
console.log( | |
searchString(s, /require\(\'(.*)'\)/gi) | |
.map(([_, r]) => r) | |
.join(' '), | |
); |
This file contains 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
cat file | xargs -0 -I _ node collect.js _ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment