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

[v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0 stable (fixing Windows tests) #7655

Merged
merged 10 commits into from
Aug 29, 2018
Merged

[v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0 stable (fixing Windows tests) #7655

merged 10 commits into from
Aug 29, 2018

Conversation

vtenfys
Copy link
Contributor

@vtenfys vtenfys commented Aug 26, 2018

Changelog:

  • Upgrade all @babel/... packages from 7.0.0-beta.52 to 7.0.0-rc.3
    • Until RC3, Babel had a bug where --ignore XYZ wasn't always working properly on Windows so extra failing tests were being generated
  • Update polyfill options in gatsby/cache-dir/__tests__/.babelrc to match API changes
  • Remove unnecessary polyfill from .babel-preset.js
  • Update preset options in babel-plugin-remove-graphql-queries/src/__tests__/index.js to match API changes
  • Update plugin options in gatsby/src/utils/babel-parse-to-ast.js to match API changes
  • Always output with \n line endings in gatsby-codemods/src/transforms/global-graphql-calls.js to fix the remaining Windows tests failing

Fixes #7652

@vtenfys vtenfys requested a review from pieh August 26, 2018 14:23
@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 26, 2018

Combined with PR #7607, this should fix all failing CI tests.

@vtenfys vtenfys changed the title Upgrade Babel from 7.0.0-beta.52 to 7.0.0-rc.3 [v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0-rc.3 Aug 26, 2018
@vtenfys vtenfys changed the title [v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0-rc.3 [v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0-rc.3 (fixing Windows tests) Aug 26, 2018
@pieh
Copy link
Contributor

pieh commented Aug 28, 2018

Looking good, right now we would probably want 7.0.0 as stable was released yesterday.

Other question is - should @babel/runtime-corejs2 be added to all packages that target browser? (i.e. gatsby-image)?

@vtenfys vtenfys changed the title [v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0-rc.3 (fixing Windows tests) [v2] Upgrade Babel from 7.0.0-beta.52 to 7.0.0 stable (fixing Windows tests) Aug 28, 2018
@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 28, 2018

@pieh I've just upgraded to v7 stable - tests seem to be running fine still :)

Re: corejs, Babel's options say that we need to change the dependency for packages which use the corejs option, so yes, we should replace the deps in packages which specify browser: true in their .babelrc. I'll see if I can work on this


image

@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 28, 2018

@pieh I've just done all the dependency replacements, all tests passing locally (and hopefully on CI!) Please could you have a look and let me know if there's anything else which needs fixing?

@jquense
Copy link
Contributor

jquense commented Aug 28, 2018

I don't think we need to handle the core-js bits in packages since we polyfill the environments anyway.

I'd love to see this merged and get a release? this is not blocking a bunch of updates for me :)

[
`decorators`,
{
decoratorsBeforeExport: false,
Copy link
Contributor

@jquense jquense Aug 28, 2018

Choose a reason for hiding this comment

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

maybe this should be true? the goal here is to be as permissive as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'll change this

.babel-preset.js Outdated
@@ -47,7 +47,7 @@ function preset(context, options = {}) {
{
// we are only polyfilling the node environment
// so we need to enable the runtime replacements for the browser preset
polyfill: !!browser,
corejs: browser ? 2 : false,
Copy link
Contributor

Choose a reason for hiding this comment

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

present env should handle this i believe since it's got the selective polyfilling on already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be the case but I was matching the previous behaviour - shall I remove this? And should I keep the changes in the last commit with the Babel runtime dependencies, or can these be left as just @babel/runtime?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say we want to remove it if it doesn't break anything. The reason they added this was exactly to enable less unnecessary polyfilling so it'd be a win to change, even if it's not the same as previous behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll remove it and run through the tests. And shall I undo this commit too? (Tests were passing before I added this)

@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 28, 2018

@jquense I've now removed the corejs option from .babel-preset.js and undone the unnecessary dependency changes - please let me know if this looks okay!

@KyleAMathews
Copy link
Contributor

Deploy preview for using-contentful failed.

Built with commit c7858fe

https://app.netlify.com/sites/using-contentful/deploys/5b859a5ab13fb16c4f811804

@KyleAMathews
Copy link
Contributor

Deploy preview for image-processing failed.

Built with commit c7858fe

https://app.netlify.com/sites/image-processing/deploys/5b859a59b13fb16c4f8117fb

@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 28, 2018

AppVeyor failed because gatsby-dev-cli doesn't update dependencies - Gatsby built the site with the latest version of Babel, but the plugins resolve to packages inside Gatsbygram's own node_modules folder which has the old version of Babel, leading to incompatibilities.

Edit: same reason for the failed Netlify previews

package.json Outdated
"@babel/preset-flow": "7.0.0-beta.52",
"@babel/preset-react": "7.0.0-beta.52",
"@babel/runtime": "7.0.0-beta.52",
"@babel/core": "7.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add back the ^ on the versions here since we are out of beta's and there will be no breaking changes between v7 versions

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -3,8 +3,8 @@
"version": "2.0.2-rc.0",
"author": "Jason Quense <[email protected]>",
"devDependencies": {
"@babel/cli": "7.0.0-beta.52",
"@babel/core": "7.0.0-beta.52"
"@babel/cli": "7.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto for all the babel deps actually

jquense
jquense previously approved these changes Aug 29, 2018
Copy link
Contributor

@jquense jquense left a comment

Choose a reason for hiding this comment

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

LGTM apart from the needed caret in the version ranges

KyleAMathews
KyleAMathews previously approved these changes Aug 29, 2018
Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Nice work!

package.json Outdated
"@babel/preset-flow": "7.0.0-beta.52",
"@babel/preset-react": "7.0.0-beta.52",
"@babel/runtime": "7.0.0-beta.52",
"@babel/core": "7.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

[
`decorators`,
{
decoratorsBeforeExport: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

are these required options now?

@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 29, 2018

@KyleAMathews yep, those are required now. @jquense I'll add the ranged versions back later today and then hopefully this can be merged!

@vtenfys
Copy link
Contributor Author

vtenfys commented Aug 29, 2018

I've now added the caret ranges!

@@ -7,15 +7,16 @@
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.52",
"@babel/runtime": "^7.0.0",
"@babel/runtime-corejs2": "^7.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed anymore, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yep, I'll just remove that line

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Thanks for your usual through/excellent work @davidbailey00!

@KyleAMathews KyleAMathews merged commit 1eea47d into gatsbyjs:master Aug 29, 2018
mwfrost pushed a commit to mwfrost/gatsby that referenced this pull request Apr 20, 2023
… tests) (gatsbyjs#7655)

* Upgrade to Babel 7.0.0-rc.3

* Update config options and snapshots

* Fix tests on Windows

* Fix React Babel preset and update snapshots

* Upgrade Babel to 7.0.0 (stable)

* Allow decorators before export

* Remove unnecessary polyfill

* Use caret ranges for Babel deps

* Remove unneeded dependency
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.

Tests on Windows fail - reasons and ways to fix
4 participants