babel / notes

♬ Notes from the @Babel Team (discuss in PRs)
https://github.com/babel/notes#meetings
122 stars 16 forks source link

Meta: create a tool to upgrade users to Babel 7 #44

Closed hzoo closed 6 years ago

hzoo commented 6 years ago

It would be something that would work for 90% of most users (not using babel-core directly or any crazy options), would love for the community to come together to help out with this, especially as everyone is trying to update to v7 (at least can comment on the kinds of issues you have faced to see if they can be automated).

Because most of this is json, we need a tool that handles json files.

List of packages: https://gist.github.com/hzoo/3b78b8225ffddc34483785018664390e (not all have an equivalent because they can be new for v7)

Scoped packages

Renames

babel-plugin-transform-es2015-classes -> babel-plugin-transform-classes transform-es3-member-expression-literals -> transform-member-expression-literals

change package json, modify babelrc.

babel-plugin-transform-class-properties -> babel-plugin-proposal-class-properties

Peer Dep on @babel/core

This means if there wasn't a @babel/core at the top level, it should be added in package.json

.babelrc.js

Not sure if we have to do this, not reason to change if it's not necessary.

I think if they are using the "env" key a lot we could change it. The reason why we can change the config in the first place is because it's json and not js

@babel/node

I think we should probably add @babel/node back as a dependency in cli anyway

Add @babel/node as a dependency if they are using it in scripts.

Andarist commented 6 years ago

Fix config in .babelrc

I know many people using a clever trick of doing {"presets": ["./.babelrc.js"]} in .babelrc. It would be nice to upgrade automatically those requested presets with relative paths.

rajasekarm commented 6 years ago

Something like codemod? https://github.com/rajzshkr/babel7-upgrade

hzoo commented 6 years ago

https://github.com/webpack/webpack-cli/blob/master/lib/commands/migrate.js

https://github.com/babel/babel-upgrade

hzoo commented 6 years ago

Ok closing since this is somewhat working already and we can add issues there instead. https://twitter.com/left_pad/status/965587130977275905