From 6b6502a22cb1ca11db7f5fcd29b118bb8a3e1db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lohrer?= Date: Sat, 18 Apr 2026 05:20:19 +0200 Subject: [PATCH] =?UTF-8?q?publish(task=201):=20deno-grundger=C3=BCst=20(d?= =?UTF-8?q?eno.jsonc,=20.env.example,=20readme)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deno 2.x projekt mit jsr/npm-imports für @std, nostr-tools, applesauce-signers, applesauce-relay und rxjs. env-handling: primär ../.env.local (projekt-lokal), alternativ publish/.env für fremd-repos (template in .env.example). tasks für publish, check, validate-post, test, fmt, lint. Co-Authored-By: Claude Opus 4.6 (1M context) --- publish/.env.example | 23 +++++++++++++++++++++++ publish/.gitignore | 2 ++ publish/README.md | 31 +++++++++++++++++++++++++++++++ publish/deno.jsonc | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 publish/.env.example create mode 100644 publish/.gitignore create mode 100644 publish/README.md create mode 100644 publish/deno.jsonc diff --git a/publish/.env.example b/publish/.env.example new file mode 100644 index 0000000..3173008 --- /dev/null +++ b/publish/.env.example @@ -0,0 +1,23 @@ +# ==== PFLICHT ==== + +# NIP-46-Bunker-URL vom Signer (Amber, nak bunker, nsite.run, …) +BUNKER_URL=bunker://?relay=wss://...&secret=... + +# Autor-Pubkey als 64 Zeichen lowercase hex (entspricht dem Bunker-Account) +AUTHOR_PUBKEY_HEX= + +# Bootstrap-Relay zum Laden von kind:10002 und kind:10063 +BOOTSTRAP_RELAY=wss://relay.damus.io + +# ==== OPTIONAL ==== + +# Wurzel der Markdown-Posts, relativ zu diesem publish/-Ordner. +# Default: ../content/posts +CONTENT_ROOT=../content/posts + +# Wird als ["client", ""]-Tag in jedes kind:30023-Event eingetragen. +# Hilft bei der Zuordnung der Event-Herkunft. Default leer (kein client-Tag). +CLIENT_TAG= + +# Minimal geforderte Relay-ACKs pro Post (default: 2) +MIN_RELAY_ACKS=2 diff --git a/publish/.gitignore b/publish/.gitignore new file mode 100644 index 0000000..7a6501a --- /dev/null +++ b/publish/.gitignore @@ -0,0 +1,2 @@ +.env +logs/ diff --git a/publish/README.md b/publish/README.md new file mode 100644 index 0000000..68e5920 --- /dev/null +++ b/publish/README.md @@ -0,0 +1,31 @@ +# publish — Nostr-Publish-Pipeline + +Markdown-Posts aus einem Hugo-ähnlichen Content-Ordner zu `kind:30023`-Events, +Bilder zu Blossom, Signatur via NIP-46-Bunker. + +Blaupause für Nostr-Repos: keinerlei Projekt-Konstanten im Code, alles über +Env-Variablen konfigurierbar. + +## Setup + +1. `cp .env.example .env` und Werte eintragen. +2. Oder: `.env.local` im Eltern-Ordner pflegen und `deno.jsonc` anpassen + (siehe `--env-file=../.env.local`-Tasks). +3. `deno task check` — verifiziert Bunker, Relay-Liste, Blossom-Server. + +## Befehle + +- `deno task publish` — Git-Diff-Modus: publisht nur geänderte Posts. +- `deno task publish --force-all` — alle Posts (Migration / Reimport). +- `deno task publish --post ` — nur ein Post. +- `deno task publish --dry-run` — zeigt, was publiziert würde, ohne Uploads. +- `deno task validate-post content/posts//index.md` — Frontmatter-Check. +- `deno task test` — Tests. + +## Struktur + +- `src/core/` — Library (Frontmatter, Markdown, Events, Signer, Relays, Blossom). +- `src/subcommands/` — CLI-Befehle. +- `src/cli.ts` — Entrypoint, Subcommand-Dispatcher. +- `tests/` — Unit- und Integration-Tests. +- `.github/workflows/publish.yml` — CI-Workflow. diff --git a/publish/deno.jsonc b/publish/deno.jsonc new file mode 100644 index 0000000..49b797b --- /dev/null +++ b/publish/deno.jsonc @@ -0,0 +1,34 @@ +{ + "tasks": { + "publish": "deno run --env-file=../.env.local --allow-env --allow-read --allow-write=./logs --allow-net --allow-run=git src/cli.ts publish", + "check": "deno run --env-file=../.env.local --allow-env --allow-read --allow-net src/cli.ts check", + "validate-post": "deno run --allow-read src/cli.ts validate-post", + "test": "deno test --allow-env --allow-read --allow-net --allow-run", + "fmt": "deno fmt", + "lint": "deno lint" + }, + "imports": { + "@std/yaml": "jsr:@std/yaml@^1.0.5", + "@std/cli": "jsr:@std/cli@^1.0.6", + "@std/fs": "jsr:@std/fs@^1.0.4", + "@std/path": "jsr:@std/path@^1.0.6", + "@std/testing": "jsr:@std/testing@^1.0.3", + "@std/assert": "jsr:@std/assert@^1.0.6", + "@std/encoding": "jsr:@std/encoding@^1.0.5", + "nostr-tools": "npm:nostr-tools@^2.10.4", + "applesauce-signers": "npm:applesauce-signers@^2.0.0", + "applesauce-relay": "npm:applesauce-relay@^2.0.0", + "rxjs": "npm:rxjs@^7.8.1" + }, + "fmt": { + "lineWidth": 100, + "indentWidth": 2, + "semiColons": false, + "singleQuote": true + }, + "lint": { + "rules": { + "tags": ["recommended"] + } + } +}