-
Notifications
You must be signed in to change notification settings - Fork 14
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
chore(fe): upgrade to nextjs12 blueprint4 node16 #3119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also bump
FROM node:14 |
ede4449
to
b028fdc
Compare
Oh thank you! Done ✅ |
Hey @tihuan woah, epic and brave 🌟!
I'd love to see this on rdev to test the new collections form. And that's it for now! Nice work!! |
For the record, I think I got |
Ooh I didn't think of using |
a3e7e29
to
7d7922f
Compare
@@ -141,3 +141,6 @@ dmypy.json | |||
.envrc | |||
.env.ecr | |||
*.sqlc | |||
|
|||
# Typescript | |||
tsconfig.tsbuildinfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a quick research shows that tsbuildinfo
is not worth checking in
@@ -1 +1 @@ | |||
v15 | |||
v16.14.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinning to avoid GH Action lint error exit code 243
See: https://stackoverflow.com/a/71892226/3120863
|
||
# install dependencies first, in a different location for easier app bind mounting for local development | ||
# due to default /opt permissions we have to create the dir with root and change perms | ||
RUN mkdir /opt/node_app && chown node:node /opt/node_app | ||
WORKDIR /opt/node_app | ||
|
||
RUN apt-get update && apt-get install -y make wget \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied from GenEpi's Dockerfile 😆
# -- TODO, we should try turning this back on later. | ||
# USER node | ||
COPY package.json package-lock.json* ./ | ||
USER node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can enable this now, because we switch back to root before running ENTRYPOINT
below, so the blast radius is a little smaller
@@ -16,8 +16,7 @@ init: | |||
|
|||
.PHONY: lint | |||
lint: | |||
npm run prettier-check | |||
npm run lint | |||
npm run prettier-check & npm run lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run both commands in parallel for speed
} | ||
), | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed swcMinify: true
, because it breaks the build
@@ -12,12 +14,7 @@ export default function ActionButton({ | |||
isAnchorButton = false, | |||
...props /* Spread props to allow for data-test-id and button specific attributes e.g. "href", "target", or "disabled". */ | |||
}: Props): JSX.Element { | |||
return ( | |||
<StyledActionButton | |||
as={isAnchorButton ? AnchorButton : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emotion styled's as
seems to only work with native DOM elements
E.g.,
const Button = styled.button`
// ...styles
`
<Button as="a" /> // renders <a />
const StyledAnchorButton = styled(AnchorButton)`
// ...styles
`
<StyledAnchorButton as="a" /> // still renders <button /> and will throw TS error
h4, | ||
h5, | ||
h6 { | ||
& h2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seve I got a stylelint error saying &h1 needs to go after h2, h3, h4, etc., but I assume that you wanted &
for all header tags?
@@ -40,12 +40,12 @@ export const YAxisWrapper = styled.div` | |||
top: 0; | |||
left: 0; | |||
z-index: 1; | |||
// Somehow Firefox requires this to scroll | |||
/* Somehow Firefox requires this to scroll */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//
comment style doesn't work in emotion
@@ -229,7 +229,10 @@ interface CreateYAxisOptionsProps { | |||
/** | |||
* Used to calculate text pixel widths. Should be only created once. | |||
*/ | |||
const CTX = document.createElement("canvas").getContext("2d"); | |||
const CTX = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextjs 12 somehow invokes this file on the server side, which doesn't have access to document
, so we need to check typeof document
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird...
@@ -19,7 +19,8 @@ | |||
"target": "esnext", | |||
"types": ["jest-playwright-preset", "expect-playwright", "jest"], | |||
"forceConsistentCasingInFileNames": true, | |||
"resolveJsonModule": true | |||
"resolveJsonModule": true, | |||
"incremental": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is enabled by nextjs, which speeds up TS compilation
570b80b
to
288a727
Compare
I'm going through the UI one more time after Fran's comment to see if I can catch more issues 😆 |
234243f
to
1d4a8a4
Compare
Wow I didn't even notice the border radius changed from 2px to 1px 🤯 , how did you spot that? Too cool! It seems to me that the font size and padding of N+ tag are the same as before? And since the border radius and color change are both part of the Blueprint4 design, I wonder if it's okay to keep them as is! @hthomas-czi PTAL 🙏
Thank you so much for catching this 🙏 Updated to match the current design!
The rdev is now available! https://thuang-next-12-frontend.rdev.single-cell.czi.technology Thanks again for the wonderful review, Fran! I really appreciate your insights here! |
The PR should be ready for everyone to review now! Thanks again! |
e70609f
to
998c713
Compare
c8c57af
to
de7399d
Compare
|
||
const ImageContainer = styled.div` | ||
width: 100%; | ||
margin: 24px 0; | ||
|
||
> div { | ||
> span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is needed since Next12 changed the Image wrapper from div
to span
:
https://nextjs.org/docs/upgrading#nextimage-changed-wrapping-element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Images look good now! Thanks so much for catching this, @seve 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readability is good, I have no suggestions other than a couple small questions. I'll wait for @seve to approve.
|
||
const OG_PAGE_TITLE = "Cellxgene Data Portal"; | ||
|
||
export default class Document extends RawDocument { | ||
static async getInitialProps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why is this function going away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry for missing to document this change!
styled-components
needed the extra config to server side render the stylesheets, but @emotion
handles it automatically, so less code for us to maintain!
@@ -275,7 +279,7 @@ const StyledLeftNav = styled.div` | |||
::-webkit-scrollbar-thumb { | |||
background-clip: padding-box; | |||
border-right: 4px #f8f8f8 solid; | |||
background: grey; | |||
background-color: grey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gray vs grey? are both recognized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh never thought about that 💡 !
Just confirmed that they are both recognized!
@@ -229,7 +229,10 @@ interface CreateYAxisOptionsProps { | |||
/** | |||
* Used to calculate text pixel widths. Should be only created once. | |||
*/ | |||
const CTX = document.createElement("canvas").getContext("2d"); | |||
const CTX = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird...
Thanks so much, @seve and @atarashansky ! I'll also wait for @hthomas-czi and @frano-m for approval before merging 🚀 |
Harley approved in Slack! |
2835c88
to
c09c4e5
Compare
* fix: remove self example from openapi (#3173) * chore: cherry pick changes from #3172 surface dataset batch_condition in curation API (#3177) * feat: surface dataset batch_condition in curation API * resolve merge conflict * fix: document upload links that are suported (#3176) * Document the types of links that are supported * Update documentation * docs: Renaming scExpression to Gene Expression (#3091) * docs: Renaming scExpression to Gene Expression - changing route to gene-expression instead of scExpression * chore(fe): upgrade to nextjs12 blueprint4 node16 (#3119) * chore(fe): upgrade to nextjs12 blueprint4 node16 * upgrade packages to resolve vulns * fix(lint): lint stuff * fix(lint): lint stuff * restore css usage * update Dockerfile * clean up css * fix bp4 css change * update docsite image css * fix: remove access_type from curation API (#3080) * remove access_type form curation API * remove is_allowed check from reshape_for_curation_api * update openapi * Fix the error message when curator is used by not a super curator * fix errors * Move all reshaping collection code into reshape_for_curation_api. * fix: change the datasets response shape (#3178) change name to title in dataset change is_primary_data to list of boolean in dataset * fix(curation api):Remove h5ad suffix requirements (#3151) - remove .h5ad suffix from uploads and curator tags - check for embedded UUID in curator tag * fix: backend/Makefile local db improvements, migration README (#3029) * fix: backend/Makefile local db improvements, migration README - Rename the targets for loading data and loading schema into local test db - Adapt the commands for the above two scripts to actually work (??) * doc updates * additional doc update * style: remove unused regex and consolidate curator tag logic (#3200) Co-authored-by: Trent Smith <1429913+Bento007@users.noreply.github.com> Co-authored-by: Nayib Gloria <55710092+nayib-jose-gloria@users.noreply.github.com> Co-authored-by: ashin-czi <109984998+ashin-czi@users.noreply.github.com> Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
* fix: remove self example from openapi (#3173) * chore: cherry pick changes from #3172 surface dataset batch_condition in curation API (#3177) * feat: surface dataset batch_condition in curation API * resolve merge conflict * fix: document upload links that are suported (#3176) * Document the types of links that are supported * Update documentation * docs: Renaming scExpression to Gene Expression (#3091) * docs: Renaming scExpression to Gene Expression - changing route to gene-expression instead of scExpression * chore(fe): upgrade to nextjs12 blueprint4 node16 (#3119) * chore(fe): upgrade to nextjs12 blueprint4 node16 * upgrade packages to resolve vulns * fix(lint): lint stuff * fix(lint): lint stuff * restore css usage * update Dockerfile * clean up css * fix bp4 css change * update docsite image css * fix: remove access_type from curation API (#3080) * remove access_type form curation API * remove is_allowed check from reshape_for_curation_api * update openapi * Fix the error message when curator is used by not a super curator * fix errors * Move all reshaping collection code into reshape_for_curation_api. * fix: change the datasets response shape (#3178) change name to title in dataset change is_primary_data to list of boolean in dataset * fix(curation api):Remove h5ad suffix requirements (#3151) - remove .h5ad suffix from uploads and curator tags - check for embedded UUID in curator tag * fix: backend/Makefile local db improvements, migration README (#3029) * fix: backend/Makefile local db improvements, migration README - Rename the targets for loading data and loading schema into local test db - Adapt the commands for the above two scripts to actually work (??) * doc updates * additional doc update * style: remove unused regex and consolidate curator tag logic (#3200) Co-authored-by: Trent Smith <1429913+Bento007@users.noreply.github.com> Co-authored-by: Nayib Gloria <55710092+nayib-jose-gloria@users.noreply.github.com> Co-authored-by: ashin-czi <109984998+ashin-czi@users.noreply.github.com> Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com> Co-authored-by: Trent Smith <1429913+Bento007@users.noreply.github.com> Co-authored-by: Nayib Gloria <55710092+nayib-jose-gloria@users.noreply.github.com> Co-authored-by: ashin-czi <109984998+ashin-czi@users.noreply.github.com> Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
next
andnode-sass
to the latest version #1705Reviewers
Functional:
@seve @hthomas-czi @frano-m
Readability:
@atarashansky
Changes
11
to12
3
to4
. Changelog14
to16
. UPDATE: Pinning to16.14.2
to avoid GH Action lint error exit code 243. [Source]styled-components
and useemotion
completely (so we can use Next's fast SWC compiler and only have one css-in-js dependency)Notable changes:
Next12 doesn't use Babel anymore and defaults to use its new SWC rust based compiler, which is supposedly 17x faster migration doc. So in order for
jest
test runner to work with TS files, we need to update jest's config files to usenext/jest
to compile TS files before jest consumes themBlueprint3 to Blueprint4 upgrade was a pain. It includes removing
node-sass
as a direct dependency (which is now officially deprecated in favor ofsass
(dart-sass)) AND also install@vgrid/sass-inline-svg
to process Blueprint SVG files. On top of that, because we define a custom theme via sass, I had to follow custom sass processing setup steps to overcome Blueprint's very limited support of theming. Currently the Blueprint team hasn't come up with a solution for official theming support, as shown in this comment. Given that@vgrid/sass-inline-svg
actually still depends onnode-sass
, we might need to move away from Blueprint completely sooner than later to avoid indirectly depending on a deprecated package for too longMigration from
styled-components
toemotion
includes a small change ofremoving the usage ofimport { css } from 'styled-components'
, because@emotion/css
outputs a class string instead of a styling function. So I just rewrote those instances with a styling function instead! Seefrontend/src/components/Collections/components/Dataset/common/style.ts
for exampleUPDATE: Thanks to Alec, we just had to change the import from
{ css } from 'styled'
to{ css } from '@emotion/react'
QA steps (optional)
RDEV:
https://thuang-next-12-frontend.rdev.single-cell.czi.technology/
Local:
rm -rf node_modules && npm i
to install all new dependenciesmake local-sync
OR if your local app connects to dev/staging BE, then justnpm run dev
Notes for Reviewer
Tagging all the people that work on FE for visibility!