ksherlock / better-babel-cli

a better babel command-line utility
11 stars 0 forks source link

command line equivalent of es2015 loose=true modules=false ? #3

Closed kzc closed 8 years ago

kzc commented 8 years ago

Great project.

I've been trying unsuccessfully to create the command line equivalent of the following .babelrc:

{
  "presets": [
    ["latest", {
      "es2015": {
        "loose": true,
        "modules": false
      }
    }]
  ]
}

Is it possible?

ksherlock commented 8 years ago

Hi, thanks for your comments.

I've added support in the github repo for --es2017 and --latest. I'll update the npm package after I do some testing.

with the new version, it will be: babel --latest --loose with current npm version, you could do: babel --es2015 --loose --no-transform-es2015-modules-commonjs (and add --transform-exponentiation-operator --syntax-trailing-function-commas --transform-async-to-generator to include the es 2016 and 2017 features)

kzc commented 8 years ago

That's awesome. Thanks!

So "modules": false will be the default in --es2015 going forward?

I just stumbled upon this project by chance. Not sure why it isn't well known. Without this babel 6 is completely indecipherable/unusable for me.

ksherlock commented 8 years ago

I just published the updates on NPM.

The preset options mirror the babel presets, as much as possible. Since babel-preset-es2015 no longer automatically includes a module system, I've dropped it from --es2015 as well. (I'm not a fan of commonjs and --no-es2015-modules-commonjs exists to avoid it). Going forward, If you want a module system, you'll need to opt-in with --es2015-modules-commonjs etc.

kzc commented 8 years ago

Works great. Thanks again.