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:
Lukas Geiger
2017-09-10 02:38:06 +02:00
committed by Justin Ridgewell
parent 5565e1b406
commit b6467a68ca
41 changed files with 127 additions and 7 deletions

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib", "--copy-files"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1 @@
src/foo.js -> lib/foo.js

View File

@@ -0,0 +1,3 @@
class Test1 {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
class Test2 {
}

View File

@@ -0,0 +1 @@
arr.map(x => x / DIVIDER);

View File

@@ -0,0 +1,3 @@
{
"args": ["**/src", "--out-dir", "../lib", "--relative"]
}

View File

@@ -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);
};

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -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);
};

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x / DIVIDER;
});

View 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

View File

@@ -0,0 +1,4 @@
{
"args": ["--out-dir", "lib"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
filenames required for --out-dir

View File

@@ -0,0 +1,4 @@
{
"args": ["--out-dir", "lib", "--out-file", "foo.js"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
cannot have --out-file and --out-dir

View File

@@ -0,0 +1,4 @@
{
"args": ["--relative"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
output directory required for --relative

View File

@@ -0,0 +1,4 @@
{
"args": ["--skip-initial-build"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
--skip-initial-build requires --watch

View File

@@ -0,0 +1,4 @@
{
"args": ["--watch"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
--watch requires filenames

View File

@@ -0,0 +1,4 @@
{
"args": ["--watch"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
--watch requires --out-file or --out-dir

View File

@@ -0,0 +1,4 @@
{
"args": ["foo.json"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
foo.json doesn't exist

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src/foo.js", "--out-dir", "../lib", "--relative"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1 @@
src/foo.js -> lib/foo.js

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src/foo.js", "--out-dir", "lib"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1 @@
src/foo.js -> lib/foo.js