-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): rework swizzle CLI (#6243)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
- Loading branch information
Showing
78 changed files
with
3,633 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Swizzle Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- packages/** | ||
|
||
jobs: | ||
test: | ||
name: Swizzle | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
action: ['eject', 'wrap'] | ||
variant: ['js', 'ts'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
cache: yarn | ||
- name: Installation | ||
run: yarn | ||
|
||
# Swizzle all the theme components | ||
- name: Swizzle (${{matrix.action}} - ${{matrix.variant}}) | ||
run: yarn workspace website test:swizzle:${{matrix.action}}:${{matrix.variant}} | ||
# Build swizzled site | ||
- name: Build website | ||
run: yarn build:website:fast | ||
# Ensure swizzled site still typechecks | ||
- name: TypeCheck website | ||
run: yarn workspace website typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* | ||
!*/ | ||
!*.css | ||
__tests__/ | ||
build | ||
coverage | ||
examples/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
packages/docusaurus-theme-classic/src/getSwizzleConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import type {SwizzleConfig} from '@docusaurus/types'; | ||
|
||
export default function getSwizzleConfig(): SwizzleConfig { | ||
return { | ||
components: { | ||
CodeBlock: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
description: | ||
'The component used to render multi-line code blocks, generally used in Markdown files.', | ||
}, | ||
DocSidebar: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'unsafe', // too much technical code in sidebar, not very safe atm | ||
}, | ||
description: 'The sidebar component on docs pages', | ||
}, | ||
Footer: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'unsafe', // TODO split footer into smaller parts | ||
}, | ||
description: "The footer component of you site's layout", | ||
}, | ||
NotFound: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
description: | ||
'The global 404 page of your site, meant to be ejected and customized', | ||
}, | ||
SearchBar: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
// TODO how to describe this one properly? | ||
// By default it's an empty placeholder for the user to fill | ||
description: | ||
'The search bar component of your site, appearing in the navbar.', | ||
}, | ||
IconArrow: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
description: 'The arrow icon component', | ||
}, | ||
IconEdit: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
description: 'The edit icon component', | ||
}, | ||
IconMenu: { | ||
actions: { | ||
wrap: 'safe', | ||
eject: 'safe', | ||
}, | ||
description: 'The menu icon component', | ||
}, | ||
|
||
'prism-include-languages': { | ||
actions: { | ||
wrap: 'forbidden', // not a component! | ||
eject: 'safe', | ||
}, | ||
description: | ||
'The Prism languages to include for code block syntax highlighting. Meant to be ejected.', | ||
}, | ||
MDXComponents: { | ||
actions: { | ||
wrap: 'forbidden', /// TODO allow wrapping objects??? | ||
eject: 'safe', | ||
}, | ||
description: | ||
'The MDX components to use for rendering MDX files. Meant to be ejected.', | ||
}, | ||
|
||
// TODO should probably not even appear here | ||
'NavbarItem/utils': { | ||
actions: { | ||
wrap: 'forbidden', | ||
eject: 'forbidden', | ||
}, | ||
}, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.