All Projects → babel → Babel Upgrade

babel / Babel Upgrade

⬆️ A tool for upgrading Babel versions (to v7): `npx babel-upgrade`

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Babel Upgrade

Server
RuneJS is a RuneScape game server emulator written entirely using TypeScript and JavaScript. The project's goal is to create an easy to use game server providing simple content development systems and APIs.
Stars: ✭ 74 (-94.24%)
Mutual labels:  babel
Node Developer Boilerplate
🍭 Boilerplate for ES6+ Node.js and npm Developer
Stars: ✭ 82 (-93.62%)
Mutual labels:  babel
Svelte Example
🚀 📚 Some examples to test the Svelte Framework
Stars: ✭ 85 (-93.39%)
Mutual labels:  babel
Babel Test
An opinionated library to make testing babel plugins easier.
Stars: ✭ 79 (-93.85%)
Mutual labels:  babel
Webpack
🔥 A full-featured , A Weex and Vue.js project,which is an awesome solution for building Dingtalk microapp with extremely high performanece.
Stars: ✭ 81 (-93.7%)
Mutual labels:  babel
Tkframework
react + relay + redux + saga + graphql + webpack
Stars: ✭ 83 (-93.54%)
Mutual labels:  babel
Css In Js Precompiler
WORK IN PROGRESS: Precompiles CSS-in-JS objects to CSS strings
Stars: ✭ 71 (-94.47%)
Mutual labels:  babel
React Redux Saucepan
A minimal and universal react redux starter project. With hot reloading, linting and server-side rendering
Stars: ✭ 86 (-93.31%)
Mutual labels:  babel
Spa Starter Kit
📦 Quick starter kit for booting up a NodeJS container with React, webpack, babel/ES2015, Redux, and more.
Stars: ✭ 81 (-93.7%)
Mutual labels:  babel
Threejs Es6 Webpack Starter
Three.js ES6 starter project with a sane webpack configuration
Stars: ✭ 85 (-93.39%)
Mutual labels:  babel
React Starter
🚀 A minimal react boilerplate featuring easy-peasy state management and styled-components
Stars: ✭ 79 (-93.85%)
Mutual labels:  babel
Babel Plugin Optimize Clsx
Babel plugin to optimize the use of clsx, classnames, and other libraries with a compatible API
Stars: ✭ 80 (-93.77%)
Mutual labels:  babel
Catom
A 0 runtime CSS in JS library
Stars: ✭ 84 (-93.46%)
Mutual labels:  babel
Mostly
They mostly come at night; mostly.
Stars: ✭ 78 (-93.93%)
Mutual labels:  babel
Compiled
A familiar and performant compile time CSS-in-JS library for React.
Stars: ✭ 1,235 (-3.89%)
Mutual labels:  babel
Nextjs Full Demo
Demo about integration between examples of next.js and also fix some issues during development
Stars: ✭ 76 (-94.09%)
Mutual labels:  babel
Hactar
The solution to JavaScript Fatigue. Zero config dev
Stars: ✭ 82 (-93.62%)
Mutual labels:  babel
Cookiecutter Webpack
Boilerplate for webpack 2, babel, react + redux + hmr, and karma. Can be inserted into existing django projects.
Stars: ✭ 87 (-93.23%)
Mutual labels:  babel
Modify Babel Preset
💫 Create a modified babel preset based on an an existing preset.
Stars: ✭ 85 (-93.39%)
Mutual labels:  babel
Esbuild Loader
⚡️ Speed up your Webpack build with esbuild
Stars: ✭ 1,245 (-3.11%)
Mutual labels:  babel

babel-upgrade

A tool that tries to automatically update most dependencies, config files, and JavaScript files that require Babel packages directly to Babel 7 (and more in the future).

Usage

Requires nodejs 8 or newer

Run at the root of your git repo:

If using npm < v5.2.0, install npx globally.

# npx lets you run babel-upgrade without installing it locally
npx babel-upgrade --write

# or install globally and run
npm install babel-upgrade -g
babel-upgrade --write

Without the --write (or -w) flag, babel-upgrade will print a diff without writing any changes.

Optionally, add --install (or -i) as well to run yarn or npm after writing the upgrade.

npx babel-upgrade --write --install

Ideas from http://new.babeljs.io/docs/en/next/v7-migration.html (or modify that file if it's missing)

