This commit is contained in:
tree🌴 2023-11-28 03:05:02 +01:00
parent 276246b031
commit be3825b5a1
9 changed files with 462 additions and 0 deletions

47
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Build and Deploy
on:
push:
branches:
- main # Set a branch to deploy
pull_request:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Prague"
- name: Cache
run: make cache
- name: Test
run: make test
- name: Build bundle
run: make build
#- name: Add custom domain
# run: "touch dist/CNAME && echo \"data.web3privacy.info\" >> dist/CNAME"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist

13
Makefile Normal file
View file

@ -0,0 +1,13 @@
all: build
cache:
deno cache utils/build.js
build:
deno run --allow-all utils/build.js
test:
deno test --allow-all utils/test.js
fmt:
deno fmt utils/*.js

257
data/events.yaml Normal file
View file

@ -0,0 +1,257 @@
- id: w3ps1
type: summit
date: "2023-06-05"
city: Prague
country: cz
place: "[X10](https://www.divadlox10.cz/)"
confirmed: true
coincidence: "[ETHPrague](https://ethprague.com/)"
lead: Tree
slots: 16
visitors: 180
links:
web: https://prague.web3privacy.info/
git: https://github.com/web3privacy/w3ps1
- id: w3ps2
type: summit
date: "2023-10-05"
city: Rome
country: it
place: "[Villaggio Globale](https://maps.app.goo.gl/S7kUruNvbpjgHuSh9)"
confirmed: true
coincidence: "[ETHRome](https://ethrome.org/)"
lead: PG
slots: 10
visitors: 139
links:
web: https://lu.ma/web3privacynow_rome
- id: w3pm-prg1
type: meetup
date: "2023-11-14"
city: Prague
country: cz
place: "[Dílna](https://kafevdilne.cz/)"
confirmed: true
coincidence: "[DCxPrague](https://dcxprague.org/)"
lead: Tree
slots: 3
visitors: 15
links:
web: https://lu.ma/w3pm-prg1
- id: w3pm-bcn1
type: meetup
date: "2024/Q1"
city: Barcelona
country: es
coincidence: ""
lead: Tree
helpers:
- Mykola
optional: true
slots: 3
- id: w3pm-itxx
type: meetup
date: "2024/Q1"
city: Italy (TBD)
country: it
coincidence: ""
lead: PG
optional: true
slots: 3
- id: w3pm-lib1
type: meetup
date: "2024/Mar"
city: Liberec
country: cz
coincidence: "[ETHBohemia](https://ethbohemia.ethevents.club/)"
lead: Tree
optional: true
slots: 3
- id: w3pm-buc1
type: meetup
date: "2024-03-28"
city: Bucharest
country: ro
# ETHBucharest 2024 - March 28-30 2024
coincidence: "[ETHBucharest](https://www.ethbucharest.xyz/)"
optional: true
slots: 3
lead: Tree
helpers:
- Alina
links:
rsvp: https://lu.ma/w3pn-meetup-bucharest1
- id: w3pm-ams1
type: meetup
date: "2024-04-11"
city: Amsterdam
country: nl
lead: PG
helpers:
- Mykola
- Tree
- Alina
# ETHDam 2024 - April 12-14 2024
coincidence: "[ETHDam](https://www.ethdam.com/)"
slots: 3
links:
rsvp: https://lu.ma/w3pn-meetup-ams1
- id: w3pm-tal1
type: meetup
date: "2024/Apr"
city: Tallinn
country: ee
# ETHTallinn - April 19 - 21, 2024
coincidence: "[ETHTallinn](https://www.ethtallinn.org/)"
slots: 3
optional: true
- id: w3pm-por1
type: meetup
date: "2024/May"
city: Porto
country: pt
coincidence: "[ETHPorto](https://ethporto.org/)"
slots: 3
optional: true
- id: w3pm-ber1
type: meetup
date: "2024-05-25"
city: Berlin
country: de
# ETHBerlin 4 - May 24-26, 2024
coincidence: "ETHBerlin"
lead: Tree
slots: 3
links:
rsvp: https://lu.ma/w3pn-meetup-berlin1
- id: w3ps3
type: summit
date: "2024-06-04"
city: Prague
country: cz
coincidence: "ETHPrague"
lead: Tree
helpers:
- PG
- Mykola
- Coinmandeer
slots: 16
links:
rsvp: https://lu.ma/w3pn-summit-prague2
- id: w3ph1
type: hackathon
date: "2024-06-19"
days: 7
city: Bled
country: si
place: "[Subwork](https://subwork.xyz/)"
confirmed: true
coincidence: "W3PN Hackathon"
lead: Tree
helpers:
- PG
- Mykola
- Coinmandeer
slots: 10
links:
rsvp: https://lu.ma/w3pn-bled-hackathon1
- id: w3pm-lju1
type: meetup
date: "2024-06-21"
city: Ljubljana
country: si
coincidence: "W3PN Hackathon"
lead: Tree
helpers:
- PG
- Mykola
- Coinmandeer
slots: 5
links:
rsvp: https://lu.ma/w3pn-meetup-ljubljana1
- id: w3pm-bcn2
type: meetup
date: "2024/Jul"
city: Barcelona
country: es
coincidence: "ETHBarcelona"
slots: 3
optional: true
- id: w3pm-bru1
type: meetup
date: "2024-07-12"
city: Brussels
country: be
# EthCC 7 - July 8-11, 2024
coincidence: "[EthCC](https://www.ethcc.io/)"
slots: 3
lead: Mykola
helpers:
- Tree
links:
rsvp: https://lu.ma/w3pn-meetup-bru1
- id: w3pm-waw1
type: meetup
date: "2024/Sep"
city: Warsaw
country: pl
coincidence: "ETHWarsaw"
lead: Tree
slots: 3
optional: true
- id: w3pm-rom2
type: meetup
date: "2024-10-04"
city: Rome
country: it
coincidence: "ETHRome"
lead: PG
slots: 5
helpers:
- Mykola
- Alina
links:
rsvp: https://lu.ma/w3pn-meetup-rome1
- id: w3ps4
type: summit
date: "2024-10-24"
city: Brno
country: cz
coincidence: "ETHBrno"
lead: Tree
helpers:
- PG
- Mykola
- Coinmandeer
slots: 16
links:
rsvp: https://lu.ma/w3pn-summit-brno1
- id: w3pm-dc1
type: meetup
date: "2024-11-20"
city: SE Asia
country: xx
# Devcon 7 - probably November (?)
coincidence: "[Devcon](https://devcon.org/)"
slots: 5
links:
rsvp: https://lu.ma/w3pn-meetup-devcon7

6
data/index.yaml Normal file
View file

@ -0,0 +1,6 @@
name: Web3Privacy Now
core-team:
- name: Tree
- name: Mykola
- name: PG
- name: Coinmandeer

55
schema/events.yaml Normal file
View file

@ -0,0 +1,55 @@
$defs:
event:
type: object
additionalProperties: false
required:
- id
- date
- city
- country
properties:
id:
type: string
type:
type: string
enum:
- summit
- meetup
- hackathon
confirmed:
type: boolean
date:
type: string
days:
type: number
city:
type: string
country:
type: string
pattern: "^\\w{2}$"
place:
type: string
coincidence:
type: string
lead:
type: string
helpers:
type: array
items:
type: string
slots:
type: number
visitors:
type: number
optional:
type: boolean
links:
type: object
additionalProperties: false
patternProperties:
"^[\\w]+":
type: string
format: uri
type: array
items:
$ref: "#/$defs/event"

1
schema/index.yaml Normal file
View file

@ -0,0 +1 @@
type: object

6
utils/build.js Normal file
View file

@ -0,0 +1,6 @@
import { Engine } from "./engine.js";
const engine = new Engine();
await engine.init();
await engine.build();

52
utils/engine.js Normal file
View file

@ -0,0 +1,52 @@
import { join } from "https://deno.land/std@0.208.0/path/mod.ts";
import { emptyDir } from "https://deno.land/std@0.196.0/fs/empty_dir.ts";
import { parse, stringify } from "npm:yaml";
const SRC_DIR = "./data";
const DEST_DIR = "./dist";
const SCHEMA_DIR = "./schema";
export class Engine {
constructor() {
this.index = {};
this.db = {};
this.schemas = {};
}
async init() {
// load schemas
for await (const dirEntry of Deno.readDir(SCHEMA_DIR)) {
const [fn, _] = dirEntry.name.split(".");
this.schemas[fn] = await readYamlFile(join(SCHEMA_DIR, dirEntry.name));
}
// load data
this.index = await readYamlFile(join(SRC_DIR, "index.yaml"));
for await (const dirEntry of Deno.readDir(SRC_DIR)) {
const [fn, ext] = dirEntry.name.split(".");
if (ext === "yaml" && fn !== "index") {
this.db[fn] = await readYamlFile(join(SRC_DIR, dirEntry.name));
}
}
}
async build() {
await emptyDir(DEST_DIR);
await writeJSONFile(join(DEST_DIR, "index.json"), this.index);
await writeJSONFile(
join(DEST_DIR, "bundle.json"),
Object.assign({}, this.index, this.db),
);
for (const col of Object.keys(this.db)) {
await writeJSONFile(join(DEST_DIR, `${col}.json`), this.db[col]);
}
}
}
async function readYamlFile(fn) {
return parse(await Deno.readTextFile(fn));
}
async function writeJSONFile(fn, data) {
console.log(`File written: ${fn}`);
return Deno.writeTextFile(fn, JSON.stringify(data, null, 2));
}

25
utils/test.js Normal file
View file

@ -0,0 +1,25 @@
import Ajv from "npm:ajv@8.8.2";
import addFormats from "npm:ajv-formats@2.1.1";
import { Engine } from "./engine.js";
const engine = new Engine();
await engine.init();
const ajv = new Ajv({ strict: false });
addFormats(ajv);
function checkCollection (name, schema, data) {
Deno.test(name, () => {
const validator = ajv.compile(schema);
if (!validator(data)) {
throw validator.errors;
}
})
}
// check index
checkCollection("index", engine.schemas.index, engine.index)
for (const col of Object.keys(engine.db)) {
checkCollection(`collection: ${col}`, engine.schemas[col], engine.db[col])
}