diff --git a/Makefile b/Makefile index bee2cda..ef82847 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,7 @@ format: fmt: format build: - deno run --unstable --allow-read --allow-write utils/exec.js build \ No newline at end of file + deno run --unstable --allow-read --allow-write utils/exec.js build + +event-sync: + deno run --unstable --allow-read --allow-write --allow-net utils/eventSync.js diff --git a/data/23/events/utxo/_sync.js b/data/23/events/utxo/_sync.js new file mode 100644 index 0000000..3c7012e --- /dev/null +++ b/data/23/events/utxo/_sync.js @@ -0,0 +1,7 @@ +export async function data($) { + const bundle = await $.loadJSONUrl("https://spec.utxo.cz/23/bundle.json"); + return { + speakers: bundle.spec.speakers, + tracks: bundle.spec.tracks, + }; +} diff --git a/data/23/events/utxo/data.json b/data/23/events/utxo/data.json new file mode 100644 index 0000000..3601fdd --- /dev/null +++ b/data/23/events/utxo/data.json @@ -0,0 +1,110 @@ +{ + "speakers": [ + { + "id": "petr-lukac", + "name": "Petr Lukáč", + "twitter": "RuzovejSlon", + "bio": "Novinář, podcaster", + "orgs": "Podcast [Krypto Space](https://www.kryptospace.cz/)\n", + "tracks": [ + "spolecnost" + ], + "country": "cz", + "photos": [ + "web:png", + "twitter:jpg" + ] + }, + { + "id": "tereza-starostova", + "name": "Tereza Starostová", + "twitter": "terkastarostova", + "orgs": "Spoluzakladatelka [Holky v Kryptu](https://holkyvkryptu.cz/), předsedkyně [UTXO Foundation](httsp://utxo.foundation)\n", + "tracks": [ + "zaklady", + "spolecnost" + ], + "country": "cz", + "photos": [ + "twitter:jpg" + ] + }, + { + "id": "tree", + "name": "tree", + "twitter": "treecz", + "bio": "Libertarián, propagátor Web3 a DAOs", + "orgs": "Zakladatel [Gwei.cz](https://gwei.cz). Organizátor [ETHBrno](https://ethbrno.cz/), [UTXO.23](https://utxo.cz) a dalších akcí\n", + "country": "cz", + "tracks": [ + "eth", + "defi", + "dao" + ], + "desc": "Founder of @gweicz | 🦄 #Ethereum #DeFi #DAO enthusiast 🦇🔊 | ✈️ #travel maniac | ⚡ riding #electricunicycle | 🇨🇿🇬🇧 lang | 🟡⚫ | 🇺🇦 Слава Україні!\n", + "photos": [ + "twitter:jpg" + ] + } + ], + "tracks": [ + { + "id": "zaklady", + "name": "Základy kryptoměn", + "shortname": "Základy", + "examples": "* principy otevřených projektů (blockchainů)\n* základy bezpečnosti a soukromí\n* peněženky - SW, HW\n* základy obchodování - DCA\n" + }, + { + "id": "btc", + "name": "Bitcoin", + "examples": "* Bitcoin jako peníze\n* Lightning Network - adopce, implementace\n* Taproot\n* Bitcoin mining\n* smart-kontrakty na bitcoinu (RGB)\n" + }, + { + "id": "eth", + "name": "Ethereum a smart-kontrakty obecně", + "shortname": "Ethereum", + "examples": "* Ethereum 2.0\n* Layer2 - rollupy\n* (EVM) Sidechainy\n* vývoj smart-kontraktů (solidity)\n* MEV - Miner Extractable Value\n" + }, + { + "id": "defi", + "name": "Decentralizované finance (DeFi)", + "shortname": "DeFi", + "examples": "* stablecoiny\n* lending protokoly\n* DEX - decentralizované burzy\n* predikční trhy\n* futures/options kontrakty\n* tokenizace\n" + }, + { + "id": "dao", + "name": "Decentralizované organizace (DAO)", + "shortname": "DAOs", + "examples": "* budoucnost organizací\n* showcase jednotlivých DAOs\n" + }, + { + "id": "nft", + "name": "NFTs a Metaverse", + "shortname": "NFTs/Metaverse", + "examples": "* NFT umění\n* NFT collectibles\n* gaming\n* Metaverse\n" + }, + { + "id": "alty", + "name": "Experimentální L1 blockchainy a další altcoiny", + "shortname": "Alternativní L1", + "examples": "* Polkadot\n* Cardano\n* Cosmos (Secret Network..)\n* Solana\n* NEAR\n* Monero\n* ...\n" + }, + { + "id": "regulace", + "name": "Regulace a fiat rampy", + "shortname": "Regulace", + "examples": "* legislativa\n* směnárny a burzy\n* darování kryptoměn\n* insitucionální peníze v kryptoměnách\n" + }, + { + "id": "spolecnost", + "name": "Krypto-společnost", + "shortname": "Společnost", + "examples": "* odluka peněz od státu\n* kryptoanarchismus, anarchokapitalismus, meritokracie\n* představení lokálních krypto-komunit\n* fenomén maximalismu\n" + }, + { + "id": "other", + "name": "Ostatní", + "hidden": true + } + ] +} diff --git a/utils/engine.js b/utils/engine.js index 4410452..4c84bc7 100644 --- a/utils/engine.js +++ b/utils/engine.js @@ -1,6 +1,7 @@ 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"; +import * as syncTools from "./syncTools.js"; let _silentMode = false; @@ -13,7 +14,7 @@ export class DeConfEngine { this.githubUrl = this.options.githubUrl || "https://github.com/utxo-foundation/prague-blockchain-week/tree/main/data"; - if (options.silentMode) { + if (options.silent) { _silentMode = true; } } @@ -108,18 +109,36 @@ class DeConf_Event { constructor(id) { this.id = id; this.data = null; + this.dir = null; } async load(dir) { + this.dir = dir.join("/"); const efIndex = await _tomlLoad([...dir, "index.toml"].join("/")); - const event = { + const data = { index: { id: this.id, ...efIndex }, }; - this.data = event; + const syncDataFn = [...dir, "data.json"].join("/"); + if (await exists(syncDataFn)) { + data.sync = await _jsonLoad(syncDataFn); + } + this.data = data; + } + + async sync() { + const syncFile = [this.dir, "_sync.js"].join("/"); + if (!await exists(syncFile)) return null; + if (!_silentMode) console.log(`syncing ${this.id} ..`); + const module = await import("../" + syncFile); + // data + if (module.data) { + const data = await module.data(syncTools); + await _jsonWrite([this.dir, "data.json"].join("/"), data); + } } toJSON() { - return Object.assign({ id: this.id }, this.data.index); + return Object.assign({ id: this.id }, this.data.index, this.data.sync); } } @@ -139,3 +158,6 @@ async function _jsonWrite(fn, data) { } return true; } +async function _jsonLoad(fn) { + return JSON.parse(await Deno.readTextFile(fn)); +} diff --git a/utils/eventSync.js b/utils/eventSync.js new file mode 100644 index 0000000..b4a510e --- /dev/null +++ b/utils/eventSync.js @@ -0,0 +1,12 @@ +import { DeConfEngine } from "./engine.js"; + +const dc = new DeConfEngine(); +await dc.init(); + +// pick last entry (eq. "23") +const entry = dc.entries[dc.entries.length - 1]; +console.log(`entry=${entry.id}`); + +for (const event of entry.data.events) { + await event.sync(); +} diff --git a/utils/syncTools.js b/utils/syncTools.js new file mode 100644 index 0000000..001828e --- /dev/null +++ b/utils/syncTools.js @@ -0,0 +1,5 @@ +export async function loadJSONUrl(url) { + const resp = await fetch(url); + const data = await resp.json(); + return data; +}