Add --include-dotfiles option to babel-cli (#6232)

This commit is contained in:
Brian Ng
2017-10-02 08:55:53 -05:00
committed by GitHub
parent 6816b26994
commit 9cd4716cb4
43 changed files with 96 additions and 16 deletions

View File

@@ -0,0 +1,9 @@
{
"args": [
"src",
"--out-dir", "lib",
"--copy-files",
"--include-dotfiles",
"--ignore", "src/foo"
]
}

View File

@@ -0,0 +1,3 @@
"use strict";
index;

View File

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

View File

@@ -0,0 +1,9 @@
{
"args": [
"src",
"--out-dir", "lib",
"--copy-files",
"--include-dotfiles",
"--only", "src/foo"
]
}

View File

@@ -0,0 +1,3 @@
"use strict";
bar;

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
"use strict";
a;

View File

@@ -0,0 +1,3 @@
"use strict";
bar;

View File

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

View File

@@ -88,10 +88,14 @@ const assertTest = function(stdout, stderr, opts) {
}
if (opts.outFiles) {
const actualFiles = readDir(path.join(tmpLoc));
const actualFiles = readDir(path.join(tmpLoc), fileFilter);
Object.keys(actualFiles).forEach(function(filename) {
if (!opts.inFiles.hasOwnProperty(filename)) {
if (
// saveInFiles always creates an empty .babelrc, so lets exclude for now
filename !== ".babelrc" &&
!opts.inFiles.hasOwnProperty(filename)
) {
const expect = opts.outFiles[filename];
const actual = actualFiles[filename];