Compare commits

...

13 Commits

Author SHA1 Message Date
Gabriel Tower
b79872f83d Merge 0f4713b74f into 8a68ba8893 2024-11-18 18:19:52 +09:00
Shmavon Gazanchyan
8a68ba8893 Update README.md 2024-11-17 22:20:37 +00:00
Sammy Hori
1487aeb5bc Merge pull request #1515 from MunGell/reimplement-add-zoom-rs
(Reimplements #1297) Add zoom-rs to README.md data.json
2024-11-17 22:20:26 +00:00
Sammy Hori
8c37533a58 Add zoom-rs to README.md data.json 2024-11-17 22:19:10 +00:00
Sammy Hori
5daa02f521 Merge pull request #1514 from MunGell/new-templating-fix
Moved README template to different filename
2024-11-17 22:16:01 +00:00
Sammy Hori
486d0e9510 Moved README template to different filename to avoid being used as the repo README 2024-11-17 22:15:04 +00:00
Sammy Hori
c018a9d7c6 Merge pull request #1513 from MunGell/templating-workflow
Replace current README GitHub workflow script with a templating one
2024-11-17 22:11:32 +00:00
Sammy Hori
2deeb0e5e3 Set the sponsors table new row every 6 entries.
This copies the behaviour of the old script.
2024-11-17 22:10:11 +00:00
Sammy Hori
445e53bc48 Removed old script and template 2024-11-17 21:48:11 +00:00
Sammy Hori
b531c33c6b Changed github workflow to run new script 2024-11-17 21:45:43 +00:00
Sammy Hori
fe164b7153 Made changes to the filepaths
to enable running of the script from the repo root.
2024-11-17 20:58:37 +00:00
Sammy Hori
f581020ab6 WIP: Added new script for building the README
This uses jinja templating to do so.
The script is made to exactly copy the behaviour of the current
script as now, to prove that it does the same thing.
2024-11-17 20:58:03 +00:00
Gabriel Tower
0f4713b74f Update data.json 2024-11-13 11:57:55 -05:00
6 changed files with 72 additions and 97 deletions

View File

@@ -7,10 +7,13 @@ If you are a maintainer of open-source projects, add the label `first-timers-onl
If you are not a programmer but would like to contribute, check out the [Awesome for non-programmers](https://github.com/szabgab/awesome-for-non-programmers) list. If you are not a programmer but would like to contribute, check out the [Awesome for non-programmers](https://github.com/szabgab/awesome-for-non-programmers) list.
## Table of Contents: ## Table of Contents:
{% for category in categories %}
<% toc %> - [{{ category.title }}](#{{ category.link_id }}){% endfor %}
{% for category in categories %}
<% content %> ## {{ category.title }}
{% for entry in category.entries %}
- [{{ entry.name }}]({{ entry.link }}) _(label: {% if entry.label is defined %}{{ entry.label }}{% else %}n/a{% endif %})_ <br> {{ entry.description }}{% endfor %}
{% endfor %}
## Contribute ## Contribute
@@ -18,10 +21,11 @@ Contributions are welcome! See the [contributing guidelines](CONTRIBUTING.md).
## Thanks to GitHub Sponsors ## Thanks to GitHub Sponsors
<% sponsors %> <table><tr>{% for sponsor in sponsors %}{% if loop.index != 1 and (loop.index - 1) % 6 == 0 %}</tr><tr>{% endif %}<td align="center"><a href="{{ sponsor.link }}"><img src="{{ sponsor.image }}" width="60px;" alt=""/><br/><sub><b>{{ sponsor.name }}</b></sub></a></td>{% endfor %}</tr></table>
## License ## License
[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/) [![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/)
To the extent possible under law, the author has waived all copyrights and related or neighboring rights to this work. To the extent possible under law, the author has waived all copyrights and related or neighboring rights to this work.

View File

@@ -1,87 +0,0 @@
const fs = require('fs');
const data = require('../../data.json');
const TPL_FILE = './.github/tpl.md';
const TARGET = './README.md';
const tpl = getTemplate(TPL_FILE);
const categories = {};
data.repositories.sort((a, b) => {
const nameA = a.name.toUpperCase();
const nameB = b.name.toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
}).forEach(repo =>
repo.technologies.forEach(tech => {
if (!categories.hasOwnProperty(tech)) {
categories[tech] = [];
}
categories[tech].push(repo);
}))
const sortedCategories = Object.fromEntries(Object.entries(categories).sort((a, b) => {
const nameA = a[0].toUpperCase();
const nameB = b[0].toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
}));
const toc = Object.keys(sortedCategories)
.map(t => `- [${t}](#${data.technologies[t] || t.toLowerCase()})`)
.join('\n');
const content = Object.keys(sortedCategories)
.map(category => {
const repos = sortedCategories[category].map(repo => `- [${repo.name}](${repo.link}) _(label: ${repo.label || 'n/a'})_ <br> ${repo.description}`).join('\n')
return `## ${category}\n\n${repos}\n`
}).join('\n');
const sponsorList = data.sponsors.map(sponsor => `<td align="center"><a href="${sponsor.link}"><img src="${sponsor.image}" width="60px;" alt=""/><br/><sub><b>${sponsor.name}</b></sub></a></td>`)
const sponsorRows = Math.ceil(sponsorList.length / 6);
let sponsors = '';
for (let i = 1; i <= sponsorRows; i++) {
sponsors += '<tr>';
for(let j = 0; j < 6; j++) {
if (sponsorList.length > i*j) {
sponsors += sponsorList[i*j];
} else if (sponsorRows > 1) {
sponsors += '<td></td>'
}
}
sponsors += '</tr>';
}
sponsors = `<table>${sponsors}</table>`
saveFile(TARGET, render(tpl, { toc, content, sponsors }));
function getTemplate(file) {
return fs.readFileSync(file).toString();
}
function saveFile(file, contents) {
return fs.writeFileSync(file, contents);
}
function render(template, variables) {
Object
.entries(variables)
.forEach(([key, value]) => {
template = template.replace(new RegExp(`<% ${key} %>`, 'g'), value);
});
return template;
}

40
.github/scripts/render-readme.py vendored Executable file
View File

@@ -0,0 +1,40 @@
from jinja2 import Environment, FileSystemLoader
import json
DATAFILE = "./data.json"
TEMPLATEPATH = "./.github/"
TEMPLATEFILE = "README-template.j2"
TARGETFILE = "./README.md"
technologies = {}
with open(DATAFILE, 'r') as datafile:
data = json.loads(datafile.read())
for technology in data["technologies"]:
technologies[technology] = {"link_id": data["technologies"][technology], "entries": []}
for repository in data["repositories"]:
repo_technologies = repository["technologies"]
for repo_technology in repo_technologies:
if not technologies.get(repo_technology, False):
technologies[repo_technology] = {"link_id": repo_technology.lower(), "entries": []}
technologies[repo_technology]["entries"].append(repository)
env = Environment(loader = FileSystemLoader(TEMPLATEPATH))
template = env.get_template(TEMPLATEFILE)
categories = []
for key, value in zip(technologies.keys(), technologies.values()):
categories.append({"title": key, "link_id": value["link_id"], "entries": value["entries"]})
categories = sorted(categories, key=lambda x: x["title"].upper())
for category in categories:
category["entries"] = sorted(category["entries"], key=lambda x: x["name"].upper())
sponsors = data["sponsors"]
output = template.render(categories=categories, sponsors=sponsors)
open(TARGETFILE, "w").write(output)

View File

@@ -13,11 +13,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - name: install jinja2
with: run: sudo pip install jinja2
node-version: "16.x"
- name: Build - name: Build
run: node .github/scripts/build.js run: python3 .github/scripts/render-readme.py
- name: Commit - name: Commit
run: | run: |
git config --global user.name 'Shmavon Gazanchyan' git config --global user.name 'Shmavon Gazanchyan'

View File

@@ -350,6 +350,7 @@ If you are not a programmer but would like to contribute, check out the [Awesome
- [Sniffnet](https://github.com/GyulyVGC/sniffnet) _(label: good first issue)_ <br> Application to comfortably monitor network traffic. - [Sniffnet](https://github.com/GyulyVGC/sniffnet) _(label: good first issue)_ <br> Application to comfortably monitor network traffic.
- [TiKV](https://github.com/tikv/tikv) _(label: difficulty/easy)_ <br> A distributed transactional key-value database - [TiKV](https://github.com/tikv/tikv) _(label: difficulty/easy)_ <br> A distributed transactional key-value database
- [Veloren](https://gitlab.com/veloren/veloren/-/issues?label_name[]=beginner) _(label: n/a)_ <br> Veloren is a multiplayer voxel RPG written in Rust. - [Veloren](https://gitlab.com/veloren/veloren/-/issues?label_name[]=beginner) _(label: n/a)_ <br> Veloren is a multiplayer voxel RPG written in Rust.
- [zoom-rs](https://github.com/security-union/zoom-rs) _(label: good first issue)_ <br> Teleconference system with a web based user interface written in Rust
## Scala ## Scala

View File

@@ -1805,6 +1805,15 @@
], ],
"description": "Application to comfortably monitor network traffic." "description": "Application to comfortably monitor network traffic."
}, },
{
"name": "Sugar",
"link": "https://github.com/KilroyWasHere-cs-j/Sugar.git",
"label": "good first issue",
"technologies": [
"Rust"
],
"description": "A barebones web browser written in Rust"
},
{ {
"name": "Twitter Util", "name": "Twitter Util",
"link": "https://github.com/twitter/util", "link": "https://github.com/twitter/util",
@@ -2210,6 +2219,15 @@
"Pug" "Pug"
], ],
"description": "An inventory of tools and resources that aims to help people to find everything related to CyberSecurity." "description": "An inventory of tools and resources that aims to help people to find everything related to CyberSecurity."
} },
{
"name": "zoom-rs",
"link": "https://github.com/security-union/zoom-rs",
"label": "good first issue",
"technologies": [
"Rust"
],
"description": "Teleconference system with a web based user interface written in Rust"
}
] ]
} }