From f6457de2e306fbcd75f32cbd1a468645dcc6f3c7 Mon Sep 17 00:00:00 2001 From: tree Date: Tue, 21 Nov 2023 09:20:41 +0100 Subject: [PATCH] update --- README.md | 2 +- README.tpl.eta | 2 +- events/events.yaml | 2 +- index.js | 25 +++++++++++++++---------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3cf337d..5b2fcc6 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ research and community of [Web3Privacy Now](https://web3privacy.info). | meetup | `por1`* | 2024/May | 🇵🇹 Porto | 3 | [ETHPorto](https://ethporto.org/) | - | | | meetup | `ber1` | 2024/May | 🇩🇪 Berlin | 3 | ETHBerlin 4 | Tree | | | summit | `s3` | 2024/Jun | 🇨🇿 Prague | 16 | ETHPrague 2024 | Tree (+3) | | -| hackathon | `h1` | 2024/Jun | 🇸🇮 Bled | 10 | | Tree (+3) | | +| hackathon | `h1` | **2024-06-19** - 2024-06-26 (7) | 🇸🇮 Bled | 10 | | Tree (+3) | | | meetup | `lju1` | 2024/Jun | 🇸🇮 Ljubljana | 5 | W3PN Hackathon | Tree (+3) | | | meetup | `bcn2`* | 2024/Jul | 🇪🇸 Barcelona | 3 | ETHBarcelona (?) | - | | | meetup | `bru1` | 2024/Jul | 🇧🇪 Brussels | 3 | [EthCC 7](https://www.ethcc.io/) | Mykola (+1) | | diff --git a/README.tpl.eta b/README.tpl.eta index 3501743..09bf33d 100644 --- a/README.tpl.eta +++ b/README.tpl.eta @@ -27,7 +27,7 @@ research and community of [Web3Privacy Now](https://web3privacy.info). | type | # id | date | location | 🎰 | coincidence | dri | links | | --- | --- | --- | --- | --- | --- | --- | --- | <% it.events.forEach(function(event, i){ %> -| <%= event.type %> | `<%= event.id.replace("w3pm-", "").replace(/^w3p/, '') %>`<% if (event.optional) { %>*<% } %> | <%= event.date.match(/^\d{4}-\d{2}-\d{2}$/) ? `**${event.date}**` : event.date %> | <%= it.getFlagEmoji(event.country) %> <%= event.city %> | <%= event.slots || '-' %> | <%= event.coincidence %> | <%= event.lead || "-" %><% if (event.helpers && event.helpers.length > 0) { %> (+<%= event.helpers.length%>)<% } %> | <%= (event.links && Object.keys(event.links).map(k => `[${k}](${event.links[k]})`).join(", ")) || "" %> | +| <%= event.type %> | `<%= event.id.replace("w3pm-", "").replace(/^w3p/, '') %>`<% if (event.optional) { %>*<% } %> | <%= event.date.match(/^\d{4}-\d{2}-\d{2}$/) ? `**${event.date}**` : event.date %><% if (event.days && event.days > 1) { %> - <%= it.dateFns.format(it.dateFns.addDays(new Date(event.date), event.days), 'yyyy-MM-dd') %> (<%= event.days %>)<% } %> | <%= it.getFlagEmoji(event.country) %> <%= event.city %> | <%= event.slots || '-' %> | <%= event.coincidence %> | <%= event.lead || "-" %><% if (event.helpers && event.helpers.length > 0) { %> (+<%= event.helpers.length%>)<% } %> | <%= (event.links && Object.keys(event.links).map(k => `[${k}](${event.links[k]})`).join(", ")) || "" %> | <% }) %> `*` - Optional event (can be cancelled due to lack of interest) diff --git a/events/events.yaml b/events/events.yaml index f0cd751..a08fdfb 100644 --- a/events/events.yaml +++ b/events/events.yaml @@ -135,7 +135,7 @@ - id: w3ph1 type: hackathon - date: "2024/Jun" + date: "2024-06-19" days: 7 city: Bled country: si diff --git a/index.js b/index.js index 655d180..b45dd68 100644 --- a/index.js +++ b/index.js @@ -2,18 +2,19 @@ import Ajv from "npm:ajv@8.8.2"; import addFormats from "npm:ajv-formats@2.1.1"; import { load as yamlLoad } from "https://deno.land/x/js_yaml_port@3.14.0/js-yaml.js"; import { emptyDir } from "https://deno.land/std@0.173.0/fs/mod.ts"; -import { Eta } from "https://deno.land/x/eta@v3.0.3/src/index.ts" +import { Eta } from "https://deno.land/x/eta@v3.0.3/src/index.ts"; +import * as dateFns from "npm:date-fns"; async function _loadYaml(fn) { return yamlLoad(await Deno.readTextFile(fn)); } function getFlagEmoji(countryCode) { - if (countryCode === 'xx') return "🏴‍☠️"; + if (countryCode === "xx") return "🏴‍☠️"; const codePoints = countryCode .toUpperCase() - .split('') - .map(char => 127397 + char.charCodeAt()); + .split("") + .map((char) => 127397 + char.charCodeAt()); return String.fromCodePoint(...codePoints); } @@ -32,10 +33,10 @@ async function test() { throw validator.errors; } if (ids.includes(item.id)) { - throw `ID exists: ${item.id}` + throw `ID exists: ${item.id}`; } - ids.push(item.id) + ids.push(item.id); }); } } @@ -47,17 +48,21 @@ async function build() { await Deno.writeTextFile(fn, JSON.stringify(list, null, 2)); console.log(`File saved: `, fn); - const readmeFn = "./README.md" - const eta = new Eta({ views: "./" }) + const readmeFn = "./README.md"; + const eta = new Eta({ views: "./" }); //console.log(output) const warning = `` +-->`; - await Deno.writeTextFile(readmeFn, warning + "\n\n" + eta.render("./README.tpl.eta", { events: list, getFlagEmoji })) + await Deno.writeTextFile( + readmeFn, + warning + "\n\n" + + eta.render("./README.tpl.eta", { events: list, getFlagEmoji, dateFns }), + ); console.log(`File saved: `, readmeFn); }