Skip to content

feat: 🎸 v4.0.0 with lemmy memes, native fetch and cli - #60

Merged
halitsever merged 6 commits into
masterfrom
release/4.0.0
Oct 29, 2026
Merged

halitsever merged 6 commits into
masterfrom
release/4.0.0

Conversation

@halitsever

Copy link
Copy Markdown
Owner

Summary

random() returned the same hardcoded meme on every call, because the API behind it has served a dummy response since 2024-03-03. It now reads Lemmy directly.

 random()
-  GET random-memes-api-ashy.vercel.app/image/get-memes
+  GET hot posts of lemmy.world/c/memes, lemmy.world/c/dankmemes, lemmy.ml/c/memes
+    skip pinned, NSFW, removed and non-image posts, drop cross-post duplicates
+    reuse the pool for 10 minutes, tolerate failing sources
+  return { image, category, caption, permalink }
 src/
+├── cli.js          # npx random-memes
 ├── index.js        # plain export object, so ESM named imports work
 ├── index.d.ts      # declares random() and reddit() for real
 ├── lib/
-│   ├── index.js
 │   ├── random.js
-│   ├── reddit.d.ts
 │   └── reddit.js   # deprecated, Reddit answers 403
 └── utils/
-    └── axios.js
+    ├── http.js     # fetch with timeout and package User-Agent
+    └── image.js

Also: Node >= 20 with zero runtime dependencies, Jest replaced by node:test with mocked fetch, CI on Node 20/22/24, updated Pages and publish actions, community health files. Full list in CHANGELOG.md.

Evidence

  • Before: six calls to the API all return About my uncle. npm audit reports 27 vulnerabilities (1 critical, 15 high, axios in production). import { random } from "random-memes" finds only default.
    After: five CLI runs print five different memes. Eight calls in one process return eight distinct memes, 281 ms for the first and 0 ms for the cached rest. npm audit --omit=dev finds 0. ESM named import works. npm test passes 19/19 offline and npm run test:types passes.

Merge Danger

Door: two-way for the repo. Publishing 4.0.0 to npm afterwards is one-way, since a version number cannot be reused.

Blast Radius: consumers

Major version: Node >= 20 is required, the exports map blocks deep imports, and category is now the Lemmy community name. 3.x installs are untouched until they upgrade.

@halitsever
halitsever merged commit e627f10 into master Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant