-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Typescript migration #6307
Typescript migration #6307
Conversation
Gatsby Cloud Build Reportethereum-org-website-dev 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 24m PerformanceLighthouse report
|
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 looks awesome ❤️
Site is building properly locally, and not getting any issues with any pages breaking...
...Dare I say we're on the verge of Deploy v4.0.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.
Awesome, great job! 🎉 Just left a couple of suggestions
"skipLibCheck": true, | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["./src"] |
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 add the "exclude": ["node_modules"]
prop here for faster compilation
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 wonder what you lose from doing that. Do you know if that is not equivalent of doing "skipLibCheck": true
(which we are already doing). https://www.typescriptlang.org/tsconfig#skipLibCheck
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.
Not sure if it has the same effect
types.ts
Outdated
@@ -0,0 +1,21 @@ | |||
import { Lang } from "./src/utils/languages" | |||
import { IMessages } from "./src/utils/flattenMessages" |
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.
maybe we can move the IMessages
interface (and other defined interfaces) to an interfaces.ts
file, like we do with types.ts
. I'd also suggest to remove the I
from the interface name (and use just Messages
), to standardize the naming
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.
Ok, I will standardize these names without the I
but not sure about putting them into a single file.
Let me know what do you think about the following. Maybe we can have:
interfaces.ts
file -> for global or cross-app interfaces- each
[module].ts
-> interfaces related to that module
Basically to avoid having a huge interfaces.ts
file and to quickly find the interfaces related to the code.
I guess this is more the convention we want to follow as a team.
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.
@pettinarip agree with that convention
One small thought (that isn't a blocker on this PR): should |
One note, we'll have to account for at least one recent PR: #6366 |
@@ -0,0 +1,27 @@ | |||
import fs from "fs" |
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.
Organization nitpick question - do getMessages
& flattenMessages
both need their own files? They both have to do with i18n support (specifically the gatsby-plugin-intl
plugin).
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.
Nice idea. I tried to avoid doing a lot of refactors just to keep this PR as much as scoped as possible but your suggestion makes total sense.
I will take note of this and implement that in the next PR 👍🏼
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -1,4 +1,4 @@ | |||
import { mergeObjects } from "../merge-translations" | |||
import mergeObjects from "../../utils/mergeObjects" |
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 assume we'll eventually want to migrate these test files as well?
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'm ok if it's not this PR).
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.
Yes! will migrate them in next PRs 💪🏼
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.
Nice @pettinarip! I would have approved, but there's a conflict. Let me know if you need a hand!
I separated them on purpose because:
|
Thanks for the review @corwintines! Yes, tomorrow I'll resolve the conflicts and merge it. |
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.
Made some comments but no blockers in my opinion. Great work!
Only (minor) concern I have is that while yarn start
works fine, netlify dev
no longer works on my local env:
https://discord.com/channels/714888181740339261/974453286134485072/976522784891084870
But seems like that is just an issue for me? e.g. @wackerow said everything works fine for him.
First iteration on TS migration (#6392).
Description
Core files has been migrated.
Some extra things:
prebuild
script processes has been moved intoonPreBootstrap
hook ingatsby-node
.data/translations.json
intoutils/languages.ts
.LegacyPageHome.js
page.translations.ts
file. I moved them into thelanguages.ts
.More reference: https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/#migrating-to-typescript
TODO
docsearchConfigScript.js
file