From 76a7e2de752446194ae12db26ebdbbca407484a6 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Fri, 17 Jan 2014 01:15:15 -0800 Subject: [PATCH] Fix copying files to build/npm-react recursively The intention of the `npm-react/**/*` rule was to copy recursively but it would have flattened any nested directory structure. I changed the `build/modules` rule to copy recursively as well, which is necessary for `ReactTestUtils` to be able to require `test/mock-modules.js` successfully. (`ReactTestUtils` isn't included in a clean `npm-react` build currently but it will be in the future.) This also makes running ART tests more practical. --- grunt/tasks/npm-react.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/grunt/tasks/npm-react.js b/grunt/tasks/npm-react.js index 683820cf4757..d2ffc2a7719a 100644 --- a/grunt/tasks/npm-react.js +++ b/grunt/tasks/npm-react.js @@ -14,9 +14,13 @@ function buildRelease() { // mkdir -p build/react-core/lib grunt.file.mkdir(lib); - // Copy everything over - // console.log(grunt.file.expandMapping(src + '**/*', dest, {flatten: true})); - grunt.file.expandMapping(src + '**/*', dest, {flatten: true}).forEach(function(mapping) { + // Copy npm-react/**/* to build/npm-react + // and build/modules/**/* to build/react-core/lib + var mappings = [].concat( + grunt.file.expandMapping('**/*', dest, {cwd: src}), + grunt.file.expandMapping('**/*', lib, {cwd: modSrc}) + ); + mappings.forEach(function(mapping) { var src = mapping.src[0]; var dest = mapping.dest; if (grunt.file.isDir(src)) { @@ -26,11 +30,6 @@ function buildRelease() { } }); - // copy build/modules/*.js to build/react-core/lib - grunt.file.expandMapping(modSrc + '*.js', lib, { flatten: true }).forEach(function(mapping) { - grunt.file.copy(mapping.src[0], mapping.dest); - }); - // modify build/react-core/package.json to set version ## var pkg = grunt.file.readJSON(dest + 'package.json'); pkg.version = grunt.config.data.pkg.version;