You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a lot of concerns (I have them too) around what a major version bump would look like for the ecosystem. What else can we do in addition to a upgrade guide for the end user (good errors, clear explanation of changes, workaround/migration)?
What about dependencies of dependencies? Especially if you aren't using Babel directly (see issues from v6 to v7). We ended up with slow approach of essentially a year of alphas/betas/rc so that by the time it was out, most things were already updated and you could say it was relatively smooth compared to v5 to v6. But then again it took forever and there was a long process of versioning.
Idea
Use an environment variable (currently BABEL_8_BREAKING), which includes all breaking changes. Essentially a "feature flag" that we introduce (and continue to add onto) in Babel 7 patch versions.
Enables opt-ing into breaking changes without needing to change versions or dependencies.
So as a library author, you could do a dry-run and update accordingly. Or make PRs that run against the flag so that you can update the package ahead of release as we land changes. (hopefully we don't prolong this more than needed).
For the Babel codebase, ideally we do it in a way that makes this easy to automate away with a codemod. Babel 8 diff would be removing the flags (this is good because we aren't trying to introduce new features in the major version, we just do it in the minor)
// new code during Babel 8 releaserunNewFunction();
Tests?
We'll need to run tests for both "versions" to not break anything.
One approach: based on file extension: if the flag is enabled and it's a v7 test OR if the flag isn't enable and it's a v8 test, then skip the test?
Test renaming:
A test only for v7: rename to output.v7.js, options.v7.json
A test only for v8: rename to output.v8.js, options.v8.json
For both: keep as is!
During v8 release: remove all .v7. files, rename .v8. files to normal
Issues
Generally (or the Babel codebase), we shouldn't intend to use this approach in general.. and end up with if statements/flags everywhere. So use a unique name for the flag: BABEL_8_BREAKING babel a.js instead of something like BABEL_BREAKING babel a.js
Does it even matter it's a process.env vs. config option? It seems easier since we don't need to pass options between packages (config, plugin, parser option). Also there's no access to options in our interations like CRA.
We already have a next-8-dev branch that has merged some PRs into it. Ideally we would be able to just port all breaking change PRs to master under the flag and ignore next-8-dev.
It may be a lot of work to add this flag everywhere, and maintain multiple versions of tests
It's very likely can't put everything under a flag, but it's a best effort to help with ecosytem migration. We can defer those till the actual release.
What about only supporting later versions of Node? We'll have to defer to the final release?
Todo
I'll make an example PR that does this, and then we can attempt a migration on another project as another example.
The text was updated successfully, but these errors were encountered:
I really like that idea. It builds on the pattern I strive to follow in every dependency anyways: all breaking changes are just toggling the default of an option, but you can always opt in to the new default early, or opt out of it later.
Didn't want to spam our release issue too much so just writing this here as well.
There are a lot of concerns (I have them too) around what a major version bump would look like for the ecosystem. What else can we do in addition to a upgrade guide for the end user (good errors, clear explanation of changes, workaround/migration)?
What about dependencies of dependencies? Especially if you aren't using Babel directly (see issues from v6 to v7). We ended up with slow approach of essentially a year of alphas/betas/rc so that by the time it was out, most things were already updated and you could say it was relatively smooth compared to v5 to v6. But then again it took forever and there was a long process of versioning.
Idea
Use an environment variable (currently
BABEL_8_BREAKING
), which includes all breaking changes. Essentially a "feature flag" that we introduce (and continue to add onto) in Babel 7 patch versions.Enables opt-ing into breaking changes without needing to change versions or dependencies.
So as a library author, you could do a dry-run and update accordingly. Or make PRs that run against the flag so that you can update the package ahead of release as we land changes. (hopefully we don't prolong this more than needed).
For the Babel codebase, ideally we do it in a way that makes this easy to automate away with a codemod. Babel 8 diff would be removing the flags (this is good because we aren't trying to introduce new features in the major version, we just do it in the minor)
Tests?
We'll need to run tests for both "versions" to not break anything.
One approach: based on file extension: if the flag is enabled and it's a
v7
test OR if the flag isn't enable and it's av8
test, then skip the test?Test renaming:
output.v7.js
,options.v7.json
output.v8.js
,options.v8.json
.v7.
files, rename.v8.
files to normalIssues
BABEL_8_BREAKING babel a.js
instead of something likeBABEL_BREAKING babel a.js
process.env
vs. config option? It seems easier since we don't need to pass options between packages (config, plugin, parser option). Also there's no access to options in our interations like CRA.next-8-dev
branch that has merged some PRs into it. Ideally we would be able to just port all breaking change PRs tomaster
under the flag and ignorenext-8-dev
.Todo
The text was updated successfully, but these errors were encountered: