Skip to content

Commit

Permalink
Ensure react-native-renderer package gets copied
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 20, 2016
1 parent 22a8f99 commit c7d90e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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',
Expand Down
25 changes: 25 additions & 0 deletions grunt/tasks/npm-react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -17,5 +41,6 @@ function packRelease() {
}

module.exports = {
buildRelease: buildRelease,
packRelease: packRelease,
};

0 comments on commit c7d90e2

Please sign in to comment.