From d4b19628d9bd36d36cdc238c16fa340d5f141a04 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 13 Apr 2016 15:21:05 -0700 Subject: [PATCH] Ensure react-native-renderer package gets copied --- Gruntfile.js | 2 ++ grunt/tasks/npm-react-native.js | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index d3591ec8edd40..f1f3c435670d3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -75,6 +75,7 @@ module.exports = function(grunt) { grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease); var npmReactNativeTasks = require('./grunt/tasks/npm-react-native'); + grunt.registerTask('npm-react-native:release', npmReactNativeTasks.buildRelease); grunt.registerTask('npm-react-native:pack', npmReactNativeTasks.packRelease); var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons'); @@ -130,6 +131,7 @@ module.exports = function(grunt) { 'npm-react:pack', 'npm-react-dom:release', 'npm-react-dom:pack', + 'npm-react-native:release', 'npm-react-native:pack', 'npm-react-addons:release', 'npm-react-addons:pack', diff --git a/grunt/tasks/npm-react-native.js b/grunt/tasks/npm-react-native.js index 132ae2d9e3d89..7157e08f6bb3b 100644 --- a/grunt/tasks/npm-react-native.js +++ b/grunt/tasks/npm-react-native.js @@ -3,6 +3,30 @@ var fs = require('fs'); var grunt = require('grunt'); +var src = 'packages/react-native-renderer/'; +var dest = 'build/packages/react-native-renderer/'; + +function buildRelease() { + if (grunt.file.exists(dest)) { + grunt.file.delete(dest); + } + + // Copy to build/packages/react-native-renderer + var mappings = [].concat( + grunt.file.expandMapping('**/*', dest, {cwd: src}), + grunt.file.expandMapping('{LICENSE,PATENTS}', dest) + ); + mappings.forEach(function(mapping) { + var mappingSrc = mapping.src[0]; + var mappingDest = mapping.dest; + if (grunt.file.isDir(mappingSrc)) { + grunt.file.mkdir(mappingDest); + } else { + grunt.file.copy(mappingSrc, mappingDest); + } + }); +} + function packRelease() { var done = this.async(); var spawnCmd = { @@ -17,5 +41,6 @@ function packRelease() { } module.exports = { + buildRelease: buildRelease, packRelease: packRelease, };