publish(task 1): deno-grundgerüst (deno.jsonc, .env.example, readme)
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) <noreply@anthropic.com>
This commit is contained in:
parent
32fe856232
commit
6b6502a22c
|
|
@ -0,0 +1,23 @@
|
|||
# ==== PFLICHT ====
|
||||
|
||||
# NIP-46-Bunker-URL vom Signer (Amber, nak bunker, nsite.run, …)
|
||||
BUNKER_URL=bunker://<hex>?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", "<wert>"]-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
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
logs/
|
||||
|
|
@ -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 <slug>` — nur ein Post.
|
||||
- `deno task publish --dry-run` — zeigt, was publiziert würde, ohne Uploads.
|
||||
- `deno task validate-post content/posts/<ordner>/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.
|
||||
|
|
@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue