Let other packages render and export with reader through a public API

Open Beginner friendly
#318 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, nodejs
Domain
release, tooling

Research direction

Start in package.json: check the name field (self-referencing imports need it) and how tests are currently run, then read src/render.js and src/export.js to confirm the named exports (render, makeRenderer, titleOf, exportHtml) and find the aside writer from #315. Add the exports map with ./render, ./export and ./asides, then add tests that import each through the reader/... package names and one that expects a deep path outside exports to fail with ERR_PACKAGE_PATH_NOT_EXPORTED. Finish by adding the public-API paragraph to CONTRIBUTING.md; done when the suite passes and the checklist's three boxes are satisfied.

Written by the indexing model from the issue text.

Description

polish

Part of #68. Also what reader-margin, a companion server for margin notes on published posts, builds on.

Today

reader is an app, not a package other code can rely on. package.json has no exports, so another package that depends on reader imports whatever paths it finds (reader/src/render.js), and a rename inside reader breaks it with no warning.

What to do

Declare what another package may use, in package.json exports, and keep everything else private:

  • reader/render: render, makeRenderer and titleOf (src/render.js)
  • reader/export: exportHtml (src/export.js)
  • reader/asides: the aside writer (#315) and what reads asides

A dependent pins a tagged reader from GitHub ("reader": "github:jzheaux/reader#v0.0.6"), so these names are what a tag promises.

Done when

  • exports lists the entry points above, and a test imports each by its package name.
  • A test checks that a path outside exports can't be imported.
  • CONTRIBUTING.md says these are a public API: changing one is a breaking change, called out in the release notes.

🤖 Generated with Claude Code

Dominant language
JavaScript
Stars
0
Forks
1
Avg merge
2d 4h
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jzheaux/reader

All issues in jzheaux/reader

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.