diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c3d2e358299..2069d86cf756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - `[docs]` Replace shallow equality with referential identity in `ExpectAPI.md` ([#6991](https://github.com/facebook/jest/pull/6991)) - `[jest-changed-files]` Refactor to use `execa` over `child_process` ([#6987](https://github.com/facebook/jest/pull/6987)) - `[*]` Bump dated dependencies ([#6978](https://github.com/facebook/jest/pull/6978)) +- `[scripts]` Don’t make empty subfolders for ignored files in build folder ([#7001](https://github.com/facebook/jest/pull/7001)) ## 23.6.0 diff --git a/scripts/build.js b/scripts/build.js index 2a5f8b77aa91..ebaf99bca2ba 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -7,9 +7,9 @@ /** * script to build (transpile) files. - * By default it transpiles all files for all packages and writes them + * By default it transpiles js files for all packages and writes them * into `build/` directory. - * Non-js or files matching IGNORE_PATTERN will be copied without transpiling. + * Non-js files not matching IGNORE_PATTERN will be copied without transpiling. * * Example: * node ./scripts/build.js @@ -124,7 +124,6 @@ function buildBrowserPackage(p) { function buildFile(file, silent) { const destPath = getBuildPath(file, BUILD_DIR); - mkdirp.sync(path.dirname(destPath)); if (micromatch.isMatch(file, IGNORE_PATTERN)) { silent || process.stdout.write( @@ -132,7 +131,11 @@ function buildFile(file, silent) { path.relative(PACKAGES_DIR, file) + ' (ignore)\n' ); - } else if (!micromatch.isMatch(file, JS_FILES_PATTERN)) { + return; + } + + mkdirp.sync(path.dirname(destPath)); + if (!micromatch.isMatch(file, JS_FILES_PATTERN)) { fs.createReadStream(file).pipe(fs.createWriteStream(destPath)); silent || process.stdout.write(