-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to nextjs native server and lint, and more #440
base: main
Are you sure you want to change the base?
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/inrupt/pod-browser/Ea5mnSMmm67aygZxf9VY6gfcQ4Bu |
You may wish to check if you really need the |
@@ -0,0 +1,12 @@ | |||
{ |
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.
For some reason next lint
didn't pick up the .js
configuration, but we don't actually need it anyway.
test("it renders a bookmark icon", async () => { | ||
const { asFragment } = renderWithTheme( | ||
<BookmarkContext.Provider value={(bookmarks, setBookmarks)}> | ||
<BookmarkContext.Provider value={{ bookmarks, setBookmarks }}> |
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.
@VirginiaBalseiro this may have been causing test bugs
}); | ||
}); | ||
|
||
describe("setupErrorComponent", () => { |
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 test case is really testing internals of the AppAvatar component — it'd be better to find a way to inject an error state into the component. Additionally, it's worth looking into whether errorComponent
can just be defined as a stand-alone component, rather than a component factory.
"@typescript-eslint/parser": "^5.11.0", | ||
"@typescript-eslint/eslint-plugin": "^5.12.1", | ||
"@typescript-eslint/parser": "^5.12.1", | ||
"babel-eslint": "^10.1.0", |
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 think it may be possible to remove babel-eslint, iirc, swc
will lint anyway, and you've a lint check on pre-push and CI, so you're not likely to land code that's not linted, and your editor should hopefully complain if you've linting issues
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.
Would recommend someone else take a look but everything looks great! Nice!
Although worried about the error popping up in the automated CI output. |
Hm, maybe we will need to increase the heap size then — might also be worth looking into the unit tests to see why they might be consuming excessive memory (e.g., is there a memory leak somewhere?) |
Okay, just did a quick test to see just how bad the memory leaking is, and it seems to be on the order of 20-100mb per test file: After getting a memory profile out of the chrome developer tools, it seems to be largely material-ui related. We might wish to try to upgrade to MUI v4.12, as we're currently using the older 4.11, and there could be performance improvements. Alternatively, we could upgrade to MUI v5, and there's a guide here on doing that: https://mui.com/guides/migration-v4/ More information on MUI memory leaks: mui/material-ui#21528 There is a codemod available for migrating up, which would hopefully automatically upgrade us from Also, somewhat related to this PR, currently the project depends on There's a guide here: https://www.leighhalliday.com/mock-fetch-jest (cc @NSeydoux: we may wish to use mock-fetch-jest in the SDKs too!) |
next lint is the preconfigured eslint from nextjs
This allows you to benefit from using SWC which is quicker than babel for the development server
We shouldn't need to set these parameters as Jest should automatically detect the correct number of workers for the environment, and not exceed the normal heap size
102aacc
to
46fd036
Compare
With cross-site security warnings, we initially required SSL in dev (even if it's self-signed.) Is that no longer an issue? |
I can run the server and the tests, but I'm getting an error when I click the "Sign in" button so I'm not sure how to test the application. Error:
Is this to what you were referring @ajacksified? |
It worked fine when I tested it, I think, it may require updating that json file in the appsteam pod to include What dayton saw was probably that (the client ID mismatching because we're switching from https to http). I don't think cross-site security warnings should be an issue Maybe at some level of auditing for security issues you might face problems if running that against localhost, but that's not representative of a production deployment. Would be good to know more on what you're referring to @ajacksified |
I've also been able to migrate to using |
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.
Looks good - let's merge and keep an eye on it (not expecting anything, but hard to test explicitly)
Description
Pod Browser had been using a custom http server for nextjs, which actually wasn't needed (strictly speaking) — the only use for it was to use SSL in development, which required installing or accepting a custom self-signed certificate for localhost, which is generally not a great idea.
Further, next now features a built in
next lint
command, which means you've less configuration to worry about (though linting standards changed a little).The bigger change is that
next dev
now runs with SWC instead of babel — it's a "drop in" replacement, given the right configuration.Unfortunately the tests via jest still require babel until we're able to upgrade jest, which is going to be reasonably tricky, but here's why it'll be really good to do this upgrade: https://nextjs.org/docs/testing#setting-up-jest-with-the-rust-compiler
I've also fixed a few outdated dependencies and removed unneeded dependencies.
This work also opened a bug fix on solid-client-authn-js, as we'd accidentally added a devDependency to dependencies (oops, it happens): inrupt/solid-client-authn-js#1996
Changes
See above.
Testing
Commit checklist
Interested parties
@daytonn
Notes
Screenshots/captures