-
Notifications
You must be signed in to change notification settings - Fork 0
feat: distribution channels — JSR, browser/OPFS, CLI, binaries, Docker (issue #6) #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2a934c7
docs: add distribution channels research and design (issue #6)
cevheri 8a1bd79
feat: make kernel runtime-agnostic and add browser entry point
cevheri ffaa1d9
feat: publish to JSR and document CDN/browser usage
cevheri 78f3547
feat: add libredb CLI with read commands (inspect, stats, get, scan)
cevheri 25e725d
feat: add libredb CLI write commands (set, delete, import) with advis…
cevheri 57da743
ci: scope out SonarCloud S8707 in the filesystem and CLI layers
cevheri 8d1bd97
feat: distribute standalone CLI binaries via GitHub Releases
cevheri f002b8e
feat: ship a multi-arch Docker image of the CLI to GHCR
cevheri 1f823de
feat: add OPFS-backed browser persistence (opfsFileSystem)
cevheri e30ab5b
fix: harden OPFS adapter and release workflow per final review
cevheri 7f67fa4
chore: bump version to 0.1.0
cevheri 7c575da
ci: also publish the Docker image to Docker Hub; bump to 0.1.1
cevheri 45fc278
ci: use vars.DOCKER_HUB_USERNAME for Docker Hub login; bump to 0.1.2
cevheri 6010e46
docs: note the Docker image is published to Docker Hub too
cevheri b330ccf
fix: lock reports only EEXIST as locked; clarify fs/docs per review
cevheri 6f040af
chore: add .qoder/ to .gitignore
cevheri a197813
feat: type browser open so fs is required when a path is given
cevheri 37e4705
fix: harden CLI dispatch, import, and lock per Copilot review
cevheri 0aef094
docs: sync-version manages the README CDN pin; document Docker Hub setup
cevheri 028297c
fix: delete refuses reserved keys; clarify browser typing in README
cevheri dd36030
refactor: stop re-exporting OpenOptions from the browser entry
cevheri 29b1865
fix: make the advisory lock robust to IO faults (per Copilot review)
cevheri 25b51a5
build: pin base image digests; clarify --force is for stale locks
cevheri 584c94e
docs: add JSR and Docker Hub badges and a Docker Hub link
cevheri 498d47b
ci: publish to JSR via npx, not bunx
cevheri 5c316b2
chore: release 0.1.3 (consume changesets, write CHANGELOG)
cevheri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Keep the build context tiny: the image only needs src/ to compile the CLI | ||
| # (bun build --compile bundles src directly). Everything else is excluded. | ||
| node_modules | ||
| dist | ||
| coverage | ||
| .git | ||
| .github | ||
| .attw | ||
| *.tgz | ||
| *.log | ||
| docs | ||
| *.md | ||
| .changeset | ||
| .remember | ||
| .ralph | ||
| loop | ||
| .vscode | ||
| .idea | ||
| libredb | ||
| libredb-* | ||
| *.sha256 |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # @libredb/libredb | ||
|
|
||
| ## 0.1.3 | ||
|
|
||
| ### Patch Changes | ||
|
|
||
| - 78f3547: Add a `libredb` CLI for inspecting and editing `.libredb` files (`npx libredb`). | ||
|
|
||
| Read commands: `inspect` (list each namespace, its kind, and table schemas), | ||
| `stats` (file size and namespace counts by kind), `get <key>`, and | ||
| `scan <prefix>`. They open through a read-only filesystem adapter, so inspecting | ||
| a file never mutates it — even a crash-torn tail is recovered in memory only, | ||
| leaving the bytes on disk untouched. | ||
|
|
||
| Write commands: `set <key> <value>`, `delete <key>`, and `import <file.json>` | ||
| (bulk-set from a JSON object in a single atomic commit). Writes take an advisory | ||
| `<path>.lock` so a second concurrent writer fails loudly instead of corrupting | ||
| the file; `--force` overrides a stale lock. | ||
|
|
||
| The CLI is built on the public API with zero dependencies (Node/Bun `parseArgs`). | ||
|
|
||
| - 8a1bd79: Add a browser entry point (`@libredb/libredb/browser`) and make the kernel | ||
| runtime-agnostic. | ||
|
|
||
| The `node:fs` dependency moved out of the kernel (`core.ts`) into a dedicated | ||
| adapter, so importing LibreDB no longer drags `node:fs` into the module graph. | ||
| The default Node entry (`@libredb/libredb`) is unchanged: `open({ path })` still | ||
| defaults to the real filesystem and is durable out of the box. The new browser | ||
| entry exposes the same lens surface with an `open` that has no default | ||
| filesystem — in-memory databases work anywhere, and a path-backed open accepts | ||
| an injected filesystem. A bundler targeting the browser now resolves a build | ||
| free of Node built-ins via the `browser` export condition. | ||
|
|
||
| - 1f823de: Add OPFS-backed browser persistence via `opfsFileSystem` (exported from | ||
| `@libredb/libredb/browser`). | ||
|
|
||
| A browser `FileSystemSyncAccessHandle` exposes synchronous read/write/getSize/ | ||
| truncate/flush/close, which map directly onto the kernel's synchronous filesystem | ||
| seam — so a LibreDB database can be durable in the browser with no async core. | ||
| Inside a Web Worker, obtain a sync access handle and pass it to `open`: | ||
|
|
||
| ```ts | ||
| const root = await navigator.storage.getDirectory(); | ||
| const file = await root.getFileHandle("app.libredb", { create: true }); | ||
| const db = open({ | ||
| path: "app.libredb", | ||
| fs: opfsFileSystem(await file.createSyncAccessHandle()), | ||
| }); | ||
| ``` | ||
|
|
||
| The adapter takes an already-open handle (acquisition is async and the caller's), | ||
| keeping `open` synchronous. The new `SyncAccessHandle` type names the handle | ||
| shape the adapter needs, so the package depends on no DOM lib types. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # A portable shell for the `libredb` CLI — NOT a server. LibreDB is an embedded, | ||
| # in-process database; this image just carries the inspection/edit CLI so it can | ||
| # run anywhere with a volume-mounted .libredb file. Mount your data and run a | ||
| # command, e.g.: | ||
| # | ||
| # docker run --rm -v "$PWD:/data" ghcr.io/libredb/libredb inspect /data/app.libredb | ||
| # | ||
| # The CLI has zero runtime dependencies, so the build needs no `bun install`: | ||
| # `bun build --compile` bundles only src/ into one self-contained executable. | ||
|
|
||
| # Stage 1: compile the CLI for the build platform (buildx sets it per --platform, | ||
| # so the same Dockerfile cross-builds amd64 and arm64). | ||
| # Pinned by digest (the tag is mutable) for a reproducible, supply-chain-safe | ||
| # build; the tag stays for readability and tracks .bun-version (1.3.14, the same | ||
| # Bun the binaries job pins via setup-bun). Bump both the tag and the digest | ||
| # together when .bun-version changes. | ||
| FROM oven/bun:1.3.14@sha256:e10577f0db68676a7024391c6e5cb4b879ebd17188ab750cf10024a6d700e5c4 AS build | ||
| WORKDIR /src | ||
| # bun build --compile bundles only the source it reaches; the CLI imports nothing | ||
| # outside src/, so no package.json/tsconfig and no `bun install` are needed. | ||
| COPY src ./src | ||
| RUN bun build --compile src/cli/main.ts --outfile /libredb | ||
|
|
||
| # Stage 2: a minimal runtime carrying only the binary and the glibc/libstdc++ a | ||
| # bun-compiled executable links against. distroless/cc has exactly that. Pinned | ||
| # by digest because `cc-debian12` is a rolling tag (no version), so the digest is | ||
| # what makes the runtime reproducible; refresh it periodically for base updates. | ||
| FROM gcr.io/distroless/cc-debian12@sha256:d703b626ba455c4e6c6fbe5f36e6f427c85d51445598d564652a2f334179f96e | ||
| COPY --from=build /libredb /usr/local/bin/libredb | ||
| WORKDIR /data | ||
| ENTRYPOINT ["/usr/local/bin/libredb"] |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.