Skip to content
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

Merged
merged 3 commits into from
May 18, 2018
Merged

deps(snyk): prettify snyk snapshot #5080

merged 3 commits into from
May 18, 2018

Conversation

patrickhulce
Copy link
Collaborator

should make future updates to snyk much more readable

@brendankenny
Copy link
Member

brendankenny commented May 1, 2018

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) => {
Copy link
Member

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) {
Copy link
Member

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()?

Copy link
Member

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

Copy link
Collaborator Author

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 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish
Copy link
Member

@patrickhulce how does d4df09d look?

@GoogleChrome GoogleChrome deleted a comment from googlebot May 18, 2018
@patrickhulce
Copy link
Collaborator Author

works for me @paulirish! 👀 👍

@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@paulirish paulirish merged commit 9b8154b into master May 18, 2018
@patrickhulce patrickhulce deleted the pretty_snyk branch May 18, 2018 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants