Skip to content

Commit

Permalink
Merge pull request facebook#918 from spicyj/npm-react-rec
Browse files Browse the repository at this point in the history
Fix copying files to build/npm-react recursively
  • Loading branch information
zpao committed Jan 21, 2014
2 parents 494f6e9 + 76a7e2d commit 9c91546
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions grunt/tasks/npm-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down

0 comments on commit 9c91546

Please sign in to comment.