Merge pull request #2 from adrianvic/project-releases
Better CSS for releases page (inspired on GitHub). Github fetched relases now show more info.
This commit is contained in:
commit
8e4948d5b3
11 changed files with 166 additions and 33 deletions
|
|
@ -12,7 +12,12 @@ const buildTime = new Date(Date.now()).toISOString();
|
||||||
export default function (eleventyConfig) {
|
export default function (eleventyConfig) {
|
||||||
eleventyConfig.addNunjucksAsyncFilter("githubReleases", async function(owner, repo, callback) {
|
eleventyConfig.addNunjucksAsyncFilter("githubReleases", async function(owner, repo, callback) {
|
||||||
const token = process.env.GITHUB_ACCESS_TOKEN;
|
const token = process.env.GITHUB_ACCESS_TOKEN;
|
||||||
if (!owner || !repo) return callback(null, []);
|
|
||||||
|
if (!owner || !repo) return callback(null, [ name = "This project is not configured properly." ]);
|
||||||
|
if (!token || !isProd) return callback(null, [{
|
||||||
|
name: "This instance cannot fetch releases from GitHub, you can check them manually here.",
|
||||||
|
html_url: `https://github.com/${owner}/${repo}/releases`
|
||||||
|
}]);
|
||||||
|
|
||||||
const url = `https://api.github.com/repos/${owner}/${repo}/releases`;
|
const url = `https://api.github.com/repos/${owner}/${repo}/releases`;
|
||||||
|
|
||||||
|
|
@ -26,6 +31,7 @@ export default function (eleventyConfig) {
|
||||||
});
|
});
|
||||||
if (!res.ok) return callback(null, [ name = "Error fetching releases for GitHub project." ]);
|
if (!res.ok) return callback(null, [ name = "Error fetching releases for GitHub project." ]);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
console.log(data)
|
||||||
callback(null, data);
|
callback(null, data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
@ -33,6 +39,10 @@ export default function (eleventyConfig) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("collectionFind", (collection = [], url = "") => {
|
||||||
|
return collection.find(item => item.url = url);
|
||||||
|
});
|
||||||
|
|
||||||
eleventyConfig.setInputDirectory("src");
|
eleventyConfig.setInputDirectory("src");
|
||||||
eleventyConfig.setOutputDirectory("public");
|
eleventyConfig.setOutputDirectory("public");
|
||||||
eleventyConfig.addPassthroughCopy("src/projects/**/*.png");
|
eleventyConfig.addPassthroughCopy("src/projects/**/*.png");
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
"build": "npm run build:eleventy",
|
"build": "npm run build:eleventy",
|
||||||
"build:sass:prod": "sass src/static/scss:public/static/css --style compressed",
|
"build:sass:prod": "sass src/static/scss:public/static/css --style compressed",
|
||||||
"build:eleventy:prod": "ELEVENTY_ENV=production eleventy",
|
"build:eleventy:prod": "ELEVENTY_ENV=production eleventy",
|
||||||
"build:prod": "npm run build:eleventy:prod"
|
"build:prod": "npm run build:eleventy:prod",
|
||||||
|
"serve:prod": "ELEVENTY_ENV=production eleventy --serve"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
||||||
14
src/_data/news.json
Normal file
14
src/_data/news.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"date": "2025-10-30",
|
||||||
|
"title": "Releases support",
|
||||||
|
"text": "Now developers can list their software version and automatically list their GitHub releases in their project page!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"date": "2025-10-27",
|
||||||
|
"title": "Website redesign!",
|
||||||
|
"text": "Yaaay! neoBeta got a stylish redesign."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
5
src/_includes/news.njk
Normal file
5
src/_includes/news.njk
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h2>Latest updates</h2>
|
||||||
|
{% for news in news.entries %}
|
||||||
|
<p>{{ news.date }} {{ news.title }}:</p>
|
||||||
|
<p style="opacity: .8;">{{ news.text | safe }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
|
@ -6,24 +6,62 @@ pagination:
|
||||||
permalink: "{{ project.url }}releases.html"
|
permalink: "{{ project.url }}releases.html"
|
||||||
layout: base.njk
|
layout: base.njk
|
||||||
---
|
---
|
||||||
|
|
||||||
<h1>Releases for {{ project.data.name }}</h1>
|
<h1>Releases for {{ project.data.name }}</h1>
|
||||||
|
|
||||||
{% if project.data.releaseType %}
|
{% if project.data.dependencies %}
|
||||||
<p id="projectInfoReleases">
|
<p>This project depends on:
|
||||||
{% if project.data.releaseType == "github" %}
|
{% for dep in project.data.dependencies %}
|
||||||
{% set releases = project.data.githubRepoOwner | githubReleases(project.data.githubRepoName) %}
|
{% set depl = collections.projects | collectionFind("/projects/" + dep + "/") %}
|
||||||
Releases fetched from GitHub at {{ buildTime }}:<br>
|
<a href="{% if depl %}{{ depl.url | url }}{% else %}{% endif %}">{{ dep }}.</a>
|
||||||
{% for release in releases %}
|
{% endfor %}
|
||||||
<p><a href="{{ release.html_url }}">{{ release.name }}</a></p>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if project.data.releaseType == "local" %}
|
|
||||||
<p class="rainbowText">{{ project.data.releases | length }} releases.</p>
|
|
||||||
{% for label, addr in project.data.releases %}
|
|
||||||
<p><a href="{{ addr | url }}">{{ label }}</a></p>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if project.data.releaseType %}
|
||||||
|
{% if project.data.releaseType == "github" %}
|
||||||
|
{% set releases = project.data.githubRepoOwner | githubReleases(project.data.githubRepoName) %}
|
||||||
|
<p class="rainbowText">{{ releases | length }} releases fetched from GitHub at {{ buildTime }}.</p>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 1em;">
|
||||||
|
{% for release in releases %}
|
||||||
|
<div>
|
||||||
|
<h2>{{ release.name }}</h2>
|
||||||
|
<p>{{ release.tag_name }} for {{ project.data.gameLoaders or "unknown loader" }} {{ project.data.gameVersions or "unknow version" }}</p>
|
||||||
|
<div style="padding: .6em; background-color: var(--accent-background); border-radius: 4px;">
|
||||||
|
<div class="oneLineClamp">
|
||||||
|
<p><a href="{{release.html_url}}">Download on GitHub.</a><p>
|
||||||
|
</div>
|
||||||
|
<div class="oneLineClamp">
|
||||||
|
<p><a href="{{ release.tarball_url }}">Source code tarball <span class="dimText">{{ release.tarball_url }}</span></a></p>
|
||||||
|
</div>
|
||||||
|
<div class="oneLineClamp">
|
||||||
|
<p><a href="{{ release.zipball_url }}">Source code zipball <span class="dimText">{{ release.zipball_url }}</span></a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if project.data.releaseType == "local" %}
|
||||||
|
<p class="rainbowText">{{ project.data.releases | length }} releases.</p>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 1em;">
|
||||||
|
{% for release in project.data.releases %}
|
||||||
|
<div>
|
||||||
|
<h2>{{ release.name }}</h2>
|
||||||
|
<p>Version {{ release.version }} for {{ release.gameLoaders or project.data.gameLoaders }} {{ release.gameVersions or project.data.gameVersions }}</p>
|
||||||
|
{% if release.downloads %}
|
||||||
|
<div style="padding: .6em; background-color: var(--accent-background); border-radius: 4px;">
|
||||||
|
{% for label, addr in release.downloads %}
|
||||||
|
<div class="oneLineClamp">
|
||||||
|
<p><a href="{{ addr | url }}">{{ label }} <span class="dimText">{{ addr | url }}</span></a></p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Could not find any release for this project...</p>
|
<p>Could not find any release for this project...</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ code {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
font-size: .8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, select {
|
input, select {
|
||||||
|
|
@ -93,6 +94,10 @@ hr {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
text-shadow: 2px 6px 5px rgba(0,0,0,0.2), 0px -4px 10px rgba(0,0,0,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
#linksBox {
|
#linksBox {
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -184,6 +189,16 @@ hr {
|
||||||
-webkit-box-orient: vertical
|
-webkit-box-orient: vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.oneLineClamp {
|
||||||
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
|
display: -webkit-box;
|
||||||
|
height: 1em;
|
||||||
|
line-clamp: 1;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
-webkit-box-orient: vertical
|
||||||
|
}
|
||||||
|
|
||||||
.featuredProjectSubtitle {
|
.featuredProjectSubtitle {
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
@ -235,6 +250,7 @@ h1, h2, h3 {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
animation: rainbow_animation 6s ease-in-out infinite;
|
animation: rainbow_animation 6s ease-in-out infinite;
|
||||||
background-size: 400% 100%;
|
background-size: 400% 100%;
|
||||||
|
text-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rainbow_animation {
|
@keyframes rainbow_animation {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
---
|
---
|
||||||
name: "tenkuma"
|
name: "tenkuma"
|
||||||
subtitle: "A bear doing things on the internet."
|
subtitle: "A bear doing things on the internet."
|
||||||
downloadLink: "https://modrinth.com/plugin/tenkumalib/versions"
|
logo: "logo.png"
|
||||||
logoName: "logo"
|
|
||||||
logoExtension: "png"
|
|
||||||
images: ["tenkuma-silverfish.jpg", "tenkuma-mrnando-enderdragon.jpg"]
|
images: ["tenkuma-silverfish.jpg", "tenkuma-mrnando-enderdragon.jpg"]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,21 @@ neoBeta is an open-source content management system. There are various ways you
|
||||||
### Optional metadata fields
|
### Optional metadata fields
|
||||||
Please fill as many fields as possible.
|
Please fill as many fields as possible.
|
||||||
- *images* - lists of image files names or URLs that will appear in the project page.
|
- *images* - lists of image files names or URLs that will appear in the project page.
|
||||||
- *logo* - your logo file name or URL.
|
- *logo* - your logo file name or URL.
|
||||||
|
- *gameVersions* - taget Minecraft versions.
|
||||||
|
- *gameLoaders* - supported modloaders.
|
||||||
|
|
||||||
### Releases metadata
|
### Releases metadata
|
||||||
- *releasesType* - wheter your project uses `local` releases or `github`.
|
- *releasesType* - wheter your project uses `local` releases or `github`.
|
||||||
|
|
||||||
For local releases:
|
For local releases:
|
||||||
- *releases* - a list of relases labels and links.
|
- *releases* - a list of relases labels and links.
|
||||||
|
- *name* - name of the release.
|
||||||
|
- *version* - version of the release.
|
||||||
|
- *gameVersions* - taget Minecraft versions (overrides default value).
|
||||||
|
- *gameLoaders* - supported modloaders (overrides default value).
|
||||||
|
- *downloads* - list of download links for this release.
|
||||||
|
|
||||||
For GitHub releases:
|
For GitHub releases:
|
||||||
- *githubRepoOwner* - username of the repo owner.
|
- *githubRepoOwner* - username of the repo owner.
|
||||||
- *githubReponame* - name of the repository.
|
- *githubReponame* - name of the repository.
|
||||||
|
|
@ -47,7 +56,17 @@ For GitHub releases:
|
||||||
"releaseType": "github or local",
|
"releaseType": "github or local",
|
||||||
"githubRepoOwner": "adrianvic",
|
"githubRepoOwner": "adrianvic",
|
||||||
"githubRepoName": "ghostsandstuff",
|
"githubRepoName": "ghostsandstuff",
|
||||||
"releases": {
|
"gameLoaders": ["Craftbukkit"]
|
||||||
"test release": "https://example.com/"
|
"releases": [
|
||||||
}
|
{
|
||||||
}```
|
"name": "The first release.",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"gameVersions": ["b1.7.3"],
|
||||||
|
"downloads": {
|
||||||
|
"GitHub": "https://example.com",
|
||||||
|
"Modrinth": "https://modrinth.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -11,10 +11,9 @@ styles: ["home"]
|
||||||
<div id="featureAndUpdates">
|
<div id="featureAndUpdates">
|
||||||
<div>
|
<div>
|
||||||
<h2>Featured projects</h2>
|
<h2>Featured projects</h2>
|
||||||
{{ featured.projectShowcase(["ghostsandstuff", "aboukkit", "tenkumalib", "hangglidere", "devilwithin", "timekeeper", "tefreezer"], collections.projects) }}
|
{{ featured.projectShowcase(["ghostsandstuff", "devilwithin", "timekeeper", "tefreezer"], collections.projects) }}
|
||||||
</div>
|
</div>
|
||||||
<div id="homeUpdates">
|
<div id="homeUpdates">
|
||||||
<h2>Latest updates</h2>
|
{% include "news.njk" %}
|
||||||
<p>2025-10-27: Website redesign!<br>Yaaay! neoBeta got a stylish redesign.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -2,7 +2,38 @@
|
||||||
"name": "Aboukkit",
|
"name": "Aboukkit",
|
||||||
"subtitle": "A simple way to add custom commands with custom responses to your server.",
|
"subtitle": "A simple way to add custom commands with custom responses to your server.",
|
||||||
"author": "tenkuma",
|
"author": "tenkuma",
|
||||||
"downloadLink": "https://modrinth.com/plugin/aboukkit/versions",
|
"links": {
|
||||||
|
"Modrinth": "https://modrinth.com/plugin/aboukkit/versions",
|
||||||
|
"GitHub": "https://github.com/adrianvic/aboukkit",
|
||||||
|
"Disroot Git": "https://git.disroot.org/adrianvictor/aboukkit"
|
||||||
|
},
|
||||||
"logo": "logo.png",
|
"logo": "logo.png",
|
||||||
"tags": ["plugin"]
|
"tags": ["plugin"],
|
||||||
|
"releaseType": "local",
|
||||||
|
"dependencies": ["tenkumalib"],
|
||||||
|
"gameVersions": "b1.7.3",
|
||||||
|
"gameLoaders": "Bukkit",
|
||||||
|
"releases": [
|
||||||
|
{
|
||||||
|
"name": "Library update",
|
||||||
|
"version": "2.1",
|
||||||
|
"downloads": {
|
||||||
|
"Modrinth": "https://modrinth.com/plugin/aboukkit/version/2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Color update",
|
||||||
|
"version": "2.0",
|
||||||
|
"downloads": {
|
||||||
|
"Modrinth": "https://modrinth.com/plugin/aboukkit/version/2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vanilla",
|
||||||
|
"version": "1.0",
|
||||||
|
"downloads": {
|
||||||
|
"Modrinth": "https://modrinth.com/plugin/aboukkit/version/1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -15,5 +15,7 @@
|
||||||
},
|
},
|
||||||
"releaseType": "github",
|
"releaseType": "github",
|
||||||
"githubRepoOwner": "adrianvic",
|
"githubRepoOwner": "adrianvic",
|
||||||
"githubRepoName": "ghostsandstuff"
|
"githubRepoName": "ghostsandstuff",
|
||||||
|
"gameVersions": ["b1.7.3"],
|
||||||
|
"gameLoaders": ["Bukkit"]
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue