๐Ÿ“ฆ noxify / renoun-search-index

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching
๐Ÿ“ฅ Clone https://github.com/noxify/renoun-search-index.git
HTTPS git clone https://github.com/noxify/renoun-search-index.git
SSH git clone git@github.com:noxify/renoun-search-index.git
CLI gh repo clone noxify/renoun-search-index
Marcus Reinhardt Marcus Reinhardt init 1be95fa 2 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .vscode
๐Ÿ“ content
๐Ÿ“ src
๐Ÿ“„ .gitignore
๐Ÿ“„ .nvmrc
๐Ÿ“„ .prettierignore
๐Ÿ“„ eslint.config.js
๐Ÿ“„ package.json
๐Ÿ“„ pnpm-lock.yaml
๐Ÿ“„ prettier.config.js
๐Ÿ“„ readme.md
๐Ÿ“„ search-index.json
๐Ÿ“„ tsconfig.json
๐Ÿ“„ README.md

Renoun Search Index Generator

A standalone tool to generate JSON search indexes for local full-text search implementations (e.g., with Orama).

Overview

This project extracts structured data from MDX files and generates a searchable index that can be consumed by client-side search libraries. The implementation is inspired by and based on Fumadocs' excellent work โ€” huge thanks to the team!

Motivation

The goal was to generate search index data based on the existing Renoun collection implementation. Initially, I explored using an internal API endpoint to leverage Next.js's runtime context, avoiding the need for component mocking. However, I ultimately switched to a standalone approach for greater flexibility, making it easier to adapt to other frameworks in the future (e.g., migrating from Next.js to Waku).

Component Mocking

Since MDX files may directly import React components, we need to mock them during the build process to prevent runtime errors. The current mocking configuration can be found in src/loaders/component-mock-loader.mjs.

Usage

To generate the search index:

  • Install dependencies:
pnpm install

  • Generate the search index:
pnpm generate:search

The generated JSON file can then be consumed by your search implementation.