Add Cloudflare Worker JSON API for search #193
Annotations
1 error
|
commitlint
You have commit messages with errors
⧗ input: Add Cloudflare Worker JSON API for search
Implements a lightweight Cloudflare Worker that provides a JSON API
endpoint for searching Docusaurus documentation using pre-built Lunr
indexes stored in Cloudflare KV.
Features:
- POST/GET /search endpoint for executing searches
- GET /indexes endpoint to list available indexes
- KV storage for search indexes with in-memory caching
- CORS support (configurable)
- Multi-version/tag support
- Complete TypeScript implementation
Includes:
- Worker implementation (src/worker.ts)
- Lunr.js ES module bundle (src/lunr-bundle.js)
- Index upload script (scripts/upload-indexes.js)
- Wrangler configuration for deployment
- Comprehensive documentation (README, DEPLOYMENT, examples)
This enables serving search results from Cloudflare's edge network
instead of loading indexes in the browser, reducing client bundle
size and providing consistent fast performance globally.
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/cmfcmf/docusaurus-search-local/blob/main/CONTRIBUTING.md#commit-message-guidelines
⧗ input: Add CLI tool for automated search index deployment
Creates a standalone CLI tool (@cmfcmf/docusaurus-search-deploy) that
seamlessly integrates search index deployment into the Docusaurus build
process.
Features:
- Auto-detects build directory and search indexes
- Configuration file support (.searchdeployrc.json)
- Environment variable support
- Dry-run mode for testing
- Interactive init command
- Worker management commands
- Integrates with npm scripts (postbuild hook)
- GitHub Actions ready
Usage:
npm install --save-dev @cmfcmf/docusaurus-search-deploy
npx docusaurus-search-deploy init
npm run build # Automatically deploys after build
Benefits over manual deployment:
- Zero manual steps required
- Automatic updates on every build
- Works with any CI/CD system
- Environment-aware deployment
- Comprehensive error handling
Includes:
- CLI implementation with Commander.js
- Configuration loader with cosmiconfig
- Deploy logic with progress indicators
- Init wizard for setup
- Complete documentation and examples
- Integration guide for Docusaurus plugin
This enables a fully automated workflow where indexes are deployed
to Cloudflare automatically as part of the build process.
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/cmfcmf/docusaurus-search-local/blob/main/CONTRIBUTING.md#commit-message-guidelines
⧗ input: Make CLI tool framework-agnostic
Removes Docusaurus-specific references and makes the CLI tool work
with any static site generator that produces Lunr search indexes.
Changes:
- Updated README to be framework-agnostic
- Simplified EXAMPLE_WORKFLOW for any static site
- Removed INTEGRATION.md (plugin-specific integration guide)
- Changed CLI name from 'docusaurus-search-deploy' to 'search-deploy'
- Updated output messages to be generic
- Changed default worker name to 'search-worker'
- Updated init instructions for generic build commands
The tool now works with any static site that generates:
- search-index-{tag}.json files
- Containing Lunr.js indexes in the expected format
Compatible with:
- Docusaurus (with @cmfcmf/docusaurus-search-local)
- Jekyll with Lunr plugins
- Hugo with search plugins
- Any custom Lunr implementation
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/cmfcmf/docusaurus-search-local/blob/main/CONTRIBUTING.md#commit-message-guidelines
|