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

Upgrade to Babel 7 #487

Merged
merged 28 commits into from
Feb 28, 2018
Merged

Upgrade to Babel 7 #487

merged 28 commits into from
Feb 28, 2018

Conversation

boopathi
Copy link
Member

@boopathi boopathi commented Apr 3, 2017

  • Review individual commits and ignore formatting commits

Current Bugs:

@boopathi boopathi added Tag: Breaking Change Pull Request breaks the API and removed Tag: Breaking Change Pull Request breaks the API labels Apr 3, 2017
@codecov
Copy link

codecov bot commented Apr 3, 2017

Codecov Report

Merging #487 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #487   +/-   ##
======================================
  Coverage    82.8%   82.8%           
======================================
  Files          44      44           
  Lines        2896    2896           
  Branches     1011    1011           
======================================
  Hits         2398    2398           
  Misses        304     304           
  Partials      194     194
Impacted Files Coverage Δ
...ages/babel-plugin-minify-mangle-names/src/index.js 82.48% <100%> (ø) ⬆️
...l-plugin-minify-dead-code-elimination/src/index.js 85.5% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba29bc5...7718829. Read the comment docs.

package.json Outdated
"babel-eslint": "^7.2.1",
"babel-jest": "^19.0.0",
"babel-plugin-transform-es2015-block-scoping": "^6.23.0",
"babel-preset-env": "^1.2.2",
Copy link
Member

Choose a reason for hiding this comment

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

there's also a v2.0.0-alpha.3 for this if we want to use

@diervo
Copy link

diervo commented Jun 22, 2017

Any blocker to push this, apart from probably increment minor version?

@hzoo
Copy link
Member

hzoo commented Jun 23, 2017

If we release as a minor or anything it also means that users using babili as a preset will fail unless they use babel-core 7.0 alpha as well

@diervo
Copy link

diervo commented Jun 23, 2017 via email

@diervo
Copy link

diervo commented Jul 1, 2017

@boopathi @hzoo This is preventing me for upgrading all our build process to babel7, and I would argue that many other developers too (to reuse the same AST tree)

I will be happy to maintain a branch in sync with upstream changes if that's required.
Is there any other blockers?
Otherwise I would love to have a resolution on this or a timeframe/plan at least.

@kelset
Copy link

kelset commented Jul 4, 2017

Any ETA for this PR to be merged?

@boopathi
Copy link
Member Author

Waiting to find a way to continue testing packages for babel 6 too. Along with babel-7.

@vigneshshanmugam
Copy link
Member

Trying out babel-7.0.0-beta.0 version.

package.json Outdated
@@ -70,5 +71,8 @@
},
"workspaces": [
"packages/*"
]
],
"resolutions": {
Copy link
Member

Choose a reason for hiding this comment

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

This is require because

  1. jest-cli uses babel-core: 6 version which is hoisted to the node_modules directory by using yarn workspaces which in turn hoists babel-register: 6
  2. running babel-register with 6 version would break and report this following error which is deprecated in babel 7
TypeError: /Users/vshanmugam/open-source/babili/gulpfile.babel.js: path.arrowFunctionToExpression is not a function
    at PluginPass.ArrowFunctionExpression (/Users/vshanmugam/open-source/babili/node_modules/babel-plugin-transform-es2015-arrow-functions/lib/index.js:10:14)

@remcohaszing
Copy link
Contributor

Some updates:

Official babel-* packages have been renamed to @babel/*.

babel-minify@0.2.0 seems to work after upgrading babel to the namespaced beta packages based on a package-lock.json file, but it seems to break when the lock file is removed and a new one is created. (I encountered this in this project).

As can be seen in the babel-core options, Babel now handles whitespaces internally based on the compact option. This causes most test failures. The output of the tests can be modified by specifying the compact parameter in test-transform.js. Either way, many tests will need some manual whitespace modifications.

  • Should the babel-7 branch just focus on Babel 7 only and drop support for Babel 6 because of the rename?
  • Should babel-minify use namespaced packages as well?
  • Is compact mode (more real) or non compact mode (more readable for tests) preferred?

I may want to try and fix this port, or at least partially, if these questions get answered.

@boopathi boopathi added the WIP Pull Request is currently Work In Progress label Nov 7, 2017
* Babel-7 returns null if there is no function parent
* and uses getProgramParent to get Program
*/
function getFunctionParent(path) {
Copy link
Member

Choose a reason for hiding this comment

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

does it make sense to make it to one of the helpers?

@diervo
Copy link

diervo commented Feb 24, 2018

@boopathi thanks a bunch for rebasing the work, will continue our testing!
Is there anyway we can help get a stable beta branch out soon?

We will be using babili on production shortly, so our team at Salesforce can help with some bugs and contributions whenever possible.

@hzoo
Copy link
Member

hzoo commented Feb 24, 2018

Yeah although I haven't been involved in this particular project for a while I think it should land on master and then make another branch for the old version and start doing releases? This is what we did with v7; we spent a long time making a 7.x branch but it was easier to just develop on master and create a 6.x branch for old code.

(Assuming the tests pass already)

@diervo
Copy link

diervo commented Feb 24, 2018

That would be awesome!
Yes all tests are passing (at leas the yarn test target), I created my own fork where I'm testing the integration with another project that depends on babel7.

I will report back more issues soon, and some PRs too ;)

We need to make sure the README is clear about what branch and versions maps to what.
Otherwise we will end up in a similar messy situation as Uglify.

@vigneshshanmugam
Copy link
Member

Yeah although I haven't been involved in this particular project for a while I think it should land on master and then make another branch for the old version and start doing releases? This is what we did with v7; we spent a long time making a 7.x branch but it was easier to just develop on master and create a 6.x branch for old code.

I would say so, Makes it better to do a patch release and backport it to 6 when needed while we work on new features in master.

@boopathi boopathi removed the WIP Pull Request is currently Work In Progress label Feb 28, 2018
@boopathi boopathi changed the title [WIP] Upgrade to Babel 7 Upgrade to Babel 7 Feb 28, 2018
@boopathi boopathi merged commit f95869d into master Feb 28, 2018
@boopathi boopathi deleted the babel-7 branch February 28, 2018 21:00
@boopathi
Copy link
Member Author

Master now uses babel-7 🎉

npm install babel-minify@canary should now install babel-7 version (auto published from master).

babel-6 is in 0.3.x branch.

@vigneshshanmugam
Copy link
Member

Awesome job 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Breaking Change Pull Request breaks the API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants