This commit is contained in:
tree 2022-01-27 08:56:34 +01:00
rodič 499a567083
revize ec9b658482
6 změnil soubory, kde provedl 199 přidání a 4 odebrání

Zobrazit soubor

@ -14,6 +14,8 @@ link-check:
format:
deno fmt utils/*.js README.md
fmt: format
build:
deno run --unstable --allow-read --allow-write utils/build.js
@ -47,5 +49,8 @@ twitter:
twitter-photos:
deno run --unstable --allow-read --allow-write --allow-env --allow-net utils/twitter.js photos
events:
deno run --unstable --allow-read utils/events.js
server:
cd dist && python -m SimpleHTTPServer 8000

Zobrazit soubor

@ -9,7 +9,8 @@
> Otevřená komunitní kryptoměnová konference
[![Test, build, deploy](https://github.com/gweicz/utxo/actions/workflows/deploy.yml/badge.svg)](https://github.com/gweicz/utxo/actions/workflows/deploy.yml) [![Link checker](https://github.com/gweicz/utxo/actions/workflows/link-check.yml/badge.svg)](https://github.com/gweicz/utxo/actions/workflows/link-check.yml)
[![Test, build, deploy](https://github.com/gweicz/utxo/actions/workflows/deploy.yml/badge.svg)](https://github.com/gweicz/utxo/actions/workflows/deploy.yml)
[![Link checker](https://github.com/gweicz/utxo/actions/workflows/link-check.yml/badge.svg)](https://github.com/gweicz/utxo/actions/workflows/link-check.yml)
Tento repozitář obsahuje základní specifikace (datové zdroje) všech ročníků
konference.

Zobrazit soubor

@ -1 +1,82 @@
[]
# Example
# ====================
# - id: example-talk
# type: talk
# name: Example talk
# track: example-track
# duration: 25
# speakers:
# - example-speaker
# description: |
# This is a example talk
#
# Talks (přednášky)
# ====================
- id: historie-cypherpunku
type: talk
name: Historie Cypherpunku
track: spolecnost
speakers:
- matthew-cook
duration: 55
description: |
Přednáška od autora článku [Historie Cypherpunku](https://www.alza.cz/historie-cypherpunku)
- id: fire-movement
type: talk
name: FIRE movement (Financial Independence, Retire Early)
track: spolecnost
speakers:
- tomas-kryptovlada
duration: 25
description: |
https://en.wikipedia.org/wiki/FIRE_movement
- id: l2-zaklady
type: talk
name: Layer2s - úvod do druhýh vrstev a proč je potřebujeme
track: zaklady
duration: 55
speakers:
- damsky
- id: prace-zivobyti-v-kryptomenach
type: talk
name: Práce a možnosti živobytí v kryptoměnách
track: zaklady
duration: 25
speakers:
- damsky
# Workshops (workshopy)
# =======================
- id: privacy-workshop
type: workshop
name: Privacy workshop
track: zaklady
speakers:
- petr-klein
duration: 50
description: |
> privacy, Tails OS, Qubes OS, nejaky zaklady, jak se anonymizovat apod. ale musi to trochu dozrat 👍
- id: l2-bridge-rampy-prakticky
type: workshop
name: Layer2s - bridge a fiat rampy prakticky
track: eth
speakers:
- damsky
duration: 55
description: |
Jak se dostat na druhou vrstvu pomocí bridgů nebo fiat on-ramps
- id: defi-pro-zacatecniky
type: workshop
name: DeFi pro začátečníky
track: defi
speakers:
- jiri-cepelka
duration: 55

32
utils/events.js Normal file
Zobrazit soubor

@ -0,0 +1,32 @@
import { Table } from "https://deno.land/x/cliffy@v0.20.1/table/mod.ts";
import { UTXOEngine } from "./engine.js";
const utxo = new UTXOEngine({ silent: true });
await utxo.init();
const entryId = "22";
const entry = utxo.entries[entryId];
const setup = [
{ col: "type", title: "Type" },
{ col: "id", title: "ID" },
{ col: "track", title: "Track" },
{ col: "name", title: "Name" },
{ col: "duration", title: "Len" },
{
col: "speakers",
title: "Speakers", //process: (e) => e.speakers.map((s) => entry.specs.speakers.find((sp) => sp.id === s).name).join(", ")
},
];
const arr = [setup.map((s) => s.title)];
//const types = [...new Set(entry.specs.events.map(e => e.type))]
for (const item of entry.specs.events) {
const out = [];
for (const sc of setup) {
out.push(sc.process ? sc.process(item) : item[sc.col]);
}
arr.push(out);
}
console.log(Table.from(arr).border(true).toString());

35
utils/schema/events.yaml Normal file
Zobrazit soubor

@ -0,0 +1,35 @@
type: array
items:
type: object
additionalProperties: false
required:
- id
- type
- name
- duration
properties:
id:
type: string
pattern: "^[a-z0-9-]+$"
type:
type: string
enum:
- workshop
- talk
- panel
- lightning
- other
track:
type: string
pattern: "^[a-z0-9-]+$"
name:
type: string
speakers:
type: array
items:
type: string
pattern: "^[a-z0-9-]+$"
duration:
type: number
description:
type: string

Zobrazit soubor

@ -22,7 +22,7 @@ for (const entryId of utxo.entriesList()) {
const entry = utxo.entries[entryId];
// check index
Deno.test(`UTXO.${entryId}: index.yaml`, () => {
Deno.test(`UTXO.${entryId}: index[schema]`, () => {
if (!validators.index(entry.index)) {
throw validators.index.errors;
}
@ -30,7 +30,7 @@ for (const entryId of utxo.entriesList()) {
// check specific specs
for (const specId of Object.keys(entry.specs)) {
Deno.test(`UTXO.${entryId}: ${specId}`, () => {
Deno.test(`UTXO.${entryId}: ${specId}[schema]`, () => {
if (!validators[specId]) {
return null;
}
@ -39,6 +39,19 @@ for (const entryId of utxo.entriesList()) {
}
});
Deno.test(`UTXO.${entryId}: ${specId}[id-duplicates]`, () => {
const used = [];
for (const item of entry.specs[specId]) {
if (!item.id) {
return null;
}
if (used.includes(item.id)) {
throw `Duplicate key: ${item.id}`;
}
used.push(item.id);
}
});
if (["speakers", "projects"].includes(specId)) {
Deno.test(`UTXO.${entryId}: ${specId}[tracks-links]`, () => {
const tracks = entry.specs.tracks.map((t) => t.id);
@ -54,5 +67,33 @@ for (const entryId of utxo.entriesList()) {
}
});
}
if (["events"].includes(specId)) {
Deno.test(`UTXO.${entryId}: ${specId}[speakers-links]`, () => {
const speakers = entry.specs.speakers.map((t) => t.id);
for (const item of entry.specs[specId]) {
if (!item.speakers || item.speakers.length === 0) {
continue;
}
for (const t of item.speakers) {
if (!speakers.includes(t)) {
throw new Error(`Speaker not exists: ${t}`);
}
}
}
});
}
if (["events"].includes(specId)) {
Deno.test(`UTXO.${entryId}: ${specId}[speakers-tracks]`, () => {
const tracks = entry.specs.tracks.map((t) => t.id);
for (const item of entry.specs[specId]) {
if (!item.track) {
continue;
}
if (!tracks.includes(item.track)) {
throw new Error(`Track not exists: ${item.track}`);
}
}
});
}
}
}