feat: [skip ci] add link to issues in READMEs
This commit is contained in:
parent
b445b79734
commit
f614809002
@ -15,13 +15,35 @@ const packageDir = join(cwd, "packages");
|
|||||||
const packages = readdirSync(packageDir);
|
const packages = readdirSync(packageDir);
|
||||||
const getWebsiteLink = n => `https://new.babeljs.io/docs/en/next/${n}.html`;
|
const getWebsiteLink = n => `https://new.babeljs.io/docs/en/next/${n}.html`;
|
||||||
const getPackageJson = pkg => require(join(packageDir, pkg, "package.json"));
|
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}
|
`# ${name}
|
||||||
|
|
||||||
> ${description}
|
> ${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
|
## Install
|
||||||
|
|
||||||
@ -45,8 +67,15 @@ packages
|
|||||||
const readmePath = join(packageDir, id, "README.md");
|
const readmePath = join(packageDir, id, "README.md");
|
||||||
|
|
||||||
// generate
|
// generate
|
||||||
const link = getWebsiteLink(id);
|
const websiteLink = getWebsiteLink(id);
|
||||||
const readme = generateReadme({ link, name, description });
|
const issuesLink = labels[id];
|
||||||
|
|
||||||
|
const readme = generateReadme({
|
||||||
|
websiteLink,
|
||||||
|
issuesLink,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
});
|
||||||
|
|
||||||
// write
|
// write
|
||||||
writeFileSync(readmePath, readme);
|
writeFileSync(readmePath, readme);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user