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

refactor(types): split into multiple files #7710

Merged
merged 3 commits into from Jul 6, 2022

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jul 1, 2022

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Split our @docusaurus/types to separate into it subdomains, making the list of exports and the dependency between subdomains clearer.

No type was refactored, it is just a split and the public API of this package remains the same as before.

Test Plan

CI

@slorber slorber added the pr: internal This PR does not touch production code, or is not meaningful enough to be in the changelog. label Jul 1, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jul 1, 2022
// TODO improve type (not exposed by postcss-loader)
export type PostCssOptions = {plugins: unknown[]; [key: string]: unknown};

type HtmlTagObject = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure why: this type was not exported from this package and yet it was imported successfully in Docusaurus core 🤷‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

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

Because this is a d.ts file with no value export, so it's still ambient. We can fix this by adding an export {}.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I see 😅

Not very familar with those TS rules and value exports, where is this documented? Should we add export {} to all those .d.ts files?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the only file where we have a hand-written d.ts that's not ambient module declarations, AFAICT.

Last time I looked for it, there was no docs, only one GH issue. On my phone atm; I can share the link later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@netlify
Copy link

netlify bot commented Jul 1, 2022

[V2]

Name Link
🔨 Latest commit faa3872
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62bec317b786dc000828a320
😎 Deploy Preview https://deploy-preview-7710--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Jul 1, 2022

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 85 🟢 100 🟢 100 🟢 100 🟢 90 Report
/docs/installation 🟠 84 🟢 100 🟢 100 🟢 100 🟢 90 Report

@github-actions
Copy link

github-actions bot commented Jul 1, 2022

Size Change: 0 B

Total Size: 802 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 52.6 kB
website/build/assets/css/styles.********.css 107 kB
website/build/assets/js/main.********.js 604 kB
website/build/index.html 38.9 kB

compressed-size-action

@Josh-Cena Josh-Cena changed the title refactor: split @docusaurus/types refactor(types): split into multiple files Jul 1, 2022
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Last time I tried to split it, I couldn't convince myself of any kind of splitting because all types are interconnected. I think this is good enough.

@slorber slorber merged commit 713dcdf into main Jul 6, 2022
@slorber slorber deleted the slorber/split-docusaurus-types branch July 6, 2022 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: internal This PR does not touch production code, or is not meaningful enough to be in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants