@samitouri / QOS-React-2 / commits / 76a7e2de75

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.

Ben Alpert committed Jan 17, 2014 at 01:15 UTC 76a7e2de752446194ae12db26ebdbbca407484a6
1 file changed +7 -8
grunt/tasks/npm-react.js
+7 -8
@@ -14,9 +14,13 @@ function buildRelease() {
14 // mkdir -p build/react-core/lib
15 grunt.file.mkdir(lib);
16
17 - // Copy everything over
18 - // console.log(grunt.file.expandMapping(src + '**/*', dest, {flatten: true}));
19 - grunt.file.expandMapping(src + '**/*', dest, {flatten: true}).forEach(function(mapping) {
17 + // Copy npm-react/**/* to build/npm-react
18 + // and build/modules/**/* to build/react-core/lib
19 + var mappings = [].concat(
20 + grunt.file.expandMapping('**/*', dest, {cwd: src}),
21 + grunt.file.expandMapping('**/*', lib, {cwd: modSrc})
22 + );
23 + mappings.forEach(function(mapping) {
24 var src = mapping.src[0];
25 var dest = mapping.dest;
26 if (grunt.file.isDir(src)) {
@@ -26,11 +30,6 @@ function buildRelease() {
30 }
31 });
32
29 - // copy build/modules/*.js to build/react-core/lib
30 - grunt.file.expandMapping(modSrc + '*.js', lib, { flatten: true }).forEach(function(mapping) {
31 - grunt.file.copy(mapping.src[0], mapping.dest);
32 - });
33 -
33 // modify build/react-core/package.json to set version ##
34 var pkg = grunt.file.readJSON(dest + 'package.json');
35 pkg.version = grunt.config.data.pkg.version;