Babel: CLI: options to overwrite files (T7344)

Created on 6 May 2016  路  2Comments  路  Source: babel/babel

Issue originally made by @jonathanong

Bug information

  • Babel version: 6.8.0
  • Node version: 6.1.0
  • npm version: 3.8.6

    Input code

NODE_ENV=production ./node_modules/.bin/babel --source-maps inline common -d common
NODE_ENV=production ./node_modules/.bin/babel --source-maps inline lib -d lib
NODE_ENV=production ./node_modules/.bin/babel --source-maps inline modules -d modules
NODE_ENV=production ./node_modules/.bin/babel --source-maps inline server -d server
NODE_ENV=production ./node_modules/.bin/babel --source-maps inline scripts -d scripts

Description

I'm using the above code to babelify all my server-side code in production. This is necessary because there is no "overwrite" functionality for the CLI. it would be nice if all i had to do was:

NODE_ENV=production ./node_modules/.bin/babel --source-maps inline --overwrite common lib modules server scripts

it could also be a lack of documentation on the CLI:

./node_modules/.bin/babel -h

  Usage: babel [options] <files ...>

  Options:

    -h, --help                           output usage information
    -f, --filename [filename]            filename to use when reading from stdin - this will be used in source-maps, errors etc
    --retain-lines                       retain line numbers - will result in really ugly code
    --no-highlight-code                  enable/disable ANSI syntax highlighting of code frames (on by default)
    --presets [list]                     
    --plugins [list]                     
    --ignore [list]                      list of glob paths to **not** compile
    --only [list]                        list of glob paths to **only** compile
    --no-comments                        write comments to generated output (true by default)
    --compact [booleanString]            do not include superfluous whitespace characters and line terminators [true|false|auto]
    --minified                           save as much bytes when printing [true|false]
./node_modules/.bin/babel --version
6.8.0 (babel-core 6.8.0)

^ i no longer see sourcemaps or directories as options in the CLI, but i see it here: http://babeljs.io/docs/usage/cli/

i don't mind making PRs as long as you guys let me know:

  • What's the public API for the CLI? I can make a PR making them consistent in the current version.
  • Are you okay with an --overwrite option? What would you like the shortcut to be? Are you okay with the API I presented above?

thanks

outdated

Most helpful comment

This would be great to have with TypeScript's tsc and Babili CLI. With tsc JS files get generated and I would like to minify those generated files with Babili without intermediate files.

All 2 comments

This would be great to have with TypeScript's tsc and Babili CLI. With tsc JS files get generated and I would like to minify those generated files with Babili without intermediate files.

Closing, out of scope for now.

Was this page helpful?
0 / 5 - 0 ratings