This commit is contained in:
tree 2023-01-21 22:07:27 +01:00
rodič 41f3f4bb06
revize dd13463b6e
8 změnil soubory, kde provedl 75 přidání a 2 odebrání

17
Makefile Normal file
Zobrazit soubor

@ -0,0 +1,17 @@
.PHONY: all build
all: test build
test:
deno test --unstable --allow-read utils/test.js
link-check:
lychee spec/**/*.yaml
format:
deno fmt utils/*.js README.md
fmt: format
build:
deno run --unstable --allow-read --allow-write utils/exec.js build

Zobrazit soubor

@ -1,6 +1,8 @@
# Prague Blockchain Week (PBW)
# Prague Blockchain Week (PBW)
A decentralized conference hosted by [UTXO Foundation](https://utxo.foundation/). We are using this GitHub repository to coordinate event listings.
A decentralized conference hosted by
[UTXO Foundation](https://utxo.foundation/). We are using this GitHub repository
to coordinate event listings.
https://prgblockweek.com

Zobrazit soubor

@ -0,0 +1 @@
name = "UTXO.23"

1
data/23/index.toml Normal file
Zobrazit soubor

@ -0,0 +1 @@
name = "Prague Blockchain Week 2023"

40
utils/engine.js Normal file
Zobrazit soubor

@ -0,0 +1,40 @@
import { parse as tomlParse } from "https://deno.land/std@0.173.0/encoding/toml.ts";
export class DeConfEngine {
constructor(options = {}) {
this.options = options;
this.srcDir = this.options.srcDir || "./data";
}
async init() {}
async build() {
this.entries = {};
for await (const f of Deno.readDir(this.srcDir)) {
if (!f.name.match(/^\d+$/)) {
continue;
}
const specDir = [this.srcDir, f.name].join("/");
const entry = this.entries[f.name] = {};
// load year index
entry.index = await this._tomlLoad([specDir, "index.toml"].join("/"));
console.log(`\n##\n## [${entry.index.name}] \n##`);
// load sub-events
entry.events = [];
for await (const ef of Deno.readDir([specDir, "events"].join("/"))) {
if (!ef.name.match(/^[\w\d\-]+$/)) {
continue;
}
const efDir = [specDir, "events", ef.name].join("/");
const efIndex = await this._tomlLoad([efDir, "index.toml"].join("/"));
const event = {
index: efIndex,
};
entry.events.push(event);
}
console.table(entry.events.map((e) => e.index), ["name"]);
}
}
async _tomlLoad(fn) {
return tomlParse(await Deno.readTextFile(fn));
}
}

12
utils/exec.js Normal file
Zobrazit soubor

@ -0,0 +1,12 @@
import { DeConfEngine } from "./engine.js";
const deconf = new DeConfEngine();
await deconf.init();
let cmd = Deno.args[0] || "build";
let args = Deno.args.slice(1) || [];
const output = await deconf[cmd](...args);
if (output) {
console.log(output);
}

0
utils/test.js Normal file
Zobrazit soubor