Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[www] Add 'Upgrading to v2' docs page #3986

Closed
12 of 13 tasks
m-allanson opened this issue Feb 12, 2018 · 5 comments
Closed
12 of 13 tasks

[www] Add 'Upgrading to v2' docs page #3986

m-allanson opened this issue Feb 12, 2018 · 5 comments
Assignees

Comments

@m-allanson
Copy link
Contributor

m-allanson commented Feb 12, 2018

Create an Upgrading to Gatsby v2 guide.

  • Manually install react and react-dom, along with any dependencies required by your plugins.
  • Layouts have been removed. To achieve the same behavior as v1, you have to wrap your pages and page templates with your own Layout component. Since Layout is a non-page component, making query has to be done with StaticQuery.
  • boundActionCreators => actions
  • pathContext => pageContext
  • Deprecated responsive image query names
  • Remove postcss plugins (cssnext, cssimport) from default css loader config
  • Mixed commonjs/es6 modules fail
  • Source & transformer plugins now use UUIDs for ids. If you used glob or regex to query nodes by id then you'll need to query something else.
  • Remove explicit polyfill and use the new builtins: usage support in babel 7.
  • Changed modifyBabelrc to onCreateBabelConfig
  • Changed modifyWebpackConfig to onCreateWebpackConfig
  • Inlining CSS changed — remove it from any custom html.js as done automatically by core now.
  • Add instructions on converting layouts for sites with many pages (Refer to Add gatsby-plugin-layout docs to v2 migration post #5753)
@m-allanson m-allanson changed the title Add 'Upgrading to v2' docs page [www] Add 'Upgrading to v2' docs page Feb 12, 2018
@KyleAMathews
Copy link
Contributor

@jquense created this file to collect breaking changes which I've adding to as well https://github.com/gatsbyjs/gatsby/blob/v2/Breaking%20Changes.md

Once the first beta is out, I'm going to solicit public v1 sites to upgrade and start writing a upgrading docs page from that.

jlengstorf added a commit to jlengstorf/gatsby that referenced this issue Apr 29, 2018
This update tells developers the new name of the deprecated props to make it easier to upgrade.

re gatsbyjs#3986
m-allanson pushed a commit that referenced this issue Apr 30, 2018
This update tells developers the new name of the deprecated props to make it easier to upgrade.

re #3986
@m-allanson m-allanson self-assigned this May 9, 2018
@tomByrer
Copy link
Contributor

I found this post helpful for an overview:
https://www.gatsbycentral.com/getting-started-with-gatsby-v2

@ryanditjia
Copy link
Contributor

Hi guys, is there currently a RouterContext sort of thing, that exposes history, location, and match props?

While upgrading Gatsby’s www to v2, as well as a client site, I found having to pass history or location to Layout to be somewhat a pain, a sentiment shared by @jquense here.

I’m not sure of the implications of such an API, but being able to do this:

import { RouterContext } from 'gatsby'

const Layout = ({ children }) => (
  <RouterContext.Consumer>
    {({ location, history, match }) => (
      // ...rest of code
    )}
  </RouterContext.Consumer>
)

will help a lot of people migrate faster.

Another question I have: should sizes and resolutions’ change to fluid and fixed be documented as breaking instead of deprecation? From what I saw, gatsby-source-contentful will be moving to fluid and fixed exclusively.

@KyleAMathews
Copy link
Contributor

I believe you could just wrap your layout component with withRouter https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/withRouter.md

fluid/fixed isn't a breaking change. If sizes/resolutions were removed from gatsby-source-contentful, we should restore them.

@m-allanson
Copy link
Contributor Author

I'm going to close this as the bulk of the work is done. I don't think the remaining item should block releasing a v2 beta. I've created a new issue for docs on updating pages with layouts for larger sites: #5753

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants