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

[PWA-2400] Update packages and dependencies #3611

Merged

Conversation

jeremycharron
Copy link
Contributor

@jeremycharron jeremycharron commented Dec 10, 2021

Description

Update packages and dependencies to reduce number of High+ vulnerabilities in yarn and npm audit
yarn audit vulnerabilities were reduced from 82 to 21
npm audit vulnerabilities were reduced from 78 to 17
Vulnerabilities related to Webpack 5, ESLint 8 and Storybook were out of scope as they have dedicated stories.

Related Issue

Closes PWA-2400

Acceptance

Verification Stakeholders

Project maintainers

Specification

Dependencies from root package, create-pwa, pwa-buildpack, venia-concept, venia-integration-tests are impacted

Still generating vulnerabilities - refactor required
@storybook/react: 6.3.7 / 6.4.8 (To be updated in PWA-1867)
webpack : 4.46.0 / 5.65.0 (To be updated to 5 in PWA-1893)
copy-webpack-plugin: Updated to 6.4.0 / 10.0 (7.0 and adove requires Webpack5, tbd in PWA-1893).
boxen: 5.1.2 / 6.2.1 (Version 6 introduces breaking changes - now pure ESM imports)
@pmmmwh/react-refresh-webpack-plugin: 0.4.3 / 0.5.3

Still generating vulnerabilities - module updated to latest version
danger: 10.7.1 / 10.7.1 (published a month ago)
graphql-cli: 4.1.0 / 4.1.0 (published a year ago)
@graphql-cli/validate: 2.1.0 / 2.1.0 (published 2 years ago)
eslint-plugin-package-json: 0.1.4 / 0.1.4 (published 2 years ago)
tap-diff: 0.1.1 / 0.1.1 (published 6 years ago).

No longer generating vulnerabilities
eslint: Updated to 7.32.0 / latest 8.4.1 (Breaking changes - To be updated in PWA-2451)
jest: Updated to 26.6.3 / latest 27.4.3 (Version 27 has multiple breaking changes)
chokidar: Updated to 3.5.2
coveralls: Updated to 3.1.1
graphql-config: Updated to 3.4.1
jest-junit: Updated to 13.0.0
bundlesize: Updated to 0.18.1
inquirer: Updated to 8.2.0
envalid: Updated to 6.0.1
yargs: Updated to 17.3.0
sharp: Updated to 0.29.3

Verification Steps

Test scenario(s) for direct fix/feature

  • Run yarn audit and npm audit at root, and verify vulnerabilities have been reduced
  • Perform general regression smoke test on project and updated packages
  • Verify yarn test works properly
  • Verify that yarn run lint and yarn run prettier still works
  • Create scaffold project and verify yarn build and yarn start still works

Is Browser/Device testing needed?

No, device and browser testing is not needed

Any ad-hoc/edge case scenarios that need to be considered?

Not that I can think of, but I still have limited knowledge of the full solution, so any feedback is appreciated

Screenshots / Screen Captures (if appropriate)

yarn audit develop
yarn audit 2400

Breaking Changes (if any)

Should not have any breaking change

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

@jeremycharron jeremycharron changed the title Jcharron/pwa 2400 update packages and dependencies [PWA-2400] Update packages and dependencies Dec 10, 2021
@pwa-studio-bot
Copy link
Collaborator

pwa-studio-bot commented Dec 10, 2021

Messages
📖

Associated JIRA tickets: PWA-2400.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Generated by 🚫 dangerJS against 02d3212

@jeremycharron jeremycharron added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Dec 10, 2021
@@ -44,9 +44,6 @@ test('is a yargs builder', async () => {
);

expect(output).toMatch('Create a PWA');

// throws because it wants a positional argument--just checking
expect(() => createProjectCliBuilder.builder(yargs)).toThrow('positional');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually not sure about this one. Tests are failing if we keep this. Any feedback is appreciated.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it was an old obsolete test but unfortunately, it runs just fine in develop, so maybe something has changed in this PR:

Develop:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the test only fails on this branch. If I recall, if was something about .toThrow('positional');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the error generated when running yarn test :
image

Copy link
Contributor

Choose a reason for hiding this comment

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

@jeremycharron did you check yargs release notes for this particular exception not throwing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedrochiossi
I'm seeing this as of version 17.0.0 :
.positional() now allowed at root level of yargs

Copy link
Contributor

Choose a reason for hiding this comment

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

@jeremycharron I don't think this is related, I would look for something on builder function, but if seems it's not on their release notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tjwiebell has written a new test. I will get in touch with him so we can replace this one.

Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

Everything seems fine, I have done a smoke test, scaffold test, lint test, prettier test, jest test and a cypress test.

Nice work @jeremycharron

I do have couple of questions though, please check them out.

logLevel: 'error'
}).apply(this.compiler);
new CopyPlugin(
{ patterns: Object.values(this.assetMap) },
Copy link
Contributor

Choose a reason for hiding this comment

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

Did they happen to change the syntax for the CopyPlugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -4,7 +4,7 @@ import { createTestInstance } from '@magento/peregrine';
import Options from '../options';

jest.mock('../../../classify');
jest.mock('uuid/v4', () => () => '00000000-0000-0000-0000-000000000000');
jest.mock('uuid', () => () => '00000000-0000-0000-0000-000000000000');
Copy link
Contributor

Choose a reason for hiding this comment

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

I see many such mock updates, is this a code change from the UUID package?

Copy link
Contributor Author

@jeremycharron jeremycharron Dec 16, 2021

Choose a reason for hiding this comment

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

Yes, unfortunately uuid/v4 is deprecated, we must use uuid now. Ref : https://www.npmjs.com/package/uuid#deep-requires-now-deprecated

@dpatil-magento dpatil-magento force-pushed the jcharron/PWA-2400-update-packages-and-dependencies branch from cfe7d52 to 0d97355 Compare January 7, 2022 22:17
@jeremycharron
Copy link
Contributor Author

Scaffold build is now successful.

@mikhaelbois
Copy link
Contributor

Here are the audit results on moment of QA.

Project Root - Before

yarn audit
88 vulnerabilities found - Packages audited: 1942
Severity: 60 Moderate | 28 High

npm audit
94 vulnerabilities (3 low, 49 moderate, 40 high, 2 critical)

Scaffold - Before

yarn audit
51 vulnerabilities found - Packages audited: 2543
Severity: 3 Low | 28 Moderate | 18 High | 2 Critical

npm audit
70 vulnerabilities (4 low, 36 moderate, 28 high, 2 critical)


Project Root - After

yarn audit
27 vulnerabilities found - Packages audited: 2015
Severity: 9 Moderate | 18 High

npm audit
75 vulnerabilities (3 low, 36 moderate, 34 high, 2 critical)

Scaffold - After

yarn audit
51 vulnerabilities found - Packages audited: 2543
Severity: 3 Low | 28 Moderate | 18 High | 2 Critical

npm audit
64 vulnerabilities (4 low, 31 moderate, 27 high, 2 critical)

@mikhaelbois mikhaelbois dismissed revanth0212’s stale review January 14, 2022 19:02

Issue resolved since.

@mikhaelbois
Copy link
Contributor

@jeremycharron
Following ran on Project Root ✅

yarn build
yarn lint
yarn prettier:check
yarn stage:venia
yarn storybook:venia
yarn test
yarn watch:venia

yarn watch:all works but the message visual in the console has a cosmetic issue.
Reporting it just in case.

Expected
Capture d’écran, le 2022-01-14 à 14 21 35

Current result
Capture d’écran, le 2022-01-14 à 14 27 56

Tested scaffolding with Yarn and NPM and everything worked fine for watch and build. ✅

Cypress tests ✅

Jeremy Charron added 2 commits January 17, 2022 15:09
…github.com:magento/pwa-studio into jcharron/PWA-2400-update-packages-and-dependencies
@jeremycharron
Copy link
Contributor Author

I pushed a fix for yarn watch:all visual being broken.
Boxen version 5 introduces text wrapping which doesn't seem to support long strings very well (such as URLs)
Proposed fix looks like this :

image

Copy link
Contributor

@supernova-at supernova-at left a comment

Choose a reason for hiding this comment

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

Code looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants