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

chore(gatsby): convert build-html to typescript #20535

Merged
merged 12 commits into from
Jan 28, 2020
Merged

Conversation

blainekasten
Copy link
Contributor

Converts commands/build-html to typescript. Also moves some shared types in the commands folder into a relative /types folder. There is likely a use-case to move the shared types even further up, but I'm thinking we'll wait until that structure becomes more obvious

@blainekasten blainekasten added the type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change label Jan 10, 2020
@blainekasten blainekasten requested a review from a team as a code owner January 10, 2020 20:58
@blainekasten blainekasten added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Jan 11, 2020
jest-transformer.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff. My request is to combine the regexes. Otherwise it's mostly questions.

jest.config.js Outdated Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Show resolved Hide resolved
const buildRenderer = async (
program: IProgram,
stage: BuildHTMLStage,
parentSpan: IActivity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parentSpan is destructured in the previous code. Was that a mistake? It does seem a bit odd to destructure it then immediately recreate the object below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/gatsby/src/commands/build-html.ts Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Outdated Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Outdated Show resolved Hide resolved
packages/gatsby/src/commands/build-html.ts Outdated Show resolved Hide resolved
packages/gatsby/src/commands/build.js Outdated Show resolved Hide resolved
ascorbic
ascorbic previously approved these changes Jan 23, 2020
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with a couple of suggestions

packages/gatsby/src/commands/build-html.ts Outdated Show resolved Hide resolved
nodes?: any // TODO
nodesByType: Map<any, any> // TODO
status: ProgramStatus
nodes?: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you extract this into an interface, you can then easily type nodesByType below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds great, i'll follow that up in a future PR. I didn't fully understand yet what nodesByType was

@blainekasten blainekasten requested a review from ascorbic January 27, 2020 20:53
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants