Skip to content

Commit 7b41b72

Browse files
authored
Add a roadmap page for CO2.js
2 parents 57fe76a + 338d506 commit 7b41b72

File tree

9 files changed

+351
-9
lines changed

9 files changed

+351
-9
lines changed

.eleventy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require('dotenv').config()
12
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
23
const metagen = require('eleventy-plugin-metagen');
34
const sitemap = require("@quasibit/eleventy-plugin-sitemap");

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/dist
22
/node_modules
3-
/.cache
3+
/.cache
4+
.env

package-lock.json

Lines changed: 209 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"license": "ISC",
1313
"devDependencies": {
1414
"@11ty/eleventy": "^3.0.0-alpha.10",
15-
"@11ty/eleventy-fetch": "^4.0.1",
1615
"@11ty/eleventy-navigation": "^0.3.5",
1716
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
1817
"@quasibit/eleventy-plugin-sitemap": "^2.2.0",
@@ -26,5 +25,9 @@
2625
"markdown-it-anchor": "^9.0.1",
2726
"postcss": "^8.4.38",
2827
"tailwindcss": "^3.4.3"
28+
},
29+
"dependencies": {
30+
"@octokit/core": "^6.1.2",
31+
"dotenv": "^16.4.5"
2932
}
30-
}
33+
}

src/_data/co2jsRoadmapCurrent.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
const getGithubData = async () => {
3+
const { Octokit } = await import('@octokit/core');
4+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
5+
const issues = await octokit.request('GET /repos/{owner}/{repo}/issues', {
6+
owner: 'thegreenwebfoundation',
7+
repo: 'co2.js',
8+
labels: 'roadmap,release-planned',
9+
state: 'open',
10+
});
11+
12+
// Check for any issues that have a label of "funding-required" and add that to the data
13+
issues.data.forEach(issue => {
14+
if (issue.labels.find(label => label.name === "funding-required")) {
15+
issue.fundingRequired = true;
16+
}
17+
});
18+
19+
return issues.data;
20+
}
21+
22+
module.exports = getGithubData;

src/_data/co2jsRoadmapFuture.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const getGithubData = async () => {
2+
const { Octokit } = await import('@octokit/core');
3+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
4+
const issues = await octokit.request('GET /repos/{owner}/{repo}/issues', {
5+
owner: 'thegreenwebfoundation',
6+
repo: 'co2.js',
7+
labels: 'roadmap',
8+
state: 'open',
9+
});
10+
11+
// Remove any issues with the "release-planned" label
12+
issues.data = issues.data.filter(issue => !issue.labels.find(label => label.name === "release-planned"));
13+
14+
// Check for any issues that have a label of "funding-required" and add that to the data
15+
issues.data.forEach(issue => {
16+
if (issue.labels.find(label => label.name === "funding-required")) {
17+
issue.fundingRequired = true;
18+
}
19+
});
20+
21+
return issues.data;
22+
}
23+
24+
module.exports = getGithubData;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<ul class="list-none roadmap-list">
2+
{%- for issue in issues -%}
3+
<li class="px-3 py-2">
4+
<h3>
5+
<a href="{{ issue.html_url }}">
6+
<span class="link link-hover">{{ issue.title | safe }}</span>
7+
{%- if issue.milestone.title -%}
8+
<span class="badge badge-outline ml-3">Release {{ issue.milestone.title }}</span>
9+
{%- elseif issue.fundingRequired -%}
10+
<a href="https://www.thegreenwebfoundation.org/donate/" class="badge badge-accent ml-3 text-white no-underline">Funding
11+
Required</a>
12+
{%- endif -%}
13+
</a>
14+
</h3>
15+
<div class="flex gap-4 flex-row flex-wrap items-center mb-4">
16+
<p class="prose-sm not-prose">Comments: {{ issue.comments }}</p>
17+
<p class="prose-sm not-prose">Reactions: {{ issue.reactions.total_count }}</p>
18+
<p class="prose-sm not-prose">Contributed by:
19+
<span class="roadmap-issue-contributor">
20+
<img class="sm:invisible md:visible" src="{{ issue.user.avatar_url }}" loading="lazy">
21+
<a href="{{ issue.user.html_url }}" class="link">{{ issue.user.login }}</a>
22+
</span>
23+
</p>
24+
</div>
25+
<div class="flex flex-row flex-wrap items-center gap-6 not-prose font-semibold">
26+
{%- if issue.fundingRequired -%}
27+
<a href="https://www.thegreenwebfoundation.org/donate/" class="link link-accent">Fund this work</a>
28+
{%- endif -%}
29+
<a href="{{ issue.html_url }}" class="link link-hover text-black">
30+
View on GitHub
31+
</a>
32+
</div>
33+
</li>
34+
{%- endfor -%}
35+
</ul>

0 commit comments

Comments
 (0)