Closed blainekasten closed 1 year ago
I'll happily pick up gatsby-link. Been meaning to learn some more around there!
@herecydev That sounds great! I'll put your name down! That one is relatively small and isolated, so feel free to do that whole package in one PR if you want.
@blainekasten just a few preliminary comments. There are quite a few globals/window variables: __BASE_PATH__
, ___navigate
, ___push
, ___replace
, __PATH_PREFIX__
, ___loader
. Is there a strategy about making those available to typescript? I believe they're all defined from within the gatsby package.
@herecydev those variables are def meant to be like "private" "secret" variables.. So I don't think we'll expose any types from gatsby package as they are only meant to be used in a few places. I think the best course of action would just be to define types for them in the gatsby-link
package.
I'm excited to contribute, which package do you suggest for starting?
@aminkhp awesome!! I would love it if we could just start chunking off individual files in PRs. Want to tackle gatsby-core-utils
? I would love if you just did one file per PR as they are all very isolated.
I'd be happy to contribute some types. I'd be able to tackle gatsby-page-utils
.
I took a peek at gatsby-core-utils
by the way, and it looks like true-case-path
is just an empty file. I'm not sure if that's intentional, but it might be worth deleting from the repo and removing from the list? https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-core-utils/src/true-case-path.js
@robertrbairdii Great! If you could chunk up the work and submit 1 PR for each line I had, that would be fantastic.
Good point re the gatsby-core-utils. cc @aminkhp
I'd like to try src/commands/build-javascript.js
.
ADDITION: I'd also like to tackle babel-preset-gatsby
I spent some time in src/redux/actions/public.js
before, so I think I can help with it.
@blainekasten I was looking at the .babelrc
while converting gatsby-page-utils
and I noticed that there is no reference to @babel/plugin-transform-typescript
in babel-preset-gatsby-package
(https://github.com/gatsbyjs/gatsby/blob/master/packages/babel-preset-gatsby-package/index.js
). And running a test build, the converted .ts
files don't make it to the /dist
folder.
The babel config at the root of the repo has an override for it https://github.com/gatsbyjs/gatsby/blob/master/.babelrc.js#L12 And that config seems to be imported by other packages such as https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/babel.config.js
As far as I know, you can only pass the extensions as an argument through the CLI, so we would have to add the --extensions
flag to each babel reference in the scripts section of all the package.json
of the packages being converted. You could then either provide the override as is done in the root .babelrc
or add @babel/plugin-transform-typescript
in babel-preset-gatsby-package
and allow values like isTSX
to be configured via options passed in to the package.
I think this will block getting some of the TS conversions merged in and published.
@robertrbairdii I came to the same findings on my PR: https://github.com/gatsbyjs/gatsby/pull/22027
It wasn't obvious at first, but lucky there is some prior art in the gatsby-cli
project to look at. It might be worth a ticket to sweep through all the packages to support ts, which will make the files more approachable as a whole
I would love to help out and I don't have any preferences. Can you recommend me some parts to migrate?
@danielkov Seeing by @blainekasten's comment (https://github.com/gatsbyjs/gatsby/issues/21995#issuecomment-595965697), I think you could start in gatsby-core-utils
@MichaelDeBoey I also have my eyes on gatsby-cli/src/structured-errors if nobody else is on it and then move onto gatsby-core-utils
in another PR. Does that sound good?
@danielkov That one's already taken by @LekoArts in #20597
I see #22031 is addressing one of the files of gatsby-core-utils
. Should I wait for that merge, or start independently and resolve conflicts when done?
@danielkov You can just start working on it. The conflicts can be fixed before merging. 🙂
@MichaelDeBoey my currently open PRs include all the closed ones at the moment. If you have the time will you double check that this is now correct?
I'd like to work on src/utils/app-data.js
, utils/browserslist
I'd like to work on components/spinner.js
Where are we at with converting plugins to typescript? things like source plugins, manifest, offline, etc...
I'd like to work on
packages/gatsby-cli/src/reporter/loggers/ink/components/messages.js
(edited)packages/gatsby-cli/src/reporter/constants.js
Where are we at with converting plugins to typescript? things like source plugins, manifest, offline, etc...
We're not going to convert those (yet)? As we think it might be harder for people to contribute on those. Gatsby core packages are mostly only managed by us so we think it's worth doing it as it makes our lives easier when working on it.
@blainekasten I'm not 100% sure if we should refactor browser parts like gatsby-link, gatsby-image & our cache-dir. This might lead to bigger bundles.
Hello! I'd like to work on
I'd like to try
packages/gatsby/src/utils/get-cache.js
packages/gatsby/src/utils/get-latest-apis.js
packages/gatsby/src/utils/get-public-path.js
I'd like to try
packages/gatsby/src/utils/get-cache.js
packages/gatsby/src/utils/get-latest-apis.js
packages/gatsby/src/utils/get-public-path.js
@cola119 I suggest you first create a PR for all other files you're working on, so other people can maybe take a look at those file in the meantime if they want. Just don't think we want to wait for something, when somebody else could work on it
I'll work on stack-trace-utils.js
I'm working on jobs-manager.js
I'll take on src/redux/actions/types.js
I'd like to try packages/gatsby-image/src/index.js
.
redux/actions/restricted.js
also depends on redux/actions/types.js
, so I will take it.
I'm taking care of the /redux
folder on gatsby-cli
on https://github.com/gatsbyjs/gatsby/pull/22292
I'd like to start with packages/gatsby/src/utils/eslint-config.js
- #22294
I'm working on packages/gatsby/src/utils/gatsby-dependents.js
- #22422
I'd love to help with this, @blainekasten. Any suggestions for a first time contributor?
There are quite a few globals/window variables: BASE_PATH_, navigate, push, replace, PATH_PREFIX_, loader.
If nobody is opposed, @blainekasten, I think I'll try converting babel-plugin-remove-graphql-queries/src/murmur.js
.
@zachtylr21 alright
@parikshitgupta1 Oh, was your previous comment directed at me? I can work on those too, if needed.
If you’re still looking for help, I’d love to do what I can. Anything specific you’d like help converting that hasn’t been assigned yet?
Hey @AmyShackles thanks for asking, although from my side there's nothing left, although let's see in the thread.
Feel free to take whatever item from that list. We appreciate any PR, no matter if small/easy or big/complicated file :)
Hi @blainekasten I'm sending PRs for:
gatsby
src/load-plugins #22504 gatsby
websocket-manager #22510gatsby-telemetry
#22532gatsby-link
#22563 Some of them are bigger than I hoped, but their dependencies ended up being hard to disentangle.
I would love to contribute! Is there any small/easy file I can start working on? I am still getting familiar with Gatsby :D
I'm here to help. Anyone asking for help specifically or I'll pick one.
@blainekasten
I wanted to give back my 2 cents to community. Last weekend I had to dig deep to gatsby.js codebase, cos I had this annoying issue with type checking in my project: #22070
So I had time on last weekend to start huge refactoring. I have no time to continue now, but I had refactored to typescript gatsby-telemetry gatsby-core-utils and partially other projects.
https://github.com/gatsbyjs/gatsby/pull/22817
I hope it will give some ideas, If needed I can explain my findings and decisions, either here, or on skype: justfly1984
Would like to contribute, any suggestions to where to start?
I'd like to try working on packages\gatsby\src\bootstrap\prefer-default.js
first to get to know more about how things work, if that's okay.
Update: submitted PR https://github.com/gatsbyjs/gatsby/pull/22958
I would really like to contribute! Could I possibly convert packages/gatsby/reducers/themes.js
?
Hello Community!
Gatsby is rewriting our core codebase in TypeScript! Checkout the RFC: #21798
We would love love love your help! This work is incredibly important in Gatsby being a stable product and you could be a part of it! We are looking for community members who would be willing to jump into the codebase in transition files from .js to .ts and add the proper typings. We have a few guidelines we are wanting to stick to when doing this:
Gatsby TS Guidelines
Array<type>
rather thantype[]
syntax, as it's clearer and matches built-in types such asMap
.Record
, rather than defining your own.any
type can be used for stubbing module types that would be out of scope to migrate. But it should not be used for any functional input/outputs. The end goal of this migration is to have ZEROany
types in the codebase. See ifunknown
makes more sense in that context. Don't use@ts-ignore
comments.If you're interested in getting involved, check out the list below. If you're interested in doing something, please respond as a comment, i'll put your name by a file so others know it's "claimed", when the PR is merged i'll check the box.
Tips to get involved: first read the contribution docs, and see how to set up your local environment. After you've claimed the file to work on, convert it locally and ensure there are no typing or lint errors displayed in your IDE. Run
yarn typecheck
andyarn lint:code
in the root before opening the PR, which will show any errors. Once you're ready, open the PR and one of us will review it. Thanks, and good luck!File list
[x] /murmur.js (@zachtylr21 in #22458)
[ ] /index.js + test
loki/*
DON'T DO[x] /websocket-manager.js (@Eyas in #22510)
[x] /url.js (@danielkov in #22056)
[ ] /parse-path.js + test
[x] /watch-directory.js
[x] /telemetry.js + test