Skip to content

Commit e918f2e

Browse files
authored
Add browser support to the issue template (#386)
Also move "learn more" to the end to keep the feedback section prominent.
1 parent 8f1db00 commit e918f2e

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

scripts/update-issues.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,32 @@ async function* iterateIssues(octokit: Octokit, params: IterateIssuesParams) {
6666
}
6767
}
6868

69+
const dateFormat = new Intl.DateTimeFormat("en", { dateStyle: "medium" });
70+
6971
function issueBody(id: string, data: (typeof features)[string]) {
72+
const supportLines = [];
73+
for (const [browser, { name, releases }] of Object.entries(browsers)) {
74+
const version = data.status.support[browser];
75+
if (version) {
76+
const date = releases.find((r) => r.version === version)!.date;
77+
const dateString = dateFormat.format(new Date(date));
78+
supportLines.push(`${name} ${version} (${dateString})`);
79+
} else {
80+
supportLines.push(`${name}: not supported`);
81+
}
82+
}
83+
const supportBlock = supportLines.map((l) => `- ${l}`).join("\n");
84+
7085
// TODO: include MDN links (before caniuse link) when we have web-features-mappings
7186
// as a dependency (see above).
7287
return dedent`
7388
_This GitHub issue is for collecting web developer signals for ${data.name}._
7489
7590
${data.description_html}
7691
77-
To learn more about this feature:
92+
## Browser support
7893
79-
${data.caniuse ? `- [caniuse.com](https://caniuse.com/${data.caniuse})` : ""}
80-
- [web features explorer](https://web-platform-dx.github.io/web-features-explorer/features/${id})
81-
- [webstatus.dev](https://webstatus.dev/features/${id})
82-
- [Specification](${data.spec})
94+
${supportBlock}
8395
8496
## Give us feedback
8597
@@ -103,6 +115,15 @@ function issueBody(id: string, data: (typeof features)[string]) {
103115
-->
104116
\`\`\`
105117
118+
## Learn more
119+
120+
You can learn more about this feature here:
121+
122+
${data.caniuse ? `- [caniuse.com](https://caniuse.com/${data.caniuse})` : ""}
123+
- [web features explorer](https://web-platform-dx.github.io/web-features-explorer/features/${id})
124+
- [webstatus.dev](https://webstatus.dev/features/${id})
125+
- [Specification](${data.spec})
126+
106127
<!-- web-features:${id} -->
107128
`;
108129
}

0 commit comments

Comments
 (0)