feat(opf): ship examples, docs, and upstream README in the npm package#3
Merged
Merged
Conversation
Adds three new subpath exports for downstream sites that currently have to
clone OpenPresentation/opf or hit GitHub at request time to read content the
package doesnt yet ship.
- @openpresentation/opf/examples bundles every .opf.json under examples/ at
build time, exposes them as ExampleRecord[] + GalleryRecord[] (with the
parsed Presentation deck), plus convenience lookups: getExample,
getGallery, getExamplesByGallery, getExamplesByCategory. Each deck is
validated against the presentation schema during smoke tests.
- @openpresentation/opf/docs bundles the top-level docs/*.md reference pages
(schema-reference, catalog-schema-reference, content-payloads,
content-item-design-overrides, examples) and exposes them as DocRecord[]
with getDoc. The BACKLOG and docs/migrations/, docs/plans/ subdirectories
are intentionally excluded because they change too quickly to pin inside a
release.
- @openpresentation/opf/repo-readme exposes the upstream README.md as a raw
markdown string so consumer sites can mirror the canonical README without
a network fetch.
Implementation:
- New scripts/generate-content.mjs walks examples/, docs/, and README.md at
build time and emits src/generated/{examples,docs,repo-readme}.ts; wired
into the generate / build pipeline alongside the existing schema, catalog,
spec-files, and previews generators.
- New facade modules src/examples.ts, src/docs.ts, src/repo-readme.ts
re-export the generated data with the public type surface.
- tsup config gains three entries; package.json gets three new exports.
- Smoke test asserts every shipped deck validates, that gallery indexing is
consistent, that docs metadata is non-empty, and that the repo README is
present and non-trivial.
- README and CHANGELOG document the new entry points.
Pack stays at one tarball; size grows from ~1 MB to ~1.7 MB (unpacked
13.5 MB) which is acceptable for the convenience of removing the GitHub
source sync from downstream consumers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three new subpath exports for downstream sites that currently have to clone OpenPresentation/opf or hit GitHub at request time to read content the package doesnt yet ship.
Implementation:
Pack stays at one tarball; size grows from ~1 MB to ~1.7 MB (unpacked 13.5 MB) which is acceptable for the convenience of removing the GitHub source sync from downstream consumers.