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

Next #1138

Merged
merged 30 commits into from
Jul 19, 2021
Merged

Next #1138

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dbaef44
chore: update gatsby and react
vpicone Apr 14, 2021
e7ac68e
fix: sassOptions
vpicone Apr 14, 2021
9814560
chore: update gatsby plugins and remove emotion
vpicone Apr 14, 2021
a0c3bcc
fix: sass module import
vpicone Apr 15, 2021
ccacf91
chore: remove emotion
vpicone Apr 15, 2021
89ddf98
chore: move homepage to its own component
vpicone Apr 15, 2021
355ea94
chore: add pre-release script
vpicone Apr 19, 2021
3670879
Merge branch 'main' of https://github.com/carbon-design-system/gatsby…
vpicone Apr 19, 2021
1bce648
chore: remove console logs
vpicone Apr 19, 2021
590e48d
breaking: migrate to gatsby v3 (#1118)
vpicone Apr 19, 2021
c9fcf1a
Merge branch 'next' of https://github.com/carbon-design-system/gatsby…
vpicone Apr 19, 2021
9e4622c
chore: use major pre-release
vpicone Apr 19, 2021
53ff04c
chore: npm tag
vpicone Apr 19, 2021
08b0887
chore: release 2.0.0-next.0
vpicone Apr 19, 2021
6fb4ec9
chore: update deps
vpicone Apr 20, 2021
8dc49a4
chore: don't force major script
vpicone Apr 20, 2021
596a82d
chore: release 2.0.0-next.1
vpicone Apr 20, 2021
9b7141c
Merge branch 'main' of https://github.com/carbon-design-system/gatsby…
vpicone Jun 15, 2021
18236d3
chore: release 2.0.0-next.2
vpicone Jun 15, 2021
df64189
chore: more dep updates
vpicone Jun 21, 2021
76664ae
chore: release 2.0.0-next.3
vpicone Jun 21, 2021
be4a6ac
fix: useLayoutEffect issues
vpicone Jun 21, 2021
d297c4d
fix: useLayoutEffect warnings (#1136)
vpicone Jun 21, 2021
d51e2ef
Merge branch 'next' of https://github.com/carbon-design-system/gatsby…
vpicone Jun 21, 2021
e646e55
Merge branch 'main' of https://github.com/carbon-design-system/gatsby…
vpicone Jun 21, 2021
e3ad6d7
chore: release 2.0.0-next.4
vpicone Jun 21, 2021
1534e91
docs: add v2 migration guide
vpicone Jun 24, 2021
ddda2be
docs: update migration guide
vpicone Jul 3, 2021
fd8de56
Merge branch 'main' into next
vpicone Jul 14, 2021
15d2408
Merge branch 'main' of https://github.com/carbon-design-system/gatsby…
vpicone Jul 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: add v2 migration guide
  • Loading branch information
vpicone committed Jun 24, 2021
commit 1534e9160ffc0168770dc02a7d313cf9d5ead44d
2 changes: 2 additions & 0 deletions packages/example/src/data/nav-items.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
path: /guides/shadowing
- title: Styling
path: /guides/styling
- title: v2.0 Migration
path: /guides/v2-migration
- title: Components
pages:
- title: Accordion
Expand Down
85 changes: 85 additions & 0 deletions packages/example/src/pages/guides/v2-migration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: V2.0 Migration
description: Guide for migrating to v2.0 of the theme
---

<PageDescription>

Earlier this year, Gatsby released `v3` of their library. This update introduces
several big improvements to Gatsby sites including incremental builds, fast
refresh, and image processing. The major version change comes with the potential
for breaking changes, this guide aims to cover the most likely issues a site
built with the Carbon Gatsby theme might encounter.

</PageDescription>

## Breaking Changes

1. Bumped minimum version of Gatsby to `v3`
2. Removed the `emotion` theme provider and its dependenices.
- This impacts sites styling their project using `emotion` and depending on
theme values supplied by the theme
- If this applies to your project, you can recreate the theme's emotion
integration installing `emotion` and replicating the
[`ThemeProvider`](https://github.com/carbon-design-system/gatsby-theme-carbon/blob/857abf691590d86b9384a8f35256e8f54fad299e/packages/gatsby-theme-carbon/src/components/ThemeProvider.js)
component and
[`theme.js`](https://github.com/carbon-design-system/gatsby-theme-carbon/blob/main/packages/gatsby-theme-carbon/src/util/theme.js).
Finally, you'll want to shadow
[`wrap-root-element.js`](https://github.com/carbon-design-system/gatsby-theme-carbon/blob/857abf691590d86b9384a8f35256e8f54fad299e/packages/gatsby-theme-carbon/src/util/wrap-root-element.js#L1)
to add back the `ThemeProvider` wrapper.

## Migration guide

In this section we'll cover the most likely issues site's built with the Carbon
gatsby theme might encounter when migrating. If you encounter any issues, or
your site leverages more advanced gatsby configuration, check to see if it's
covered in the
[official Gatsby v3 migration guide](https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/).

<InlineNotification>

Note: We'll use yarn for the shell commands here. Replace them with the `npm`
equivalent if your project uses `npm` as its package manager.

</InlineNotification>

1. Update Gatsby
```
yarn add gatsby@latest
```
2. Update gatsby plugins (including the theme)
```
yarn upgrade-interactive --latest
```
3. Check to see if you're using `sizes` or `resolutions` with `gatsby-image`. Do
a project wide search for `gatsby-image`. Check to make sure that you're not
using these
[deprecated props](https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#removal-of-sizes--resolutions-for-image-queries)
4. Check your Sass (and potentially JSON) to ensure they're imported as ES
Modules. "Default exports" are no longer supported.

```js path=Before
import styles from './MySpan.module.scss';
import metadata from './metadata.json';

const MySpan = () => <span className={styles.mySpan} />;
```

```js path=After
import { mySpan } from './MySpan.module.scss';
// Or import * as styles from './MySpan.module.scss'

import * as metadata from './metadata.json';

const MySpan = () => <span className={mySpan} />;
```

5. Run `npx gatsby clean` to delete your projects development bundle
6. Run `yarn dev`

## Troubleshooting

- Try deleting your node_modules, running `yarn cache clean` and `yarn install`
(or `npm cache clean --force` and npm install)
- Feel free to reach out in the #gatsby-theme-carbon slack channel or open an
issue on GitHub