@samitouri / QOS-React-2 / commits / 88584a96b7

Generate better readmes for addons npm packages

Paul O’Shannessy committed Nov 4, 2015 at 17:32 UTC 88584a96b75d5dfbffc9afc095952c4c3d01b75b
1 file changed +17 -3
grunt/tasks/npm-react-addons.js
+17 -3
@@ -9,35 +9,43 @@ var addons = {
9 CSSTransitionGroup: {
10 module: 'ReactCSSTransitionGroup',
11 name: 'css-transition-group',
12 + docs: 'animation',
13 },
14 LinkedStateMixin: {
15 module: 'LinkedStateMixin',
16 name: 'linked-state-mixin',
17 + docs: 'two-way-binding-helpers',
18 },
19 Perf: {
20 module: 'ReactDefaultPerf',
21 name: 'perf',
22 + docs: 'perf',
23 },
24 PureRenderMixin: {
25 module: 'ReactComponentWithPureRenderMixin',
26 name: 'pure-render-mixin',
27 + docs: 'pure-render-mixin',
28 },
29 TestUtils: {
30 module: 'ReactTestUtils',
31 name: 'test-utils',
32 + docs: 'test-utils',
33 },
34 TransitionGroup: {
35 module: 'ReactTransitionGroup',
36 name: 'transition-group',
37 + docs: 'animation',
38 },
39 cloneWithProps: {
40 module: 'cloneWithProps',
41 name: 'clone-with-props',
42 + docs: 'clone-with-props',
43 },
44 createFragment: {
45 module: 'ReactFragment',
46 method: 'create',
47 name: 'create-fragment',
48 + docs: 'create-fragment',
49 },
50 shallowCompare: {
51 module: 'shallowCompare',
@@ -46,6 +54,7 @@ var addons = {
54 updates: {
55 module: 'update',
56 name: 'update',
57 + docs: 'update',
58 },
59 };
60
@@ -76,15 +85,20 @@ function buildReleases() {
85 pkgData.name = pkgName;
86
87 grunt.file.mkdir(destDir);
88 + var link = info.docs ? info.docs : 'addons';
89 + link = `https://facebook.github.io/react/docs/${link}.html`;
90 fs.writeFileSync(path.join(destDir, 'index.js'), generateSource(info));
91 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);
94 fs.writeFileSync(
95 path.join(destDir, 'README.md'),
85 - '# ' + pkgName + '\n\n' +
86 - 'This package provides the React ' + k + ' add-on. See ' +
87 - 'http://facebook.github.io/react/docs/addons.html for more information.\n'
96 + `
97 +# ${pkgName}
98 +
99 +This package provides the React ${k} add-on.
100 +
101 +See <${link}> for more information.`.slice(1)
102 );
103 });
104