put all events into one source file

This commit is contained in:
tree🌴 2023-11-05 21:36:11 +01:00
parent 643be5020e
commit 390768c477
5 changed files with 33 additions and 25 deletions

View file

@ -27,7 +27,7 @@ research and community of [Web3Privacy Now](https://web3privacy.info).
| # id | date | location | 👥 | coincidence | dri | links |
| --- | --- | --- | --- | --- | --- | --- |
<% it.events.summits.forEach(function(event, i){ %>
<% it.events.filter(e => e.type === 'summit').forEach(function(event, i){ %>
| #<%= i+1%> → `<%= event.id %>` | <%= event.date.match(/^\d{4}-\d{2}-\d{2}$/) ? `**${event.date}**` : event.date %> | <%= it.getFlagEmoji(event.country) %> <%= event.city %> | <%= event.visitors || '-' %> | <%= event.coincidence %> | <%= event.lead || "-" %> | <%= (event.links && Object.keys(event.links).map(k => `[${k}](${event.links[k]})`).join(", ")) || "" %> |
<% }) %>
@ -35,7 +35,7 @@ research and community of [Web3Privacy Now](https://web3privacy.info).
| # id | date | location | 👥 | coincidence | dri | links |
| --- | --- | --- | --- | --- | --- | --- |
<% it.events.meetups.forEach(function(event, i){ %>
<% it.events.filter(e => e.type === 'meetup').forEach(function(event, i){ %>
| <% if (event.links?.git) { %>[`<%= event.id %>`](<%= event.links.git %>)<% } else { %>`<%= event.id.replace('w3pm-','') %>`<% } %> | <%= event.date.match(/^\d{4}-\d{2}-\d{2}$/) ? `**${event.date}**` : event.date %> | <%= it.getFlagEmoji(event.country) %> <%= event.city %> | <%= event.visitors || '-' %> | <%= event.coincidence %> | <%= event.lead || "-" %> | <%= (event.links && Object.keys(event.links).map(k => `[${k}](${event.links[k]})`).join(", ")) || "" %> |
<% }) %>

View file

@ -1,4 +1,17 @@
- id: w3ps1
type: summit
date: "2023-06-05"
city: Prague
country: cz
coincidence: "[PBW](https://prgblockweek.com/) w/ [ETHPrague](https://ethprague.com/)"
lead: Tree
visitors: 180
links:
web: https://prague.web3privacy.info/
git: https://github.com/web3privacy/w3ps1
- id: w3pm-rom-1
type: meetup
date: "2023-10-05"
city: Rome
country: it
@ -9,6 +22,7 @@
web: https://lu.ma/web3privacynow_rome
- id: w3pm-prg-1
type: meetup
date: "2023-11-14"
city: Prague
country: cz
@ -18,12 +32,14 @@
web: https://lu.ma/w3pm-prg1
- id: w3pm-ist-1
type: meetup
date: "2023/Nov"
city: Istanbul
country: tr
coincidence: "[Devconnect Istanbul](https://devconnect.org/)"
- id: w3pm-ams-1
type: meetup
date: "2024/May"
city: Amsterdam
country: nl
@ -31,6 +47,7 @@
coincidence: "[ETHDam 2024](https://www.ethdam.com/)"
- id: w3pm-ber-1
type: meetup
date: "2024/May"
city: Berlin
country: de

View file

@ -1,10 +0,0 @@
- id: w3ps1
date: "2023-06-05"
city: Prague
country: cz
coincidence: "[PBW](https://prgblockweek.com/) w/ [ETHPrague](https://ethprague.com/)"
lead: Tree
visitors: 180
links:
web: https://prague.web3privacy.info/
git: https://github.com/web3privacy/w3ps1

View file

@ -24,10 +24,11 @@ async function test() {
const schema = await _loadYaml("./schema.yaml");
const validator = ajv.compile(schema);
for (const type of types) {
Deno.test(`Check schema: ${type}`, async () => {
const list = await _loadYaml(`./events/${type}.yaml`);
if (!validator(list)) {
const list = await _loadYaml(`./events/events.yaml`);
for (const item of list) {
Deno.test(`${item.id}`, async () => {
if (!validator(item)) {
throw validator.errors;
}
});
@ -35,14 +36,10 @@ async function test() {
}
async function build() {
const output = {};
for (const type of types) {
const list = await _loadYaml(`./events/${type}.yaml`);
output[type] = list;
}
const list = await _loadYaml(`./events/events.yaml`);
await emptyDir("./dist");
const fn = "./dist/index.json";
await Deno.writeTextFile(fn, JSON.stringify(output, null, 2));
await Deno.writeTextFile(fn, JSON.stringify(list, null, 2));
console.log(`File saved: `, fn);
const readmeFn = "./README.md"
@ -55,7 +52,7 @@ EDIT "./README.tpl.eta" INSTEAD
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-->`
await Deno.writeTextFile(readmeFn, warning + "\n\n" + eta.render("./README.tpl.eta", { events: output, getFlagEmoji }))
await Deno.writeTextFile(readmeFn, warning + "\n\n" + eta.render("./README.tpl.eta", { events: list, getFlagEmoji }))
console.log(`File saved: `, readmeFn);
}

View file

@ -1,5 +1,4 @@
type: array
items: { "$ref": "#/$defs/event" }
$ref: "#/$defs/event"
$defs:
event:
type: object
@ -12,6 +11,11 @@ $defs:
properties:
id:
type: string
type:
type: string
enum:
- summit
- meetup
date:
type: string
city: