Update
This commit is contained in:
rodič
01e8b0dc06
revize
b25a0acff4
|
@ -1,6 +1,8 @@
|
|||
# the name of your event
|
||||
name = "ETHPrague 2023"
|
||||
|
||||
shortname = "ETHPrague"
|
||||
|
||||
# the name of the group organizing the event
|
||||
org = "Paralelní Polis"
|
||||
|
||||
|
@ -8,10 +10,6 @@ org = "Paralelní Polis"
|
|||
# (this person will coordinate with devent organizers)
|
||||
dri = ""
|
||||
|
||||
# the website of the event
|
||||
# make sure to have all the relevant information: dates, venue, program, ticketing (if any), etc.
|
||||
website = "https://ethprague.com/"
|
||||
|
||||
# the start date of the event
|
||||
date = "2023-06-09"
|
||||
|
||||
|
@ -22,7 +20,8 @@ days = 3
|
|||
times = "09:00 - 20:00"
|
||||
|
||||
# the event venue name (will show up on the event card - TODO)
|
||||
venueName = "[Paralelní Polis & La Fabrika](https://goo.gl/maps/rVo6JRN59aodx5Pj7)"
|
||||
venueName = "Paralelní Polis & La Fabrika"
|
||||
venueUrl = "https://goo.gl/maps/rVo6JRN59aodx5Pj7"
|
||||
|
||||
# the event venue address (will show up on a map -- TODO)
|
||||
venueAddress = "Dělnická 475/43, 170 00 Praha 7"
|
||||
|
@ -51,3 +50,11 @@ logomark = "/logomarks/coinfeedslm.png"
|
|||
# will show up when the user clicks the event card.
|
||||
description = """
|
||||
"""
|
||||
|
||||
[links]
|
||||
|
||||
# the website of the event
|
||||
# make sure to have all the relevant information: dates, venue, program, ticketing (if any), etc.
|
||||
web = "https://ethprague.com/"
|
||||
|
||||
|
||||
|
|
|
@ -1 +1,19 @@
|
|||
name = "UTXO.23"
|
||||
name = "UTXO.23"
|
||||
shortname = "UTXO"
|
||||
org = "UTXO Foundation"
|
||||
dri = "burningtree"
|
||||
date = "2023-06-02"
|
||||
days = 3
|
||||
times = "10:00 - 19:00"
|
||||
venueName = "Gabriel Loci"
|
||||
venueUrl = "https://goo.gl/maps/TggARBN8xpoht2uM6"
|
||||
venueAddress = "Holečkova 106/10, 150 00 Praha 5-Smíchov"
|
||||
attendees = "1200"
|
||||
tags = ["Cryptocurrency", "Czech", "Slovak"]
|
||||
|
||||
[links]
|
||||
web = "https://utxo.cz/"
|
||||
docs = "https://docs.utxo.cz/udalosti/23"
|
||||
twitter = "https://twitter.com/utxoprague"
|
||||
telegram = "https://t.me/utxoprague"
|
||||
youtube = "https://www.youtube.com/c/UTXOPrague"
|
|
@ -1,7 +1,8 @@
|
|||
import { emptyDir, exists } from "https://deno.land/std@0.119.0/fs/mod.ts";
|
||||
import { parse as tomlParse } from "https://deno.land/std@0.173.0/encoding/toml.ts";
|
||||
import { load as yamlLoad } from "https://deno.land/x/js_yaml_port@3.14.0/js-yaml.js";
|
||||
|
||||
const _silentMode = false;
|
||||
let _silentMode = false;
|
||||
|
||||
export class DeConfEngine {
|
||||
constructor(options = {}) {
|
||||
|
@ -11,19 +12,25 @@ export class DeConfEngine {
|
|||
this.publicUrl = this.options.publicUrl || "https://data.prgblockweek.com";
|
||||
this.githubUrl = this.options.githubUrl ||
|
||||
"https://github.com/utxo-foundation/prague-blockchain-week/tree/main/data";
|
||||
}
|
||||
async init() {}
|
||||
async build() {
|
||||
await emptyDir(this.outputDir);
|
||||
|
||||
if (options.silentMode) {
|
||||
_silentMode = true;
|
||||
}
|
||||
}
|
||||
async init() {
|
||||
this.entries = [];
|
||||
for await (const f of Deno.readDir(this.srcDir)) {
|
||||
if (!f.name.match(/^\d+$/)) continue;
|
||||
const pkg = new DeConf_Package(f.name, this);
|
||||
await pkg.load([this.srcDir, f.name]);
|
||||
this.entries.push(pkg);
|
||||
}
|
||||
}
|
||||
async build() {
|
||||
await emptyDir(this.outputDir);
|
||||
for (const pkg of this.entries) {
|
||||
console.table(pkg.data.events.map((e) => e.data.index), ["name"]);
|
||||
await pkg.write(this.outputDir);
|
||||
this.entries.push(pkg);
|
||||
}
|
||||
await _jsonWrite(
|
||||
[this.outputDir, "index.json"],
|
||||
|
@ -31,10 +38,33 @@ export class DeConfEngine {
|
|||
id: p.id,
|
||||
name: p.data.index.name,
|
||||
dataUrl: p.data.index.dataUrl,
|
||||
dataGithubUrl: p.data.index.dataGithubUrl,
|
||||
})),
|
||||
);
|
||||
}
|
||||
async schemas(version = "1") {
|
||||
const schemaDir = `./utils/schema/${version}`;
|
||||
const arr = [];
|
||||
for await (const f of Deno.readDir(schemaDir)) {
|
||||
const m = f.name.match(/^(.+)\.yaml$/);
|
||||
if (!m) {
|
||||
continue;
|
||||
}
|
||||
arr.push({
|
||||
name: m[1],
|
||||
schema: Object.assign(
|
||||
{ $id: this.schemaUrl(version, m[1]) },
|
||||
await _yamlLoad([schemaDir, f.name].join("/")),
|
||||
),
|
||||
});
|
||||
}
|
||||
return arr.sort((x, y) => x.name > y.name ? 1 : -1);
|
||||
}
|
||||
schemaUrl(version = "1", type = "index") {
|
||||
return `${this.publicUrl}/schema/${version}/${type}.json`;
|
||||
}
|
||||
entriesList() {
|
||||
return this.entries.map((e) => e.id);
|
||||
}
|
||||
}
|
||||
|
||||
class DeConf_Package {
|
||||
|
@ -50,7 +80,7 @@ class DeConf_Package {
|
|||
pkg.index = await _tomlLoad([...specDir, "index.toml"].join("/"));
|
||||
pkg.index.dataUrl = [this.engine.publicUrl, this.id].join("/");
|
||||
pkg.index.dataGithubUrl = [this.engine.githubUrl, this.id].join("/");
|
||||
console.log(`\n##\n## [${pkg.index.name}] \n##`);
|
||||
//console.log(`\n##\n## [${pkg.index.name}] \n##`);
|
||||
// load sub-events
|
||||
pkg.events = [];
|
||||
for await (const ef of Deno.readDir([...specDir, "events"].join("/"))) {
|
||||
|
@ -83,7 +113,7 @@ class DeConf_Event {
|
|||
async load(dir) {
|
||||
const efIndex = await _tomlLoad([...dir, "index.toml"].join("/"));
|
||||
const event = {
|
||||
index: efIndex,
|
||||
index: { id: this.id, ...efIndex },
|
||||
};
|
||||
this.data = event;
|
||||
}
|
||||
|
@ -96,6 +126,9 @@ class DeConf_Event {
|
|||
async function _tomlLoad(fn) {
|
||||
return tomlParse(await Deno.readTextFile(fn));
|
||||
}
|
||||
async function _yamlLoad(fn) {
|
||||
return yamlLoad(await Deno.readTextFile(fn));
|
||||
}
|
||||
async function _jsonWrite(fn, data) {
|
||||
if (Array.isArray(fn)) {
|
||||
fn = fn.join("/");
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
type: object
|
||||
title: Událost
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
title: Event ID
|
||||
name:
|
||||
type: string
|
||||
title: Name of event
|
||||
shortname:
|
||||
type: string
|
||||
title: Short name of event
|
||||
org:
|
||||
type: string
|
||||
title: Organizator of event
|
||||
dri:
|
||||
type: string
|
||||
title: Directly responsible individual (Github username)
|
||||
date:
|
||||
type: string
|
||||
pattern: "^\\d{4}-\\d{2}-\\d{2}$"
|
||||
title: Start date of event
|
||||
days:
|
||||
type: number
|
||||
title: Days the event lasts
|
||||
times:
|
||||
type: string
|
||||
title: Event times
|
||||
venueName:
|
||||
type: string
|
||||
title: Venue name
|
||||
venueAddress:
|
||||
type: string
|
||||
title: Venue address
|
||||
venueUrl:
|
||||
type: string
|
||||
title: Venue map URL
|
||||
attendees:
|
||||
type: string
|
||||
title: Max number of attendees
|
||||
difficulty:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
logomark:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
links:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
format: uri
|
|
@ -0,0 +1,3 @@
|
|||
type: array
|
||||
items:
|
||||
$ref: https://data.prgblockweek.com/schema/1/event.json
|
|
@ -0,0 +1,46 @@
|
|||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
pattern: ^[a-z0-9]+$
|
||||
name:
|
||||
type: string
|
||||
shortname:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
dates:
|
||||
type: array
|
||||
minItems: 1
|
||||
items:
|
||||
type: string
|
||||
pattern: "^\\d{4}-\\d{2}-\\d{2}$"
|
||||
scheduleTimes:
|
||||
type: array
|
||||
place:
|
||||
type: string
|
||||
country:
|
||||
type: string
|
||||
links:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
format: uri
|
||||
specDef:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
pattern: "[a-z]+"
|
||||
schemaVersion:
|
||||
type: number
|
||||
dataUrl:
|
||||
type: string
|
||||
format: uri
|
||||
dataGithubUrl:
|
||||
type: string
|
||||
format: uri
|
|
@ -0,0 +1,92 @@
|
|||
type: object
|
||||
title: Událost
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- type
|
||||
- name
|
||||
- duration
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
title: ID události
|
||||
name:
|
||||
type: string
|
||||
title: Název události
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- workshop
|
||||
- talk
|
||||
- panel
|
||||
- lightning-series
|
||||
- lightning
|
||||
- campfire
|
||||
- other
|
||||
title: Typ události
|
||||
track:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
title: Programové sekce
|
||||
speakers:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
title: Přednášející
|
||||
duration:
|
||||
type: number
|
||||
title: Doba trvání
|
||||
description:
|
||||
type: string
|
||||
title: Popis události
|
||||
after:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
rightAfter:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
properties:
|
||||
type: object
|
||||
parent:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
title: Nadřazená událost
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
difficulty:
|
||||
type: string
|
||||
enum:
|
||||
- beginner
|
||||
- advanced
|
||||
- expert
|
||||
fixed:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
time:
|
||||
type: string
|
||||
stage:
|
||||
type: string
|
||||
stages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
date:
|
||||
type: string
|
||||
video:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
youtube:
|
||||
type: string
|
||||
|
||||
popularity:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 1
|
|
@ -0,0 +1,3 @@
|
|||
type: array
|
||||
items:
|
||||
$ref: https://data.prgblockweek.com/schema/1/subevent.json
|
|
@ -0,0 +1,50 @@
|
|||
import { assertEquals } from "https://deno.land/std@0.119.0/testing/asserts.ts";
|
||||
import { DeConfEngine } from "./engine.js";
|
||||
|
||||
// initialize ajv JSON Schema validator
|
||||
import Ajv from "https://esm.sh/ajv@8.8.1?pin=v58";
|
||||
import addFormats from "https://esm.sh/ajv-formats@2.1.1";
|
||||
|
||||
const ajv = new Ajv();
|
||||
addFormats(ajv);
|
||||
|
||||
const dc = new DeConfEngine({ silent: true });
|
||||
await dc.init();
|
||||
const schemas = await dc.schemas();
|
||||
|
||||
const validators = {};
|
||||
for (const item of schemas) {
|
||||
validators[item.name] = ajv.compile(item.schema);
|
||||
}
|
||||
|
||||
for (const entry of dc.entries) {
|
||||
// check index
|
||||
const entryInfo = `entry=${entry.id}`;
|
||||
Deno.test(`[${entryInfo}] index`, () => {
|
||||
if (!validators.index(entry.data.index)) {
|
||||
throw validators.index.errors;
|
||||
}
|
||||
});
|
||||
|
||||
// check events
|
||||
for (const event of entry.data.events) {
|
||||
Deno.test(`[${entryInfo} event=${event.id}] index`, () => {
|
||||
// check event index
|
||||
if (!validators.event(event.data.index)) {
|
||||
throw validators.event.errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// check specific specs
|
||||
/*for (const specId of Object.keys(entry.specs)) {
|
||||
Deno.test(`UTXO.${entryId}: ${specId}[schema]`, () => {
|
||||
if (!validators[specId]) {
|
||||
return null;
|
||||
}
|
||||
if (!validators[specId](entry.specs[specId])) {
|
||||
throw validators[specId].errors;
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
Načítá se…
Odkázat v novém úkolu