sfbrigade / bats-server

Routed is an app to help ambulances direct non-critical patients to hospital emergency rooms with the most availability.
https://routedapp.org/
GNU Affero General Public License v3.0
18 stars 12 forks source link

Update eslint, react-scripts and craco to latest #259

Closed fwextensions closed 1 year ago

fwextensions commented 1 year ago

Update sass-loader.

This removes usages of webpack v4.

fwextensions commented 1 year ago

The same error as in #256 is showing up on CircleCI for this PR:

$ cd e2e && yarn test
warning package.json: No license field
$ playwright test

Running 4 tests using 1 worker

[WebServer] error Command failed with exit code 1.
Error: Process from config.webServer was not able to start. Exit code: 1

  4 skipped
  1 error was not a part of any test, see above for details
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1
CircleCI received exit code 1
francisli commented 1 year ago

@fwextensions I can't build the Docker image with the changes in this repo. I'm currently getting this error:

#0 29.18 $ craco --openssl-legacy-provider build && yarn sass --no-source-map && yarn postcss --no-map
#0 29.97 Creating an optimized production build...
#0 50.52 Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`
#0 51.03 Failed to compile.
#0 51.03 
#0 51.03 [eslint] Failed to load config "react-app" to extend from.
#0 51.03 Referenced from: /opt/node/app/package.json
#0 51.03 
#0 51.03 
#0 51.16 error Command failed with exit code 1.
#0 51.17 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: executor failed running [/bin/sh -c cd client && yarn && yarn build && cd .. &&     cd server && yarn && cd .. &&     cd user-guides && yarn && cd .. &&     cd e2e && yarn && cd .. &&     yarn]: exit code: 1
fwextensions commented 1 year ago

Not sure what you mean by building the docker image. If I run build in the client in docker, I'm getting a different error:

root@c9a831072060:/opt/node/app/client# yarn build
yarn run v1.22.19
$ craco --openssl-legacy-provider build && yarn sass --no-source-map && yarn postcss --no-map
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`
Failed to compile.

[eslint] Plugin "react" was conflicted between "../package.json » eslint-config-react-app" and "BaseConfig » /opt/node/app/client/node_modules/eslint-config-react-app/base.js".

I saw this on another branch where I was trying to get Storybook working. I'm going to try updating the babel eslint package.

Circle CI is still failing with the error I noted above.

fwextensions commented 1 year ago

I tried updating eslint, and pushed it to this branch: https://github.com/sfbrigade/bats-server/tree/jdunning/chore/update-eslint

Doesn't help. Get the same "conflicted" error as above when trying to build. Tried various fixes I found online but nothing worked. Seems like the latest version of CRA just doesn't work as a package in a monorepo with eslint specified in the root. Maybe doing a proper yarn workspace setup would help, but I'm not hopeful. Might be time to eject...

fwextensions commented 1 year ago

@francisli after trying eject in #262, I found the issue that was causing eslint problems. Then I needed to also update eslint. But now everything is working in this PR...

...except for the e2e tests. I continue to get the same error in circleci as described above. I've removed e2e from the test script, and now everything passes.

Can you take a look at what might be happening? I've never been able to get playwright to install in WSL2 for me, because of the permission denied error, so I'm not able to test it locally.

fwextensions commented 1 year ago

I remembered that you need to install deps as well on docker, so I did get playwright installing. But the tests still failed because the installed version of chromium didn't match playwright. So I tried updating to the latest and pinning the version in the install command in the circleci config. It works locally in docker, but still fails in the build.

Can you take a look? I don't know how to debug the circleci failures.

fwextensions commented 1 year ago

Okay, the build is finally passing with the e2e tests.

I am officially done trying to debug eslint issues ever again. Life's too short.

francisli commented 1 year ago

Hmm, I get an error when trying to re-build the Docker image, I will investigate and try to fix and update the branch...

#0 27.41 $ craco --openssl-legacy-provider build && yarn sass --no-source-map && yarn postcss --no-map
#0 28.20 Creating an optimized production build...
#0 49.29 Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`
#0 49.80 Failed to compile.
#0 49.80 
#0 49.80 [eslint] Failed to load config "prettier" to extend from.
#0 49.80 Referenced from: /opt/node/app/client/package.json
#0 49.80 
#0 49.80 
#0 49.91 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 49.91 error Command failed with exit code 1.
------
failed to solve: executor failed running [/bin/sh -c cd client && yarn && yarn build && cd .. &&     cd server && yarn && cd .. &&     cd user-guides && yarn && cd .. &&     cd e2e && yarn && cd .. &&     yarn]: exit code: 1
francisli@FrancisMBPM1 bats-server % 

Should we make building an image part of the CI process? Or would that make builds take too long...?