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

feat(v2): migrate bootstrap components to ts #3461

Closed
wants to merge 27 commits into from

Conversation

fanny
Copy link
Contributor

@fanny fanny commented Sep 18, 2020

Motivation

I would like to define the types of the bootstrap components to typescript, actually, this is part of #2714 change, in order to facilitate the unification process.

Have you read the Contributing Guidelines on pull requests?

(Write your answer here.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 18, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Sep 18, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 3b6c970

https://deploy-preview-3461--docusaurus-2.netlify.app

item,
onItemClick,
}: DocSidebarItemProps): JSX.Element => {
if (item.type === 'category') {
Copy link
Contributor Author

@fanny fanny Sep 18, 2020

Choose a reason for hiding this comment

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

I changed the switch to an if, because typescript can understand what type of the union it is.
PropSidebarItem = PropSidebarItemLink | PropSidebarItemCategory
When we use if, typescript understand which specific type is being used, and allows the access to adequate properties

Copy link
Collaborator

Choose a reason for hiding this comment

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

sure :) didn't know TS was not able to handle discriminated union types with switch

@fanny fanny marked this pull request as ready for review September 21, 2020 11:44
@fanny fanny requested a review from yangshun as a code owner September 21, 2020 11:44
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

Thanks @fanny , that looks good :) will just remove the useless log

item,
onItemClick,
}: DocSidebarItemProps): JSX.Element => {
if (item.type === 'category') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

sure :) didn't know TS was not able to handle discriminated union types with switch

const {
siteConfig: {
themeConfig: {navbar: {title, links = []} = {}},
themeConfig: {navbar: {title = '', items: links = []} = {}},
Copy link
Collaborator

Choose a reason for hiding this comment

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

not urgent right now but we'd rather add themeConfig validation/normalization to bootstrap theme too to make it production ready and avoid putting default values in comps everywhere

slorber and others added 13 commits September 29, 2020 12:51
* Added powershell command for deployment
- specified batch command is for cmd
- added powershell as an option for deployment, changed to single quotes

* - This affects the following versioned docs:
  - 2.0.0-alpha.63
  - 2.0.0-alpha.64
  - Next (Dev)

* Changed deploy commands to tabbed
- bash, windows, powershell, and cmd are now part of <tabs>
- default value is bash

* Changed deployment commands to tabs in v63 and 64
- Next (dev) now has better syntax
- 2.0.0-alpha-63 and 2.0.0-alpha-64 now include the tabs as well

* Updated lables in deploy and cmd to Windows
- Labels now are first-letter uppercase
  - eg. bash -> Bash
- cmd is now Windows to align with original docs

* Removed `<Tab>` spacing in deploy section
- Removed spacing at end of `values` statement
- Removed spacing between `<Tabs>` and `<TabItem>`
- build successful locally
…heme classic Layout (#3457)

* feat(v2): add optional custom wrapper class name for pages based on theme classic Layout

* feat(v2): add optional custom wrapper class name for markdown pages

* fix TS types
Right now `docusaurus serve my-dir` doesn't work because it's not registered as an internal command, thus always forced to invoked w/ `path.resolve('.')`. This fixes that
There is a small typo in website/docs/cli.md, website/docs/deployment.md, website/versioned_docs/version-2.0.0-alpha.60/cli.md, website/versioned_docs/version-2.0.0-alpha.60/deployment.md, website/versioned_docs/version-2.0.0-alpha.61/cli.md, website/versioned_docs/version-2.0.0-alpha.61/deployment.md, website/versioned_docs/version-2.0.0-alpha.62/cli.md, website/versioned_docs/version-2.0.0-alpha.62/deployment.md, website/versioned_docs/version-2.0.0-alpha.63/cli.md, website/versioned_docs/version-2.0.0-alpha.63/deployment.md, website/versioned_docs/version-2.0.0-alpha.64/cli.md, website/versioned_docs/version-2.0.0-alpha.64/deployment.md.

Should read `locally` rather than `localy`.
* feat(v2): add custom title delimiter to the theme classic

* fix validation tests

* remove title delimiter fallback

* move titleDelimiter to main config, update theme-bootstrap

* remove test value from config

* update test snapshot

* Improve docs

Co-authored-by: Alexey Pyltsyn <[email protected]>
* Add @theme-init components to user theme

* Refactor loadThemeAlias duplicate code to function
* feat: new docusaurus clear command

* Update packages/docusaurus/bin/docusaurus.js

Co-authored-by: Alexey Pyltsyn <[email protected]>

* docs: new docusaurus clear command

* fix doc

* update monorepo clear cmd

* make clear async function wait for deletes to complete + factorize a bit

* prettier fix

* better clear docs

Co-authored-by: Alexey Pyltsyn <[email protected]>
Co-authored-by: slorber <[email protected]>
Co-authored-by: Sébastien Lorber <[email protected]>
* feat(v2): allow to use array of files in customCss field

* customCss array:
- fix bug (push instead of concat)
- update docs
- add theme config validation + tests

Co-authored-by: slorber <[email protected]>
slorber and others added 3 commits September 29, 2020 12:57
* Update README.md

Added the MIT License shield and fixed grammatical errors in the documentation.

* Update CODE_OF_CONDUCT.md

Update CODE_OF_CONDUCT.md

* Update CODE_OF_CONDUCT.md

* Update CODE_OF_CONDUCT.md
@fanny fanny requested a review from lex111 as a code owner September 29, 2020 10:58
@slorber
Copy link
Collaborator

slorber commented Sep 29, 2020

ooh my bad I think I messed up with your branch while trying to resolve the conflicts. Will open another PR with your changes as afaik we are not allowed to force push.

@slorber
Copy link
Collaborator

slorber commented Sep 29, 2020

Superseeded by #3496

@slorber slorber closed this Sep 29, 2020
@lex111 lex111 deleted the fanny/migrate-bootstrap-to-ts branch October 2, 2021 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.