From 704df6864e2bb8354802dc24a07de8b043acbf6d Mon Sep 17 00:00:00 2001 From: Massoud Maboudi Date: Mon, 22 Feb 2021 23:08:05 +0330 Subject: [PATCH] docs(v2): improve cli docs (#4259) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added more details about --danger flag for swizzle * added referencing to blog posts * improved the docs for swizzling. * added new Farsi/Persian translation * Update website/docs/cli.md * Update website/docs/cli.md * Update website/docs/using-themes.md * PR cleanup Co-authored-by: Sébastien Lorber Co-authored-by: slorber --- website/docs/cli.md | 22 +++++++++++++++++----- website/docs/using-themes.md | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/website/docs/cli.md b/website/docs/cli.md index bc53f24ed028..8d136b212d3f 100644 --- a/website/docs/cli.md +++ b/website/docs/cli.md @@ -92,18 +92,18 @@ We highly discourage swizzling of components until we've reached a Beta stage. T ::: -Change any Docusaurus theme components to your liking with `docusaurus swizzle`. +Change any Docusaurus theme components to your liking with `npm run swizzle`. -```shell -docusaurus swizzle [themeName] [componentName] [siteDir] +```bash npm2yarn +npm run swizzle [themeName] [componentName] [siteDir] # Example (leaving out the siteDir to indicate this directory) -docusaurus swizzle @docusaurus/theme-classic DocSidebar +npm run swizzle @docusaurus/theme-classic DocSidebar ``` Running the command will copy the relevant theme files to your site folder. You may then make any changes to it and Docusaurus will use it instead of the one provided from the theme. -`docusaurus swizzle` without `themeName` lists all the themes available for swizzling similarly `docusaurus swizzle ` without `componentName` lists all the components available for swizzling. +`npm run swizzle` without `themeName` lists all the themes available for swizzling similarly `npm run swizzle ` without `componentName` lists all the components available for swizzling. #### Options @@ -114,6 +114,18 @@ Running the command will copy the relevant theme files to your site folder. You | `--danger` | Allow swizzling of unstable components | | `--typescript` | Swizzle TypeScript components | +An example to use `--danger` flag let's consider the below code: + +```bash npm2yarn +npm run swizzle @docusaurus/theme-classic Logo -- --danger +``` + +:::caution + +Unstable Components: components that have a higher risk of breaking changes due to internal refactorings. + +::: + To unswizzle a component, simply delete the files of the swizzled component.