This lives in the pagefind directory, and houses the code for indexing a built static site.
This lives in the pagefind_web_js directory.
This lives in pagefind_web, and is what performs the actual search actions in the browser.
These are the node packages in pagefind_ui, which are both published to NPM and compiled into the indexing binary.
These live in wrappers, and are what provide the npx and pip binary Pagefind runners, as well as the Node and Python bindings for Pagefind.
This lives in docs, and is the static site generating the content at https://pagefind.app
This lives in pagefind_stem, and it's unlikely you'll need to touch this.
NB: Contributing right now is certainly easier on macOS/Linux systems, but there are no hard blockers for contributing from Windows. To do so, you will need to dig into the justfile and run the applicable commands for Windows. If you're interested in contributing Windows variants for the build scripts and justfile commands, that would be lovely!
We use just to manage development commands. To get started:
# Install all dependencies and tooling
just install
# Build everything
just build
# Run tests
just testRun just to see all available commands.
The project has multiple components that need to be built in order. The easiest way is to use:
# Build all supporting packages first
just build-deps
# Then build the main Pagefind binary
just build-main
# Or build everything at once
just buildThe build process:
- Builds the JavaScript API bindings (
pagefind_web_js) - Builds the UI packages (
pagefind_ui/defaultandpagefind_ui/modular) - Builds the playground (
pagefind_playground) - Builds the WebAssembly package for all supported languages (this takes a while!)
- Builds the main Pagefind binary with release optimizations
After building, you'll have a final Pagefind binary at target/release/pagefind.
Note: Pagefind currently runs very slowly in a debug build, so we always build with --release for better runtime performance.
# Run all tests
just testThis runs:
- Rust unit tests for the main package
- WebAssembly tests
- JavaScript tests
- Integration tests using Toolproof
For most changes, integration tests are preferred over unit tests. The integration test files are in pagefind/integration_tests and are written for Toolproof.
# Start UI development server (default UI)
just dev-ui
# Start UI development server (modular UI)
just dev-ui-modular
# Format code
just fmt
# Lint everything
just lint
# Test with the documentation site
just test-docsFor the UI packages, use just dev-ui or just dev-ui-modular to start a development server with hot reload.
To test the main package with the documentation site:
just test-docsThis will:
- Build the Pagefind documentation site
- Run your local Pagefind binary on it
- Start a server where you can test:
- Indexing by your local build of the binary
- Searching with your local build of the WebAssembly
- UI rendered by your local build of the Default UI
TODOS:
- Devise and document a nice way to manually test the npx wrapper behaviour
- Devise and document a nice way to manually test the Node package interface
- Provide a better path for contributing from Windows machines