mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
@@ -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'),
|
||||
`
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
"bugs": "https://github.com/facebook/react/issues",
|
||||
"license": "BSD-3-Clause",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"PATENTS",
|
||||
"addons.js",
|
||||
"react.js",
|
||||
"addons/",
|
||||
|
||||
Reference in New Issue
Block a user