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

Prepare codebase for inline Babel 8 breaking changes #12440

Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Dec 2, 2020

Q                       A
Tests Added + Pass? Yes
License MIT

The current process for working on Babel 8 features is:

  • We have a next-8-dev branch, that we target with breaking PRs
  • We have a next-8-rebased branch, which is a "clean" branch for Babel 8. We can rewrite the history of this branch when we need to remove a commit because it's not needed anymore after a change in Babel 7.
  • We regularly merge main in next-8-dev
  • We regularly rebase next-8-rebased on main

Merges/rebases often take a lot of time (a few hours at least), especially when there is a big number of merge conflicts. Also, the risk of introducing bugs is high (as an example, both the branches for Babel 8 are failing on CI).

With this PR, it would be possible to inline many breaking changes (everything except for dependency updates) directly in main, stripping them at build time when publishing by specifying STRIP_BABEL_8_FLAG=true.

There are currently 29 commits in next-8-rebased, and most of them could be moved to main. What can't be moved are mostly depenencies updates

(:x: = "cannot be moved", :heavy_check_mark: = "can be moved", :grey_question: = "needs investigation"/"not applicable")

We would still need a separate branch for dependency updates, but it would be way easier to merge/rebase since the changes would be mostly isolated in package.json files.

When we'll release a Babel 8 alpha/beta/RC, we will have to:

  • Create a new branch from main
  • Apply the "dependency update" commits on top of it
  • Release with BABEL_8_BREAKING=true

This PR also introduces a new flag in our fixutres options, BABEL_8_BREAKING: boolean, and when it is specified the test is only run if Babel has been built with the corresponding breaking changes.

This is an example of a backport from next-8-rebased to main: nicolo-ribaudo/babel@prepare-for-breaking-changes...nicolo-ribaudo:breaking/disallow-sequence-expression-in-jsx

What do you think about this approach?

@nicolo-ribaudo nicolo-ribaudo added PR: Internal 🏠 A type of pull request used for our changelog categories i: discussion labels Dec 2, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Dec 2, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/34002/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 2, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1e31f38:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo nicolo-ribaudo added this to To review in Nicolò's ideal PR review order list via automation Dec 2, 2020
Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

I think it's hard to think of an alternative I guess (and we wanted to do this with the API for endusers anyway). I think generally sounds good? We'll see 😄 . Rebasing certainly takes a long time (as you have mentioned personally) and prone to it's own errors. I guess if applying dependencies isn't that bad (and hopefully there shouldn't be that many) it seems like a good way to keep up.

Maybe best that we don't rely on this, as a temporary measure turns into more (at least we don't plan to do multiple boolean flags, just in this case), or we reduce the amount of time that we need this since we don't plan on multiple lines of development for longer than necessary. I think in this case we want to introduce the features in a minor (say moving preset-env targets to core) and only have the major be default switches/toggles so that it's simple.

@nicolo-ribaudo
Copy link
Member Author

Yeah I agree that this is a one-time thing: I don't want to introduce multiple compilation flags, and we should only do this when it has significant benefits.

@nicolo-ribaudo
Copy link
Member Author

This is exciting 🚀

@nicolo-ribaudo nicolo-ribaudo merged commit c139d16 into babel:main Dec 4, 2020
Nicolò's ideal PR review order list automation moved this from To review to Done Dec 4, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the prepare-for-breaking-changes branch December 4, 2020 20:30
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: discussion outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Development

Successfully merging this pull request may close these issues.

None yet

5 participants