Todos

  • [x] Works on Node >= 8 (anything lower isn't supported in v7) (#16)
  • [x] Run npm/yarn after updating dependencies (use --install) (#18)
  • [x] Update package.json: dependencies and devDependencies to the "latest supported" version.
    • [x] all package renames
      • [x] babel-loader for webpack >=1 (#34)
      • [x] rollup-plugin-babel (#36)
    • [x] Upgrading the same package to the latest version
    • [x] add @babel/core peerDep (7c34cd)
{
  "devDependencies": {
+   "@babel/core": "^7.0.0",
+   "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
+   "@babel/preset-env": "^7.0.0",
+   "babel-loader": "v8.0.0-beta.0"
-   "babel-loader": "6.0.0",
-   "babel-plugin-transform-object-rest-spread": "6.0.0",
-   "babel-preset-env": "^1.0.0",
  },
}
  • [x] modify scripts for mocha + @babel/register (e81cf7)
{
  "name": "mocha-scripts-test",
  "scripts": {
-    "test": "mocha --compilers js:babel-register --require babel-polyfill test/*Test.js",
+    "test": "mocha --compilers js:@babel/register --require @babel/polyfill test/*Test.js",
  }
}
  • [x] use "babel-core": "^7.0.0-bridge-0" if jest or jest-cli is a dependency (#14)
"devDependencies": {
  "@babel/core": "^7.0.0",
+ "babel-core": "7.0.0-bridge.0",
  "jest": "^22.0.0"
},
"scripts": {
  "test": "jest"
}
  • [x] add new @babel/node package if babel-node is used (#14)
"devDependencies": {
  "@babel/cli": "^7.0.0",
+ "@babel/node": "^7.0.0"
},
"scripts": {
  "start": "babel-node a.js"
}
  • [x] Handle all nested .babelrc (#14)
- src/
- example/
  - .babelrc // now modifies these too
- test/
  - .babelrc // now modifies these too
- `.babelrc`
  • [x] rename config files to swap shorthand form to long form
{
  "presets": [
+   "@babel/preset-env"
-   "env"
  ]
}
  • [x] package.json babel key (d123ad)
{
  "babel": {
    "presets": [
+     "@babel/preset-env"
-     "env"
    ]
  }
}
{
  "babel": {
    "presets": [
      "@babel/preset-env"
    ]
  },
  "env": {
    "development": {
      "plugins": [
-       "transform-react-jsx-source",
-       "babel-plugin-transform-react-jsx-self"
+       "@babel/plugin-transform-react-jsx-source",
+       "@babel/plugin-transform-react-jsx-self",
      ]
    }
  }
}


  • [x] Modify mocha.opts (e81cf7)
---require babel-register
+--require @babel/register
  • [x] Convert comma separated presets/plugins into an array (#37)
{
-  "presets": "env, react",
+  "presets": ["@babel/preset-env", "@babel/preset-react"],
  • [x] handle react + flow preset being split. Read if .flowconfig and add it? (#21)
{
  "@babel/preset-react": "^7.0.0",
+  "@babel/preset-flow": "^7.0.0"
}
  • [x] Replace Stage presets with individual proposal plugins (#69)
{
-  "presets": ["@babel/preset-stage-3"],
+  "presets": [],
+  "plugins": [
+    "@babel/plugin-syntax-dynamic-import",
+    "@babel/plugin-syntax-import-meta",
+    "@babel/plugin-proposal-class-properties",
+    "@babel/plugin-proposal-json-strings"
+  ]
}
{
-    "@babel/preset-stage-3": "^7.0.0"
+    "@babel/plugin-proposal-class-properties": "^7.0.0",
+    "@babel/plugin-proposal-json-strings": "^7.0.0",
+    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
+    "@babel/plugin-syntax-import-meta": "^7.0.0"
}
  • [ ] Log when replacing out preset-es2015,16,17,latest as FYI
  • [ ] Figure out how to change nested .babelrcs into using "overrides" instead
  • [ ] Monorepo support
  • [ ] .babelrc.js and other js files with a config like presets, webpack.config.js
  • [ ] convert only/ignore if necessary
  • [ ] remove typeof-symbol if using @babel/preset-env + loose
  • [ ] Update test files that use babel directly (babel-types -> @babel/types, babel-core)
    • [ ] Update all requires/imports
    • [ ] Update the use of the Babel API (plugins, integrations)
  • [ ] Modify other config files as we go
  • [ ] Add to the upgrade guide which parts are autofixable and the command (if we care enough to make this individually runnable too infrastructure wise)
  • [ ] May need to add a warning on any 3rd party plugins since they might not be compatible
  • [ ] Handle the differences in plugins in v7 for default/loose/spec
  • [ ] Should certain parts be generic (replace the string babel-register with @babel/register)? Could be in a Makefile or somewhere else, but it's just find replace.

Philosophy

  • Move this into the monorepo when somewhat ready
    • Maybe move into @babel/cli?
    • Or just another package that is intended to be used via npx/globally
  • Whenever there is a breaking change in a PR we should also update this tool when possible or at least provide a warning
    • What about with a regression?
  • Can be used for non-major bumps too - just for updating to the latest version.
  • Include mini-changelog?
  • Maybe the version should just reflect the version that it targets?

Development

npm install
npm start
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].