babel-upgrade icon indicating copy to clipboard operation
babel-upgrade copied to clipboard

Intro

Open hzoo opened this issue 7 years ago • 2 comments

Hello everyone!

I'm writing down a lot of the todos just in the readme since this feels so early in the progress of this idea/tool. If we get closer we can start with individual issues, since I feel like we would just make 100 issues atm.

Philosophy

  • Works with one command npx babel-upgrade.
  • Have nice logging on what has changed, or suggestions where we can't guarantee the change is correct.
  • But allow configurability where useful
    • Allow option to specify paths for various things like source code/babelrc/package.json for fine-grained changed on specific workflows/projects. npx babel-upgrade babelrc=path packagejson=path?

Code

This is a codemod and also something you would ideally only run once on a codebase (at least for each upgrade).

  • Thus don't worry too much about doing something "slow" if the logic is simpler.
  • Needs to handle the base case, so we need testing to make sure it doesn't mess up anything it's not supposed to. Wrap any changes to the file in if checks, like if (package.dependencies) { package.dependencies = ... }
  • Organize the code in such a way that it's easy to add one-off changes, but having lots of tests/fixtures is fine.

hzoo avatar Feb 17 '18 16:02 hzoo

Hey, just wanted to reach out since I thought this was a great tool.

I wanted to make you aware of https://github.com/kellyselden/ember-cli-update to see if there is any knowledge sharing or inspiration that could occur.

alexander-alvarez avatar Feb 19 '18 20:02 alexander-alvarez

cc @kellyselden on that. Right now we just manually modify package.json/config files which are all json. I just did string replacement for other files, and next I'll need to look into making some codemods like with babel-codemod regarding babel plugins and other things.

hzoo avatar Feb 21 '18 17:02 hzoo