-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps(snyk): prettify snyk snapshot #5080
Conversation
401.66KB -> 396.09KB after gzip, enough to buy us a few more weeks under the old 400KB limit, but 40k savings without gzip! |
function cleanAndFormat(vulnString) { | ||
const snapshot = JSON.parse(vulnString); | ||
for (const libEntries of Object.values(snapshot.npm)) { | ||
libEntries.forEach((entry, i) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lighthouse-core/scripts/
is type checked now, so can use the SnykDb
typedef from the audit for the JSON.parse
output.
} | ||
|
||
const out = JSON.stringify(snapshot, null, 2); | ||
return out.replace(/"SUPERHACKB(.*?)SUPERHACKN"/g, function(_, s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to use replace? The output looks like it ends up being just what you create in cleanAndFormat, so just use plain old JSON.stringify()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, is this to get each entry on a single line? Agree with the "hack" part of the string, then :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe bingo, it goes from ~100 lines to ~600 lines, open to better ideas :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loooooooks like https://github.com/sergets/pretty-json-stringify is our dude.
@patrickhulce how does d4df09d look? |
works for me @paulirish! 👀 👍 |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
should make future updates to snyk much more readable