Created
October 29, 2021 15:26
-
-
Save EricCrosson/4a29c854d80a08f0b6676d2a6c754013 to your computer and use it in GitHub Desktop.
Collate unhoistable lerna dependencies
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
npx lerna bootstrap --force-local --strict --hoist 2> >(jq --raw-input --slurp ' | |
# create an array of relevant lines | |
split("\n") | |
| map( | |
select(. != "") | |
| select(contains("WARN EHOIST_PKG_VERSION")) | |
) | |
# create { hoisted: string, unhoisted: string }[] | |
| map( | |
match("depends on (\\S+), which differs from the hoisted (\\S+)") | |
| { unhoisted: .captures[0].string, hoisted: .captures[1].string } | |
) | |
# aggregate the data into Record<string, string[]> | |
# mapping a hoisted var to its unhoisted versions | |
| reduce .[] as $dep ( | |
{}; | |
if has($dep.hoisted) then | |
(. + { ($dep.hoisted): (.[($dep.hoisted)] + [ $dep.unhoisted ]) }) | |
else | |
(. + { ($dep.hoisted): [ $dep.unhoisted ] }) | |
end | |
) | |
') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creates output like