Skip to content

refactor: generate rule-manifest locally during website build#461

Merged
fansenze merged 1 commit intomainfrom
refactor/inline-rule-manifest-generation
Feb 9, 2026
Merged

refactor: generate rule-manifest locally during website build#461
fansenze merged 1 commit intomainfrom
refactor/inline-rule-manifest-generation

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Feb 6, 2026

Summary

Replace the CI workflow + GitHub raw URL fetch approach with local generation during website build:

  • Change gen-rule-manifest.js output to website/generated/rule-manifest.json
  • Add Rspress beforeBuild hook plugin (plugin-rule-manifest.ts) to auto-generate manifest before build
  • Simplify rule.tsx to directly import local JSON instead of SWR + remote fetch
  • Remove update-rule-manifest.yml CI workflow, old preload-plugin.ts, and committed rule-manifest.json
  • Add website/generated/ to .gitignore

Related Links

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Replace the CI workflow + GitHub raw URL fetch approach with local
generation during website build. The Rspress beforeBuild hook now
runs gen-rule-manifest.js to produce the manifest, and rule.tsx
imports the generated JSON directly instead of fetching it via SWR.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @fansenze, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the data sourcing mechanism for the website's rule manifest. By transitioning from a remote fetching approach to local generation during the build process, the system gains improved reliability and efficiency. This change ensures that the website always uses the most current rule data without relying on external network requests at runtime, simplifying the component logic and reducing potential points of failure.

Highlights

  • Local Rule Manifest Generation: The rule manifest, previously fetched from a remote GitHub URL via a CI workflow, is now generated locally during the website build process. This eliminates external runtime dependencies for the manifest data.
  • New Rspress Plugin: A new Rspress plugin, plugin-rule-manifest.ts, has been introduced. This plugin hooks into the beforeBuild phase to execute the gen-rule-manifest.js script, ensuring the manifest is up-to-date before the site is built.
  • Simplified Rule Display Component: The rule.tsx component, responsible for displaying rule states, has been significantly simplified. It now directly imports the locally generated rule-manifest.json instead of using useSWR for remote data fetching, removing associated loading and error states.
  • Cleanup of Old Mechanisms: The old rule-manifest.json file, the preload-plugin.ts responsible for remote fetching, and related SWR dependencies have been removed, streamlining the codebase.
  • Git Ignore Update: The website/generated/ directory, where the new rule manifest is stored, has been added to .gitignore to prevent committing generated files.
Changelog
  • .gitignore
    • Added website/generated/ to ignore the newly generated rule manifest directory.
  • packages/rslint-test-tools/rule-manifest.json
    • Removed the previously committed rule-manifest.json file.
  • scripts/gen-rule-manifest.js
    • Updated the output path for the generated rule manifest to ../website/generated/rule-manifest.json.
    • Added logic to create the target directory recursively if it does not exist.
  • website/plugin-rule-manifest.ts
    • Added a new Rspress plugin that executes the gen-rule-manifest.js script during the beforeBuild hook.
  • website/preload-plugin.ts
    • Removed the plugin responsible for preloading rule data from a remote URL.
  • website/rspress.config.ts
    • Updated the Rspress configuration to use the new pluginRuleManifest and removed the reference to pluginPreloadRule.
  • website/theme/components/RuleStates/rule.tsx
    • Removed useSWR, SWRConfig, usePageData, ErrorCard, and LoadingCard imports and related logic.
    • Modified the component to directly import rule-manifest.json from the locally generated path.
    • Removed the RuleManifest type definition and fetcher function as they are no longer needed for remote fetching.
    • Eliminated error and loading state handling for the rule data, as it's now available at build time.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/update-rule-manifest.yml
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@fansenze fansenze requested a review from hardfist February 6, 2026 06:11
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully refactors the rule manifest generation process from a CI workflow with remote fetching to a local generation during the website build. This change simplifies the client-side code by removing the need for useSWR and external API calls, leading to a more robust and self-contained build process. The changes are well-implemented and align with the stated goals of the pull request.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying rslint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a3bf00
Status: ✅  Deploy successful!
Preview URL: https://9b350bf2.rslint.pages.dev
Branch Preview URL: https://refactor-inline-rule-manifes.rslint.pages.dev

View logs

@fansenze fansenze merged commit 4ca045f into main Feb 9, 2026
16 checks passed
@fansenze fansenze deleted the refactor/inline-rule-manifest-generation branch February 9, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants