Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 7025a42

Browse files
committed
docs: update migration guide
1 parent 39b3208 commit 7025a42

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

src/docs/documentation/references/migration-guide.mdx

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
---
2-
name: Migration Guide
3-
route: /docs/migration-guide
4-
parent: Documentation
5-
menu: References
6-
---
7-
81
# Migration Guide
9-
The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes on our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version. It’s not a big deal, but you need to follow this guide in order to get Docz running properly on your project after the upgrade.
2+
3+
The [v2 release](https://github.com/pedronauck/docz/pull/950) is our biggest release in terms of changes to our core scripts. Our bundler system was entirely modified in order to use Gatsby as default bundler and you will need to update your code if you’re coming from a previous version.
4+
5+
It’s not a big deal, but you will need to follow this guide in order to get Docz running properly on your project after the upgrade.
106

117
## Gatsby as default bundler
12-
The biggest change in the new v2 is that now our core is entirely build using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on build new features instead of handling with a lot of bundlers issues (our biggest bottleneck) and enjoy all Gatsby ecosystem.
138

14-
So, in order to refactoring our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system.
9+
The biggest change in the new v2 is that our core is now entirely built using Gatsby behind the scenes. This is a huge win for Docz, since now we can focus on building new features instead of handling a lot of bundlers issues (our biggest bottleneck) and leverage the entire Gatsby ecosystem.
10+
11+
So, in order to refactor our core, we need to change a lot of things and remove others that no longer make sense. The most expressive changes here is about the configuration for `doczrc.js` and the plugin system.
1512

1613
### List of removed properties from `doczrc.js`
1714
* **`websocketHost`** ▶︎ _no longer need_
@@ -37,29 +34,42 @@ The `createPlugin` method also changed in order to fit with Gatsby now.
3734
* **`onPreRender`** ▶︎ _removed_
3835
* **`onPostRender`** ▶︎ _removed_
3936

40-
> All methods that changed now are using the same API of Gatsby hooks.
37+
> All methods that changed now are using the same API as Gatsby hooks.
4138
> You can have more details about then [here](https://www.gatsbyjs.org/docs/node-apis).
4239
4340
## `docz-theme-default` removed
44-
The main reason that made us change our core to use Gatsby is that now it have a feature called themes. In the last major version we launched our own `gatsby-theme-docz` and this was impressive since we could use Docz inside a Gatsby project and brings a lot of new possibilites when creating a documentation.
4541

46-
So, indeed we were using Gatsby theme at all, but in the wrong way. One of the best benefits of Gatsby theme are the feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people always ask for me, like: “I want just to change the head in the Docz theme”.
42+
Make sure to remove `docz-theme-default` from your dependencies when migrating :
43+
44+
```sh
45+
yarn remove docz-theme-default # npm uninstall docz-theme-default
46+
```
47+
48+
The main reason that made us change our core to use Gatsby is that they have added a feature called themes.
49+
50+
In the last major version we launched our own Gatsby theme `gatsby-theme-docz` and this was a huge step forward because we can now use Docz inside a Gatsby project and bring a lot of new possibilities when creating documentation.
4751

48-
In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` and your project is done.
52+
One of the best benefits of Gatsby themes is a feature called Component Shadowing, that’s the ability to replace theme files just by creating your own file following a file naming convention. This is awesome and is something that people very often ask, for example: “I want just to change the head in the Docz theme”.
4953

50-
Check [here](h) readme for more information.
54+
In order to get Docz running with component shadowing we removed `docz-theme-default` and now you don’t need to install it anymore. You can just add `docz` to your project.
55+
56+
Check [here](https://github.com/doczjs/docz/tree/master/core/gatsby-theme-docz#customizing-components) for more information about customizing the Gatsby theme.
5157

5258
### Code highlight with PrismJS
53-
In the last version of Docz we’re using Codemirror to highlight code inside `<Playground>` and code blocks. Now we are using [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI.
5459

55-
Check [here](h) for more information.
60+
In the last version of Docz we used Codemirror to highlight code inside `<Playground>` and code blocks. Starting from v2 docz uses [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) together with Theme UI.
61+
62+
Check [here](https://github.com/FormidableLabs/prism-react-renderer) for more information.
5663

5764
### New `themeConfig` properties
58-
Another great thing launched in the newest version is the integration with the [Theme UI](https://theme-ui.com). Theme UI it’s a library for build consistent, themeable React apps based on constraint-based design principles. So, in order to integration it with our new theme, a lot of changes are made inside the `themeConfig` object.
5965

60-
Check [here](h) for more information.
66+
Another great thing launched in the newest version is the integration with [Theme UI](https://theme-ui.com). Theme UI is a library for building consistent, themeable React apps based on constraint-based design principles.
67+
68+
So, in order to integrate it with our new theme, a lot of changes have been made inside the `themeConfig` object.
69+
6170

6271
## `theme` property removed
72+
6373
The property used to define your Docz theme inside the `doczrc.js` was removed. But you can still create and use your own theme from scratch if you want.
6474

6575
If you want to use your own theme, just create a file called `src/gatsby-theme-docz/index.js` in order to use component shadowing and replace it with your new theme.
@@ -93,7 +103,7 @@ export default ({ children }) => (
93103

94104
CSS preprocessors and modules were handled by [`docz-plugin-css`](https://github.com/doczjs/docz-plugin-css) which hooked into the bundler config to add different loader support via webpack.
95105

96-
With the change to gatsby preprocessors like `sass` can be handled by gatby via [Plugins](https://www.gatsbyjs.org/plugins/)
106+
With the change to gatsby, css preprocessors like `sass` can be handled by gatsby via [Plugins](https://www.gatsbyjs.org/plugins/)
97107

98108
These plugins are added by adding a `gatsby-config.js` in your project root or modifying an existing one. For example if you want to add support for `sass` you would do the following:
99109

@@ -113,3 +123,7 @@ module.exports = {
113123
plugins: ['gatsby-plugin-sass']
114124
}
115125
```
126+
127+
## Examples
128+
129+
Make sure to check out [docz's `examples` directory](https://github.com/doczjs/docz/tree/master/examples) for the full list of supported examples.

0 commit comments

Comments
 (0)