diff --git a/docs/tutorial/building-a-theme.md b/docs/tutorial/building-a-theme.md index c1f3fa21b1336..64914d5fa37b7 100644 --- a/docs/tutorial/building-a-theme.md +++ b/docs/tutorial/building-a-theme.md @@ -6,7 +6,7 @@ In this tutorial, you'll learn how to build a theme plugin for Gatsby. This tuto ## Set up yarn workspaces -In this section, you'll learn how to structure folders and configure Yarn workspaces to develop Gatsby themes. You'll create two workspaces, `gatsby-theme-events` and `site`. +In this section, you'll learn how to structure folders and configure yarn workspaces to develop Gatsby themes. You'll create two workspaces, `gatsby-theme-events` and `site`. Each workspace can be run separately, as well as one depending on the other. In this example, `gatsby-theme-events` will be a dependency of `site`. @@ -105,7 +105,7 @@ You should now see the following dependencies in your `site/package.json`: ```json:title=site/package.json { "dependencies": { - "gatsby": "^2.9.11", + "gatsby": "^3.0.0", "gatsby-theme-events": "*", "react": "^17.0.0", "react-dom": "^17.0.0" @@ -140,15 +140,7 @@ Targeting the `gatsby-theme-events` workspace, install `gatsby`, `react`, and `r yarn workspace gatsby-theme-events add -P gatsby react react-dom ``` -### Add development dependencies to `gatsby-theme-events` - -During development, you'll use your theme as a regular Gatsby site, so you'll also set `gatsby`, `react`, and `react-dom` as dev dependencies: - -```shell -yarn workspace gatsby-theme-events add -D gatsby react react-dom -``` - -> 💡 The `-P` flag is shorthand for installing peer dependencies, and the `-D` flag is shorthand for installing dev dependencies. +> 💡 The `-P` flag is shorthand for installing peer dependencies. The `gatsby-theme-events/package.json` file should now include the following: @@ -156,13 +148,8 @@ The `gatsby-theme-events/package.json` file should now include the following: { "peerDependencies": { "gatsby": "^3.0.0", - "react": "^16.9.0 || ^17.0.0", - "react-dom": "^16.9.0 || ^17.0.0" - }, - "devDependencies": { - "gatsby": "^3.0.0", - "react": "^16.9.0", - "react-dom": "^16.9.0" + "react": "^17.0.0", + "react-dom": "^17.0.0" } } ``` @@ -313,7 +300,7 @@ exports.onPreBootstrap = ({ reporter }) => { // highlight-start // Define the "Event" type -exports.sourceNodes = ({ actions }) => { +exports.createSchemaCustomization = ({ actions }) => { actions.createTypes(` type Event implements Node @dontInfer { id: ID! @@ -353,7 +340,7 @@ exports.onPreBootstrap = ({ reporter }) => { } // Define the "Event" type -exports.sourceNodes = ({ actions }) => { +exports.createSchemaCustomization = ({ actions }) => { actions.createTypes(` type Event implements Node @dontInfer { id: ID! @@ -1026,7 +1013,7 @@ exports.onPreBootstrap = ({ reporter }, options) => { // {...} } -exports.sourceNodes = ({ actions }) => { +exports.createSchemaCustomization = ({ actions }) => { // {...} } @@ -1098,7 +1085,7 @@ You can make your theme styles extendable using the `gatsby-plugin-theme-ui` pac Install dependencies: ```shell -yarn workspace gatsby-theme-events add gatsby-plugin-theme-ui theme-ui @emotion/react @emotion/styled @mdx-js/react +yarn workspace gatsby-theme-events add gatsby-plugin-theme-ui theme-ui ``` Then, add the `gatsby-plugin-theme-ui` plugin to the `gatsby-theme-events/gatsby-config.js` file: @@ -1267,24 +1254,24 @@ yarn workspace site develop ![Theme UI changes starting to take effect on the site. For example, the header is now purple.](./images/building-a-theme-theme-ui-changes.png) -To continue applying theme styles, you can use the `Styled` import from Theme UI. For example, in the `event-list.js` component, change the `

`, `