Add --out-file-extension option to babel-cli (#9144)
* Add --use-file-extension option to babel-cli * refactor file extension logic use existing methods from path module * Rename use-file-extension -> out-file-extension * add error message if bot keep- and out-file-extension is used * add test for error when mixing --keep- and --out-file-extension * poke travis
This commit is contained in:
committed by
Nicolò Ribaudo
parent
c3388ea42f
commit
3af02f63de
@@ -0,0 +1 @@
|
||||
arr.map(x => x / DIVIDER);
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
12
packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json
vendored
Normal file
12
packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"args": [
|
||||
"src",
|
||||
"--out-dir",
|
||||
"lib",
|
||||
"--out-file-extension",
|
||||
".mjs",
|
||||
"--extensions",
|
||||
".jsx,.mjs",
|
||||
"--verbose"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x / DIVIDER;
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
src/bar.mjs -> lib/bar.mjs
|
||||
src/foo.jsx -> lib/foo.mjs
|
||||
Successfully compiled 2 files with Babel.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--keep-file-extension", "--out-file-extension", ".mjs"],
|
||||
"stderrContains": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
--out-file-extension cannot be used with --keep-file-extension
|
||||
Reference in New Issue
Block a user