feat: extract feature flags into @gleanwork/docusaurus-plugin-feature-flags#416
Draft
steve-calvert-glean wants to merge 3 commits into
Draft
feat: extract feature flags into @gleanwork/docusaurus-plugin-feature-flags#416steve-calvert-glean wants to merge 3 commits into
steve-calvert-glean wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
rwjblue-glean
approved these changes
Mar 23, 2026
…-flags Moves the bespoke feature flag system out of the site and into a reusable internal Docusaurus plugin/theme package so the new glean-docs site can share the same implementation without duplication. Changes: - Create packages/docusaurus-plugin-feature-flags/ as a hybrid plugin+theme package following the docusaurus-theme-glean pattern - Move core evaluation logic (featureFlags.ts, featureFlagTypes.ts, tests) from src/lib/ into the package's src/lib/ - Move build-time utilities (buildTimeFlags.ts, filtering.ts) from src/utils/ into the package's src/build/ - Extract FeatureFlagsProvider and its React context from Root.tsx into src/theme/FeatureFlagsProvider/, registered automatically via getThemePath() - Move FeatureFlag component and DocSidebarItems theme override into the package - Add withFeatureFlags() config wrapper replacing two IIFEs in docusaurus.config.ts - Update site to consume the plugin via @theme/* aliases (SSR-safe) and workspace:* dependency - Update test mock to reference new package context export path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c700612 to
0148db1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@gleanwork/docusaurus-plugin-feature-flags), so the new glean-docs site can share the same implementation without duplicationdocusaurus-theme-glean):getThemePath()auto-registersFeatureFlag,DocSidebarItems, andFeatureFlagsProvideras@theme/*componentswithFeatureFlags()config wrapper that replaces two IIFEs indocusaurus.config.tsfor cleaner build-time flag injection and navbar filteringWhat moved where
src/lib/featureFlags.tspackages/.../src/lib/featureFlags.tssrc/lib/featureFlagTypes.tspackages/.../src/lib/featureFlagTypes.tssrc/lib/featureFlags.test.tspackages/.../src/lib/featureFlags.test.tssrc/utils/buildTimeFlags.tspackages/.../src/build/buildTimeFlags.tssrc/utils/filtering.tspackages/.../src/build/filtering.tssrc/components/FeatureFlag.tsxpackages/.../src/theme/FeatureFlag/index.tsxsrc/theme/DocSidebarItems/index.tsxpackages/.../src/theme/DocSidebarItems/index.tsxRoot.tsxpackages/.../src/theme/FeatureFlagsProvider/index.tsxFeatureFlagsContextinRoot.tsxpackages/.../src/theme/FeatureFlagsProvider/context.tsTest Plan
pnpm test— 46 tests pass (all feature flag evaluation tests run from new package location)pnpm build— full production build succeeds with build-time navbar filtering and__BUILD_FLAGS__injection workingpnpm start— verify runtime: flags load from/api/feature-flags,<FeatureFlag>MDX component shows/hides content, sidebar filtering works, URL overrides (?ff_flagname=true) and localStorage caching function correctly🤖 Generated with Claude Code