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

Emotion update #10500

Merged
merged 4 commits into from
Dec 19, 2018
Merged

Emotion update #10500

merged 4 commits into from
Dec 19, 2018

Conversation

ChristopherBiscardi
Copy link
Contributor

  • Updated gatsby-plugin-emotion to support v10 and automatic SSR.

    • Used new emotion css-prop preset and removed custom jsx pragma, fragment and plugin handling
    • Removed backward compatibility cache and old SSR methods, which if still desired from a project perspective should probably be a separate transitionary tag or package (happy to add that if desired)
  • Updated relevant tutorials

  • Did not update the testing css-in-js tutorial, which should also be updated but I didn't get a chance to run through the earlier parts to update it yet.

Removed legacy version support which also reduces the number of
packages that need to be installed for the tutorial, etc.
@ChristopherBiscardi ChristopherBiscardi requested review from DSchau and a team December 17, 2018 09:37

actions.setBabelPlugin({
name: `babel-plugin-jsx-pragmatic`,
actions.setBabelPreset({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have probably been what we did from the beginning.

Doing some cursory reading--this doesn't require us to set the jsx pragma, correct? I'm not sure I like that approach, if so.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(although this wasn't out yet--so heh, can't really fault us for that)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh yeah, the nice "single preset" approach wasn't out yet when the original emotion changes were made to gatsby plugin related stuff. It was still the piecemeal approach.

Making this change does not require anyone to manually use the jsx pragma. The pragma is applied universally automatically. You can see in the preset that it's basically the same as what we were doing before by providing jsx and setting the pragma (with the React.Fragment settings, etc) and the core emotion plugin.

@DSchau
Copy link
Contributor

DSchau commented Dec 19, 2018

@ChristopherBiscardi pulling this down now and checking it out 👌 Let's get this merged in today if all good.

Do you think it's OK to do this as a patch release? I think it was sort of a mistake to bump the previous to major and keep some of the legacy stuff intact.

@ChristopherBiscardi
Copy link
Contributor Author

@DSchau If someone updated to v3 and also kept using the old APIs then they might have an issue if this goes out as a patch. I'd do a minor at least, but since npm installs at a minor upgrade by default (^ versions) it depends on how many people we think have installed v3 in the last two weeks (v3 went out on 12/4). The tutorials I changed were still using old APIs that would've required the compatibility cache (like injectGlobal), so anyone that installed gatsby-plugin-emotion in the last two weeks and also followed the creating-global-styles tutorial would break.

I'm of the same opinion that bumping to v3 with the legacy support was probably a mistake, but it seems like the safest move is bump to v4 now that it's happened.

@DSchau
Copy link
Contributor

DSchau commented Dec 19, 2018

I'm of the same opinion that bumping to v3 with the legacy support was probably a mistake, but it seems like the safest move is bump to v4 now that it's happened.

Would agree--and that's my fault! Let's call this 4.0.0.

@DSchau DSchau merged commit 50ea59a into gatsbyjs:master Dec 19, 2018
@DSchau
Copy link
Contributor

DSchau commented Dec 19, 2018

Successfully published:
 - [email protected]

@ryanditjia
Copy link
Contributor

I’m not sure why 4.0.0’s npm installation still has the old version, as if this PR isn’t taken into account. It still has wrap-element.js and all.

Did npm info gatsby-plugin-emotion and got the download URL: wget https://registry.npmjs.org/gatsby-plugin-emotion/-/gatsby-plugin-emotion-4.0.0.tgz to confirm this.

Could you check what went wrong with the publish?

Thanks.

@DSchau
Copy link
Contributor

DSchau commented Dec 19, 2018

@ryanditjia ugh. Yeah - we don't have a clean step (or use the files array in package.json) so some legacy artifacts made their way in.

I'll PR this quickly and get 4.0.1 up.

DSchau added a commit that referenced this pull request Dec 19, 2018
This is a simple no-op change that will cause a new release of `gatsby-plugin-emotion` to get out.

In [this comment](#10500 (comment)) we can see that additional assets (e.g. `gatsby-ssr.js`) made their way into the deploy, which means that the plugin functionality is changed.

There's a few other ways we could solve this, e.g.

- Using the `files` array to limit what files are published (but this could cause further errors in the future that are easy to miss)
- Adding a `clean` step run before `bootstrap` that will wipe out any built files

I can work on integrating those, but for now, we should get `4.0.1` published with a clean deploy.
@DSchau
Copy link
Contributor

DSchau commented Dec 19, 2018

Fixed in 4.0.1. @ryanditjia feel free to confirm, but we should be good to go

curl https://registry.npmjs.org/gatsby-plugin-emotion/-/gatsby-plugin-emotion-4.0.1.tgz -o gatsby-plugin-emotion.tgz
tar -xf gatsby-plugin-emotion.tgz && ls package | grep gatsby-ssr.js

@ryanditjia
Copy link
Contributor

It’s fixed. Thanks!

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
* Move babel-plugin-emotion to v10

Removed legacy version support which also reduces the number of
packages that need to be installed for the tutorial, etc.

* update tutorial install packages

* update global styles tutorial

* Update README.md
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
This is a simple no-op change that will cause a new release of `gatsby-plugin-emotion` to get out.

In [this comment](gatsbyjs#10500 (comment)) we can see that additional assets (e.g. `gatsby-ssr.js`) made their way into the deploy, which means that the plugin functionality is changed.

There's a few other ways we could solve this, e.g.

- Using the `files` array to limit what files are published (but this could cause further errors in the future that are easy to miss)
- Adding a `clean` step run before `bootstrap` that will wipe out any built files

I can work on integrating those, but for now, we should get `4.0.1` published with a clean deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants