Merge pull request #5431 from zpao/license-in-packages

Ensure license and patents files are packaged for npm
(cherry picked from commit fc245226f9)
This commit is contained in:
Paul O’Shannessy
2015-11-10 15:22:34 -08:00
parent 061725c9b6
commit cde2de3ce7
4 changed files with 10 additions and 6 deletions
+4 -4
View File
@@ -73,13 +73,13 @@ function generateSource(info) {
function buildReleases() {
var pkgTemplate = grunt.file.readJSON('./packages/react-addons/package.json');
var license = grunt.file.read('./LICENSE');
var patents = grunt.file.read('./PATENTS');
Object.keys(addons).map(function(k) {
var info = addons[k];
var pkgName = 'react-addons-' + info.name;
var destDir = 'build/packages/' + pkgName;
var destLicense = path.join(destDir, 'LICENSE');
var destPatents = path.join(destDir, 'PATENTS');
var pkgData = assign({}, pkgTemplate);
pkgData.name = pkgName;
@@ -89,8 +89,8 @@ function buildReleases() {
link = `https://facebook.github.io/react/docs/${link}.html`;
fs.writeFileSync(path.join(destDir, 'index.js'), generateSource(info));
fs.writeFileSync(path.join(destDir, 'package.json'), JSON.stringify(pkgData, null, 2));
fs.writeFileSync(path.join(destDir, 'LICENSE'), license);
fs.writeFileSync(path.join(destDir, 'PATENTS'), patents);
grunt.file.copy('LICENSE', destLicense);
grunt.file.copy('PATENTS', destPatents);
fs.writeFileSync(
path.join(destDir, 'README.md'),
`
+2 -1
View File
@@ -18,7 +18,8 @@ function buildRelease() {
// Copy to build/packages/react-dom
var mappings = [].concat(
grunt.file.expandMapping('**/*', dest, {cwd: src})
grunt.file.expandMapping('**/*', dest, {cwd: src}),
grunt.file.expandMapping('{LICENSE,PATENTS}', dest)
);
mappings.forEach(function(mapping) {
var mappingSrc = mapping.src[0];
+2 -1
View File
@@ -28,7 +28,8 @@ function buildRelease() {
// and build/modules/**/* to build/react-core/lib
var mappings = [].concat(
grunt.file.expandMapping('**/*', dest, {cwd: src}),
grunt.file.expandMapping('**/*', lib, {cwd: modSrc})
grunt.file.expandMapping('**/*', lib, {cwd: modSrc}),
grunt.file.expandMapping('{LICENSE,PATENTS}', dest)
);
mappings.forEach(function(mapping) {
var mappingSrc = mapping.src[0];
+2
View File
@@ -9,6 +9,8 @@
"bugs": "https://github.com/facebook/react/issues",
"license": "BSD-3-Clause",
"files": [
"LICENSE",
"PATENTS",
"addons.js",
"react.js",
"addons/",