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

Upgrade react scripts+react to latest versions #1930

Merged
merged 33 commits into from
May 14, 2021
Merged

Conversation

cmdcolin
Copy link
Collaborator

In order to avoid letting our dependencies get stale on us, I tried upgrading react-scripts and react...

This I think had been attempted before, but I tried again just to see...seemed to work

  1. yarn upgrade-interactive react-scripts --latest -> up to 4.0.3
  2. skip preflight check in .env file of jbrowse-web as this introduces alternative version of jest that conflicts with tsdx's built in version
  3. update worker loader to not manually refer to the oneOf[1].plugins since this crashed startup, this also seemed unneeded so line was removed
  4. fixed a couple lint errors that prevented startup, including adding eslint-config-react-app to root, and removing @typescript-eslint/camelcase stuff which may be due to similar stuff to here ([camelcase] definition for rule '@typescript-eslint/camelcase' was not found typescript-eslint/typescript-eslint#2077)
  5. manually upgrade react and react-dom in package.json of root, jbrowse-web, jbrowse-desktop as yarn upgrade-interactive complained about @babel/preset-env

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Apr 28, 2021
@cmdcolin cmdcolin added internal and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Apr 28, 2021
@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #1930 (690aee3) into main (473512d) will decrease coverage by 0.41%.
The diff coverage is 44.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1930      +/-   ##
==========================================
- Coverage   60.11%   59.70%   -0.42%     
==========================================
  Files         467      470       +3     
  Lines       21877    22195     +318     
  Branches     5097     5097              
==========================================
+ Hits        13152    13252     +100     
- Misses       8423     8641     +218     
  Partials      302      302              
Impacted Files Coverage Δ
...kages/core/BaseFeatureWidget/BaseFeatureDetail.tsx 78.67% <ø> (ø)
.../core/BaseFeatureWidget/SequenceFeatureDetails.tsx 53.45% <ø> (ø)
packages/core/assemblyManager/assembly.ts 86.56% <ø> (ø)
...kages/core/pluggableElementTypes/ConnectionType.ts 83.33% <ø> (ø)
...re/pluggableElementTypes/models/baseTrackConfig.ts 58.33% <0.00%> (-2.54%) ⬇️
packages/core/rpc/ElectronRpcDriver.ts 3.38% <ø> (ø)
packages/core/ui/AboutDialog.tsx 72.09% <ø> (ø)
packages/core/ui/RecentSessionCard.js 13.04% <0.00%> (-1.25%) ⬇️
packages/core/util/io/ElectronLocalFile.ts 3.33% <0.00%> (-0.38%) ⬇️
packages/core/util/io/ElectronRemoteFile.ts 0.89% <0.00%> (-0.06%) ⬇️
... and 141 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 473512d...690aee3. Read the comment docs.

@cmdcolin cmdcolin marked this pull request as draft April 28, 2021 20:24
@cmdcolin
Copy link
Collaborator Author

close but still fails some odd lint rules on CI that dont fail locally

"Definition for rule '@typescript-eslint/no-redeclare' was not found @typescript-eslint/no-redeclare"

no mention of this in our codebase...random suspect is eslint-config-airbnb-typescript so may need to upgrade or remove it

@cmdcolin
Copy link
Collaborator Author

this appears to generate a storybook build memory failure on CI

works locally on my machine, but on CI it produces this

Screenshot from 2021-04-29 12-46-01

@cmdcolin
Copy link
Collaborator Author

The normal full repo build also appears to fail...killed after two hours running

It would be good to get the upgrades but needs some work to make sure CI passes

…the dependencies of useEffect Hook"

Failed to compile.

src/Loader.tsx
  Line 47:9:  The 'ipcRenderer' logical expression could make the dependencies of useEffect Hook (at line 69) change on every render. Move it inside the useEffect callback. Alternatively, wrap the initialization of 'ipcRenderer' in its own useMemo() Hook  react-hooks/exhaustive-deps

src/StartScreen.tsx
  Line 192:9:  The 'sortedSessions' conditional could make the dependencies of useEffect Hook (at line 216) change on every render. To fix this, wrap the initialization of 'sortedSessions' in its own useMemo() Hook  react-hooks/exhaustive-deps
@cmdcolin
Copy link
Collaborator Author

cmdcolin commented May 6, 2021

This PR actually now passes CI. Previously it was timing out CI but only when run build under node 10, but running under node 14 works, so I updated to that. I don't think we have a strict need to make our CI run under node 10, so this should be ok.

It is a bit of a crazy thing to make upgrades like this, but I think they can be important to avoid getting stale in the long run

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented May 6, 2021

Note that, if merged, you may have to rm -rf node_modules and re-run yarn. If not, you may (i got this at least) get this jest error when running tests

❯ yarn test
yarn run v1.22.10
$ DEBUG_PRINT_LIMIT=0 jest
TypeError: Cannot read property 'onlyChanged' of undefined
    at _default (/home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/getChangedFilesPromise.js:49:20)
    at /home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:296:71
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:108:24)
    at _next (/home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:128:9)
    at /home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:133:7
    at new Promise (<anonymous>)
    at /home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:125:12
    at _run (/home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:374:20)
    at /home/cdiesh/src/jbrowse-components/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:178:13

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented May 6, 2021

Note that this is a large diff because I remove airbnb-typescript

It contains many rules that in a large number of cases, we just ignored. Therefore, this removes a lot of ignores, and it also fixes some usage of curlies that the previous PR (#1925 ) didn't catch maybe since this is upgraded to a newer eslint version

@garrettjstevens
Copy link
Collaborator

I think you have to keep the devDependency and update it to 26.6.0. This is a special case of a local devDependency overriding the monorepo-wide one, see #1300 (comment).

@cmdcolin
Copy link
Collaborator Author

interesting, I thought I had tried basically that (I had ^26 in dev dependency instead of explicitly 26.6.0) tried clearing that up and seems like it worked

@cmdcolin cmdcolin marked this pull request as ready for review May 11, 2021 01:01
@cmdcolin
Copy link
Collaborator Author

marking as non-draft

@cmdcolin cmdcolin force-pushed the upgrade_react_scripts branch from 93dcf89 to ab5af65 Compare May 12, 2021 04:21
@cmdcolin
Copy link
Collaborator Author

@garrettjstevens I added skipLibCheck to the jbrowse-cli also now..I found that the jbrowse-cli gave errors with @types/react when I updated root package.json @types/react to 17.

This skipLibCheck is an option that is true in our root config

Short explainer on stackoverflow https://stackoverflow.com/questions/52311779/usage-of-the-typescript-compiler-argument-skiplibcheck

It seems like it relates to declare.d.ts files...I think this should be ok for cli...the cli doesn't even use react hehe

@cmdcolin
Copy link
Collaborator Author

xref 058017b

@cmdcolin cmdcolin removed the request for review from peterkxie May 13, 2021 15:33
@cmdcolin
Copy link
Collaborator Author

this should be good to go now :)

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.

4 participants