From b78929516df3f87d2717862ca1f84d707b86465b Mon Sep 17 00:00:00 2001 From: bobbyonmagic Date: Fri, 16 Oct 2026 20:31:00 +0300 Subject: [PATCH] digest --dry-run without --email prints the digest (v0.2.1) There is nothing to send without --email, so failing on --dry-run only got in the way of trying the command. Claude-Session: https://claude.ai/code/session_01FRYkaYp9vFJjWBjAQdjnQ4 --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/digest.ts | 5 ++--- src/version.ts | 2 +- test/digest.test.ts | 10 +++++++++- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a961fe..9823dd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [0.2.1] - 2026-10-16 + +- `digest --dry-run` without `--email` prints the digest instead of failing: there is nothing to send. + ## [0.2.0] - 2026-10-16 - `digest` builds a digest of popular, discussed, tag, search, For You or bookmarked posts, and prints it as Markdown, text or HTML. diff --git a/package-lock.json b/package-lock.json index 98d0970..e9698ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devopsdaily/dailydev-cli", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devopsdaily/dailydev-cli", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "bin": { "dailydev": "dist/bin.js" diff --git a/package.json b/package.json index c26fa15..d5541ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devopsdaily/dailydev-cli", - "version": "0.2.0", + "version": "0.2.1", "description": "Read daily.dev from your terminal: your feed, popular posts, search, comments and bookmarks, with --json for scripts and agents. Unofficial.", "type": "module", "bin": { diff --git a/src/digest.ts b/src/digest.ts index ff7a171..f36967e 100644 --- a/src/digest.ts +++ b/src/digest.ts @@ -125,9 +125,8 @@ function readDigest(opts: Opts, args: string[], env: Record { expect(h.out() + h.err()).not.toMatch(/smtpfa|SMTPFAST/i); }); + it("prints the digest for --dry-run without --email, since there is nothing to send", async () => { + const h = harness(); + const plain = harness(); + expect(await h.exec(["digest", "--tags", "kubernetes", "--dry-run"])).toBe(0); + expect(await plain.exec(["digest", "--tags", "kubernetes"])).toBe(0); + expect(h.out()).toBe(plain.out()); + expect(h.out() + h.err()).not.toMatch(/smtpfa|SMTPFAST/i); + }); + it("shows the subject, recipients and posts on a dry run, and sends nothing", async () => { const h = harness(); expect(await h.exec([...emailArgs, "--dry-run"], sendEnv())).toBe(0); @@ -466,7 +475,6 @@ describe("digest --email", () => { ["digest", "--email", Array.from({ length: 101 }, (_, i) => `u${i}@team.dev`).join(","), "--from", "digest@team.dev"], ["digest", "--email", "me@team.dev", "--from", "digest@team.dev", "--format", "html"], ["digest", "--from", "digest@team.dev"], - ["digest", "--dry-run"], ["digest", "--format", "pdf"], ["digest", "--format", "html", "--json"], ["digest", "nope"],