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

[MR-886] Upgrade react-scripts to v5 #914

Merged
merged 59 commits into from
Apr 22, 2022
Merged

[MR-886] Upgrade react-scripts to v5 #914

merged 59 commits into from
Apr 22, 2022

Conversation

haworku
Copy link
Contributor

@haworku haworku commented Apr 12, 2022

Summary

Upgrade react-scripts (used to build create react app) to version 5. This is built on webpack 5

Notes:

  • Several changes needed to support uswds SCSS import properly within webpack 5 paradigm.
  • Major issue complicating this upgrade was Storybook and react-router conflicts. To resolve this, without also doing the react-router upgrade in this PR, made the choice to go up to a storybook prerelease version that resolves the types bundling issue with react-router. More about this bug - Storybook v6.4 is breaking users using react-router v5 storybookjs/storybook#16837 .
  • Had to make changes in app-api as well. webpack5 in app-web started to throw errors with prisma dependencies (were also packaged with webpack) unhappy. In order to get it working again added a single layer that has the prisma packages and forced webpack to not pack up prisma. That way the resolutions for prisma go to the lambda layer, which have the appropriate query engine builds.
  • Towards the end of this work, we ran into strange errors from the cypress pa11y node_modules. Commented out the cy.pa11y calls for now to get this work through.

Known compile warnings with this major version upgrade:

Related issues

https://qmacbis.atlassian.net/browse/MR-886

Screenshots

Test cases covered

  • No new tests added but app-web tests that reference the browser location were modified to use this pattern.

QA guidance

  • Manual QA of areas of the app not covered well by tests (variations on submissions, unlock resubmit workflow multiple times, logging in and out with IDM).

dependabot bot and others added 25 commits April 11, 2022 10:13
Bumps [react-scripts](https://github.com/facebook/create-react-app/tree/HEAD/packages/react-scripts) from 4.0.3 to 5.0.0.
- [Release notes](https://github.com/facebook/create-react-app/releases)
- [Changelog](https://github.com/facebook/create-react-app/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/create-react-app/commits/react-scripts@5.0.0/packages/react-scripts)

---
updated-dependencies:
- dependency-name: react-scripts
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…eps from react-scripts 4.x""

This reverts commit e322691.
@@ -89,28 +89,29 @@
"dayjs": "^1.10.5",
"formik": "^2.2.9",
"graphql": "^16.2.0",
"history": "^5.3.0",
Copy link
Contributor Author

@haworku haworku Apr 12, 2022

Choose a reason for hiding this comment

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

new temp dependency - added until we complete react-router upgrade to address types clashing. After upgrade it will be removed again. reason for this is described more in programming notes.

"react": "^17.0.2",
"react-aria-modal": "^4.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was an unused dependency

"@storybook/addon-a11y": "^6.5.0-alpha.61",
"@storybook/addon-essentials": "^6.5.0-alpha.61",
"@storybook/addon-links": "^6.5.0-alpha.61",
"@storybook/builder-webpack5": "^6.5.0-alpha.61",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new temp dependencies - only on prerelease until we complete react-router upgrade. Then we can go back down. reasoning described more in programming notes.

Copy link
Contributor

@macrael macrael left a comment

Choose a reason for hiding this comment

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

This looks great. You've got some Prisma lambda layer changes hanging out in this PR that doesn't seem related to the react-scripts upgrade, IDK where they came from or if they are right.

run: |
tar -C ./services/app-api/lambda-layers-prisma-client-migration -xf ./services/app-api/lambda-layers-prisma-client-migration/nodejs.tar.gz
rm -rf ./services/app-api/lambda-layers-prisma-client-migration/nodejs.tar.gz

- uses: actions/download-artifact@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change in the react-scripts PR?

Copy link
Contributor Author

@haworku haworku Apr 21, 2022

Choose a reason for hiding this comment

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

Looks like this came in with adf1882. @mojotalantikite @macrael does that commit look alright to yall just sanity check because we had a bit of funky stuff with app-web merge at least want to be sure.

Copy link
Contributor

@mojotalantikite mojotalantikite Apr 21, 2022

Choose a reason for hiding this comment

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

So yeah, with the webpack5 changes there was a change in behavior that stopped prisma from working again. Basically it was copying in parts of the prisma client, but not any of the engine things that it needs.

In order to get it working again I added a single layer that has the prisma packages and forced webpack to not pack up prisma. That way the resolutions for prisma go to the lambda layer, which have the appropriate query engine builds.

})
let testLocation: Location

renderWithProviders(
Copy link
Contributor

Choose a reason for hiding this comment

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

Every time I see this function it makes me happy. @haworku this testing function is brilliant, giving us usable defaults and making it easy to customize things per-test.

@haworku
Copy link
Contributor Author

haworku commented Apr 21, 2022

6b79287
206616d
dd097a5
Are all fixup commits from a funky merges with main.

@haworku
Copy link
Contributor Author

haworku commented Apr 21, 2022

Screen Shot 2022-04-21 at 1 45 44 PM

cypress is failing with errors I haven't seen before 🔍 . Its also happening locally and pointing to where we import pa11y in the cypress plugins file. Does any of this sound familiar @macrael

@haworku haworku marked this pull request as ready for review April 22, 2022 14:25
@haworku haworku requested a review from rswerve April 22, 2022 14:25
@haworku
Copy link
Contributor Author

haworku commented Apr 22, 2022

Unfortunately had to comment out our accessibility automation cy.pa11y calls due to errors seemingly from inside pa11y node_modules to get this through.

Will make a ticket before end of day to capture this issue and put at top of pilot backlog. It might just be we need to probably isolate the tests folder (and cypress) in its own service in packages, instead of where it is sitting now. The way things are set up now, with deps in the root package.json, and a nested tsconfig, could be off.

Copy link
Contributor

@macrael macrael left a comment

Choose a reason for hiding this comment

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

Still looks good

@mojotalantikite
Copy link
Contributor

I say ship it!

But reminder that we'll have to swap the deploy-app-to-env.yml tag back to main in a follow on PR since I made some CI changes.

@haworku haworku merged commit 70c010d into main Apr 22, 2022
@haworku haworku deleted the hw-upgrade-react-scripts branch April 22, 2022 17:35
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.

3 participants