From dbf3f91f1ec0f63db711ec8b874c9fc5609bdc2e Mon Sep 17 00:00:00 2001 From: Raja Sekar Date: Wed, 18 Dec 2019 11:17:35 +0100 Subject: [PATCH] Revert "Prevent ignored files in out dir (#10831)" (#10886) This reverts commit 2b3590929b4eb955b0e8b287f9749b5af66cc1a0. --- packages/babel-cli/src/babel/dir.js | 12 ++---------- packages/babel-cli/src/babel/options.js | 6 ------ .../out-files/lib/foo/.foo.js | 1 + .../out-files/lib/foo/index.js} | 0 .../out-files/lib}/index.js | 0 .../in-files/src/.foorc | 0 .../in-files/src/README.md | 0 .../options.json | 12 ------------ .../out-files/lib/README.md | 0 .../out-files/lib/index.js | 3 --- .../stdout.txt | 2 -- .../out-files/lib/foo/bar.js | 0 .../--copy-files with only/out-files/lib/index.js | 1 + 13 files changed, 4 insertions(+), 33 deletions(-) create mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js rename packages/babel-cli/test/fixtures/babel/{--copy-files with ignore with includeIgnored/in-files/src/foo/bar.js => --copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js} (100%) rename packages/babel-cli/test/fixtures/babel/{--copy-files with ignore with includeIgnored/in-files/src => --copy-files --include-dotfiles with only/out-files/lib}/index.js (100%) delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/.foorc delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/README.md delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/options.json delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/README.md delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/index.js delete mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/stdout.txt rename packages/babel-cli/test/fixtures/babel/{--copy-files with ignore with includeIgnored => --copy-files with ignore}/out-files/lib/foo/bar.js (100%) create mode 100644 packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 62ad36ba58..234eb7c8f6 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -84,16 +84,8 @@ export default async function({ async function handleFile(src: string, base: string): Promise { const written = await write(src, base); - const relative = path.relative(base, src); - const isCompilableExtension = util.isCompilableExtension( - relative, - cliOptions.extensions, - ); - if ( - !written && - ((!isCompilableExtension && cliOptions.copyFiles) || - cliOptions.includeIgnored) - ) { + + if (!written && cliOptions.copyFiles) { const filename = path.relative(base, src); const dest = getDest(filename, base); outputFileSync(dest, fs.readFileSync(src)); diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 45590ae934..fa09d6b64e 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -161,11 +161,6 @@ commander.option( "Delete the out directory before compilation.", ); -commander.option( - "--include-ignored", - "Include ignored files when copying non-compilable files.", -); - commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); // register an empty action handler so that commander.js can throw on @@ -309,7 +304,6 @@ export default function parseArgv(args: Array): CmdOptions | null { quiet: opts.quiet, deleteDirOnStart: opts.deleteDirOnStart, sourceMapTarget: opts.sourceMapTarget, - includeIgnored: opts.includeIgnored, }, }; } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js new file mode 100644 index 0000000000..31142aabfe --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js @@ -0,0 +1 @@ +a; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/.foorc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/in-files/src/README.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/options.json deleted file mode 100644 index 36b8f50db7..0000000000 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "args": [ - "src", - "--out-dir", - "lib", - "--copy-files", - "--ignore", - "src/foo/*", - "--include-ignored", - "--verbose" - ] -} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/README.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/index.js deleted file mode 100644 index cb5e86b12e..0000000000 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/index.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -index; \ No newline at end of file diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/stdout.txt deleted file mode 100644 index 84a430432e..0000000000 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -src/index.js -> lib/index.js -Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with includeIgnored/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js new file mode 100644 index 0000000000..c6788558ed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js @@ -0,0 +1 @@ +index;