Add option to define output directory relative to the input (#5421)
* Fix output directory if filename is given * Add test for relative output path * Add option to define output dir relative to input * Add tests for --copy-files * Test error handling for wrong arguments
This commit is contained in:
committed by
Justin Ridgewell
parent
5565e1b406
commit
b6467a68ca
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/bar.json
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/bar.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/foo.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/foo.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files"]
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/bar.json
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/bar.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/foo.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/foo.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/stdout.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/stdout.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -0,0 +1,3 @@
|
||||
class Test1 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -0,0 +1,3 @@
|
||||
class Test2 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x / DIVIDER);
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["**/src", "--out-dir", "../lib", "--relative"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test1 = function Test1() {
|
||||
_classCallCheck(this, Test1);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test2 = function Test2() {
|
||||
_classCallCheck(this, Test2);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x / DIVIDER;
|
||||
});
|
||||
4
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/stdout.txt
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/stdout.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package1/src/bar/bar1.js -> package1/lib/bar/bar1.js
|
||||
package1/src/foo1.js -> package1/lib/foo1.js
|
||||
package2/src/bar/bar2.js -> package2/lib/bar/bar2.js
|
||||
package2/src/foo2.js -> package2/lib/foo2.js
|
||||
4
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--out-dir", "lib"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
filenames required for --out-dir
|
||||
4
packages/babel-cli/test/fixtures/babel/error --out-dir/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --out-dir/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--out-dir", "lib", "--out-file", "foo.js"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --out-dir/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --out-dir/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
cannot have --out-file and --out-dir
|
||||
4
packages/babel-cli/test/fixtures/babel/error --relative/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --relative/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--relative"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --relative/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --relative/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
output directory required for --relative
|
||||
4
packages/babel-cli/test/fixtures/babel/error --skip-initial-build/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --skip-initial-build/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--skip-initial-build"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --skip-initial-build/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --skip-initial-build/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
--skip-initial-build requires --watch
|
||||
4
packages/babel-cli/test/fixtures/babel/error --watch no filename/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --watch no filename/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--watch"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --watch no filename/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --watch no filename/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
--watch requires filenames
|
||||
4
packages/babel-cli/test/fixtures/babel/error --watch/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --watch/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--watch"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --watch/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --watch/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
--watch requires --out-file or --out-dir
|
||||
4
packages/babel-cli/test/fixtures/babel/error wrong filename/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error wrong filename/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["foo.json"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error wrong filename/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error wrong filename/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo.json doesn't exist
|
||||
1
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/in-files/src/foo.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/in-files/src/foo.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
3
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src/foo.js", "--out-dir", "../lib", "--relative"]
|
||||
}
|
||||
5
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/out-files/lib/foo.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/out-files/lib/foo.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
1
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/stdout.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-dir --relative/stdout.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
1
packages/babel-cli/test/fixtures/babel/filename --out-dir/in-files/src/foo.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-dir/in-files/src/foo.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
3
packages/babel-cli/test/fixtures/babel/filename --out-dir/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename --out-dir/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src/foo.js", "--out-dir", "lib"]
|
||||
}
|
||||
5
packages/babel-cli/test/fixtures/babel/filename --out-dir/out-files/lib/foo.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/filename --out-dir/out-files/lib/foo.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
1
packages/babel-cli/test/fixtures/babel/filename --out-dir/stdout.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-dir/stdout.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
Reference in New Issue
Block a user