Merge pull request #8112 from babel/feat-add-issues-link-in-readmes

Feat add issues link in readmes
This commit is contained in:
Sven SAULEAU 2018-06-05 07:39:41 +02:00 committed by GitHub
commit 218d69007e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 43 additions and 14 deletions

View File

@ -2,7 +2,7 @@
> Babel command line.
See our website [@babel/cli](https://new.babeljs.io/docs/en/next/babel-cli.html) for more information.
See our website [@babel/cli](https://new.babeljs.io/docs/en/next/babel-cli.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Babel compiler core.
See our website [@babel/core](https://new.babeljs.io/docs/en/next/babel-core.html) for more information.
See our website [@babel/core](https://new.babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> A JavaScript parser
See our website [@babel/parser](https://new.babeljs.io/docs/en/next/babel-parser.html) for more information.
See our website [@babel/parser](https://new.babeljs.io/docs/en/next/babel-parser.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20babylon%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Provides polyfills necessary for a full ES2015+ environment
See our website [@babel/polyfill](https://new.babeljs.io/docs/en/next/babel-polyfill.html) for more information.
See our website [@babel/polyfill](https://new.babeljs.io/docs/en/next/babel-polyfill.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20polyfill%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> A Babel preset for each environment.
See our website [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html) for more information.
See our website [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20preset-env%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Babel preset for all Flow plugins.
See our website [@babel/preset-flow](https://new.babeljs.io/docs/en/next/babel-preset-flow.html) for more information.
See our website [@babel/preset-flow](https://new.babeljs.io/docs/en/next/babel-preset-flow.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20flow%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Babel preset for all React plugins.
See our website [@babel/preset-react](https://new.babeljs.io/docs/en/next/babel-preset-react.html) for more information.
See our website [@babel/preset-react](https://new.babeljs.io/docs/en/next/babel-preset-react.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20react%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Babel preset for TypeScript.
See our website [@babel/preset-typescript](https://new.babeljs.io/docs/en/next/babel-preset-typescript.html) for more information.
See our website [@babel/preset-typescript](https://new.babeljs.io/docs/en/next/babel-preset-typescript.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes
See our website [@babel/traverse](https://new.babeljs.io/docs/en/next/babel-traverse.html) for more information.
See our website [@babel/traverse](https://new.babeljs.io/docs/en/next/babel-traverse.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22) associated with this package.
## Install

View File

@ -2,7 +2,7 @@
> Babel Types is a Lodash-esque utility library for AST nodes
See our website [@babel/types](https://new.babeljs.io/docs/en/next/babel-types.html) for more information.
See our website [@babel/types](https://new.babeljs.io/docs/en/next/babel-types.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22) associated with this package.
## Install

View File

@ -15,13 +15,35 @@ const packageDir = join(cwd, "packages");
const packages = readdirSync(packageDir);
const getWebsiteLink = n => `https://new.babeljs.io/docs/en/next/${n}.html`;
const getPackageJson = pkg => require(join(packageDir, pkg, "package.json"));
const getIssueLabelLink = l =>
`https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22${encodeURIComponent(
l
)}%22`;
const generateReadme = ({ link, name, description }) =>
const labels = {
"babel-preset-typescript": getIssueLabelLink("area: typescript"),
"babel-preset-flow": getIssueLabelLink("area: flow"),
"babel-preset-react": getIssueLabelLink("area: react"),
"babel-parser": getIssueLabelLink("pkg: babylon"),
"babel-cli": getIssueLabelLink("pkg: cli"),
"babel-core": getIssueLabelLink("pkg: core"),
"babel-polyfill": getIssueLabelLink("pkg: polyfill"),
"babel-preset-env": getIssueLabelLink("pkg: preset-env"),
"babel-regiser": getIssueLabelLink("pkg: regiser"),
"babel-traverse": getIssueLabelLink("pkg: traverse"),
"babel-types": getIssueLabelLink("pkg: types"),
};
const generateReadme = ({ websiteLink, issuesLink, name, description }) =>
`# ${name}
> ${description}
See our website [${name}](${link}) for more information.
See our website [${name}](${websiteLink}) for more information${
issuesLink
? ` or the [issues](${issuesLink}) associated with this package`
: ""
}.
## Install
@ -45,8 +67,15 @@ packages
const readmePath = join(packageDir, id, "README.md");
// generate
const link = getWebsiteLink(id);
const readme = generateReadme({ link, name, description });
const websiteLink = getWebsiteLink(id);
const issuesLink = labels[id];
const readme = generateReadme({
websiteLink,
issuesLink,
name,
description,
});
// write
writeFileSync(readmePath, readme);