bookclerk_dev

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Dev workflow helpers for building and staging first-party plugin guests.

Item Kind Summary
ensure_ui_dist function Rebuilds ui/dist when index.html is missing or older than SPA sources.
ensure_workerd_for_profile function Ensure the pinned Cloudflare workerd binary is present under target/<profile>/.
workspace_root function Resolves the Cargo workspace root from CARGO_MANIFEST_DIR or cwd.
default_artifacts function Default directory for packaged release artifacts under the workspace.
default_files_dir function Dev files root: $BOOKCLERK_FILES_DIR, else <workspace>/BookclerkFiles.
reset_files_dir function Wipe a Bookclerk files directory (config, DB, master.key, plugins, caches).
workspace_version function Workspace version from CARGO_PKG_VERSION (matches [workspace.package].version).

Modules

  • package: Release packaging aligned with docs/plugins/registry.md artifact naming.
  • plugins: Directory-driven discovery, build, stage, and platform install for guests.

Functions

ensure_ui_dist

pub fn ensure_ui_dist(root: &Path) -> Result<()>

Rebuilds ui/dist when index.html is missing or older than SPA sources.

cargo dev previously compiled only Rust crates, so a git pull that changed ui/src still served the previous Vite output from ui/dist.

Arguments

  • root - Cargo workspace root (the directory that contains ui/).

Errors

Returns an error when npm ci / npm run build fail, npm is missing, or ui/dist/index.html is still absent after the build.

ensure_workerd_for_profile

pub fn ensure_workerd_for_profile(root: &Path, release: bool) -> Result<PathBuf>

Ensure the pinned Cloudflare workerd binary is present under target/<profile>/.

Arguments

  • root - Cargo workspace root directory.
  • release - When true, install under target/release/; otherwise target/debug/.

Returns

Absolute path to the ensured workerd binary.

Errors

Returns an error when the underlying I/O, parse, network, or store operation fails.

workspace_root

pub fn workspace_root() -> Result<PathBuf>

Resolves the Cargo workspace root from CARGO_MANIFEST_DIR or cwd.

Returns

Absolute path to the Cargo workspace root (parent of crates/).

Errors

Returns an error when the crate is not nested under crates/ as expected.

default_artifacts

pub fn default_artifacts(root: &Path) -> PathBuf

Default directory for packaged release artifacts under the workspace.

Arguments

  • root - Cargo workspace root directory.

Returns

Absolute path to the artifacts directory.

default_files_dir

pub fn default_files_dir() -> PathBuf

Dev files root: $BOOKCLERK_FILES_DIR, else <workspace>/BookclerkFiles.

reset_files_dir

pub fn reset_files_dir(files_dir: &Path) -> Result<()>

Wipe a Bookclerk files directory (config, DB, master.key, plugins, caches).

Arguments

  • files_dir - Bookclerk files directory to wipe and recreate.

Returns

The successful result value for this operation.

Errors

Returns an error when the underlying I/O, parse, network, or store operation fails.

workspace_version

pub fn workspace_version() -> &'static str

Workspace version from CARGO_PKG_VERSION (matches [workspace.package].version).

Generated from crates/bookclerk-dev at main · View as Markdown