Skip to content

Commit 10edb83

Browse files
committed
Ensure license and patents files are packaged for npm
1 parent 95da627 commit 10edb83

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

grunt/tasks/npm-react-addons.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ function generateSource(info) {
7373

7474
function buildReleases() {
7575
var pkgTemplate = grunt.file.readJSON('./packages/react-addons/package.json');
76-
var license = grunt.file.read('./LICENSE');
77-
var patents = grunt.file.read('./PATENTS');
7876

7977
Object.keys(addons).map(function(k) {
8078
var info = addons[k];
8179
var pkgName = 'react-addons-' + info.name;
8280
var destDir = 'build/packages/' + pkgName;
81+
var destLicense = path.join(destDir, 'LICENSE');
82+
var destPatents = path.join(destDir, 'PATENTS');
8383

8484
var pkgData = assign({}, pkgTemplate);
8585
pkgData.name = pkgName;
@@ -89,8 +89,8 @@ function buildReleases() {
8989
link = `https://facebook.github.io/react/docs/${link}.html`;
9090
fs.writeFileSync(path.join(destDir, 'index.js'), generateSource(info));
9191
fs.writeFileSync(path.join(destDir, 'package.json'), JSON.stringify(pkgData, null, 2));
92-
fs.writeFileSync(path.join(destDir, 'LICENSE'), license);
93-
fs.writeFileSync(path.join(destDir, 'PATENTS'), patents);
92+
grunt.file.copy('LICENSE', destLicense);
93+
grunt.file.copy('PATENTS', destPatents);
9494
fs.writeFileSync(
9595
path.join(destDir, 'README.md'),
9696
`

grunt/tasks/npm-react-dom.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function buildRelease() {
1818

1919
// Copy to build/packages/react-dom
2020
var mappings = [].concat(
21-
grunt.file.expandMapping('**/*', dest, {cwd: src})
21+
grunt.file.expandMapping('**/*', dest, {cwd: src}),
22+
grunt.file.expandMapping('{LICENSE,PATENTS}', dest)
2223
);
2324
mappings.forEach(function(mapping) {
2425
var mappingSrc = mapping.src[0];

grunt/tasks/npm-react.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ function buildRelease() {
2828
// and build/modules/**/* to build/react-core/lib
2929
var mappings = [].concat(
3030
grunt.file.expandMapping('**/*', dest, {cwd: src}),
31-
grunt.file.expandMapping('**/*', lib, {cwd: modSrc})
31+
grunt.file.expandMapping('**/*', lib, {cwd: modSrc}),
32+
grunt.file.expandMapping('{LICENSE,PATENTS}', dest)
3233
);
3334
mappings.forEach(function(mapping) {
3435
var mappingSrc = mapping.src[0];

packages/react/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"bugs": "https://github.com/facebook/react/issues",
1010
"license": "BSD-3-Clause",
1111
"files": [
12+
"LICENSE",
13+
"PATENTS",
1214
"addons.js",
1315
"react.js",
1416
"addons/",

0 commit comments

Comments
 (0)