patternfly / patternfly/patternfly-doc-core
Add support for consumer side customization of the actual astro config
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 11
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 1
Description
Problem Summary
Consumers cannot customize the Astro configuration from their side. The framework uses a hardcoded astro.config.mjs file within the doc-core package, preventing users from:
- Adding custom Astro integrations
- Modifying Vite configuration for their specific needs
- Changing the deployment adapter (currently hardcoded to Cloudflare)
- Customizing build settings, output options, or other Astro configurations
Current limitation: While users can customize content via pf-docs.config.mjs, they cannot modify the actual Astro config without forking doc-core and requesting npm releases.
Use Cases
Consumers need to customize Astro config for:
- Deployment targets: Different hosting platforms (AWS, Netlify, Vercel) require different adapters
- Vite configuration: Custom resolve aliases, plugins, or build optimizations
- Integrations: Adding sitemap, analytics, or other Astro integrations
- Performance tuning: Customizing bundle splitting, compression, or caching strategies
- Environment-specific settings: Different configs for dev/staging/production
Current Architecture
The CLI currently modifies the Astro config via string replacement in setFsRootDir() (cli/setFsRootDir.ts:17-19), which is brittle and doesn't support general user customization.
// cli/cli.ts:138-141
await build({
root: astroRoot,
outDir: docsOutputDir,
})
The CLI invokes Astro's programmatic API with the hardcoded astroRoot config location. Consumers have no way to inject or merge their own configuration.
Completion Criteria
The issue is resolved when:
- User config file supported: Consumers can create an optional Astro config file that gets merged with the base config
- Configuration merging: User config is properly merged with doc-core's base config
- Backward compatibility: Existing setups without user config continue to work with default behavior
- Clear precedence rules: Documentation clearly explains which config values take precedence (user overrides vs. base defaults)
- Type safety: User config gets proper TypeScript support and validation
- All CLI commands supported: Config merging works for
start,build,preview, and other commands - No string manipulation: Replace the brittle string replacement approach in
setFsRootDir()with proper config merging
Technical Notes
- Astro 5.4.0+ supports
mergeConfig()for configuration merging (docs) - The CLI already uses Astro's programmatic API (
build(),dev(),preview()) inlineConfigparameter in programmatic API allows config override- File locations:
cli/cli.ts:138-141,cli/setFsRootDir.ts - Current string replacement hack:
cli/setFsRootDir.ts:17-19
Related Links
- Related issue: #95 (Add ability to pass in vite / astro configurations for doc core) - CLOSED
- Jira: PF-3604
- Astro mergeConfig API: https://docs.astro.build/en/reference/modules/astro-config/
- Astro programmatic API: https://docs.astro.build/en/reference/programmatic-reference/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with cli/setFsRootDir.ts:17-19 and cli/cli.ts:138-141, then trace how the start, build, preview, and other CLI commands invoke the programmatic API. Define how an optional consumer config is merged with the base config, including precedence and type support; done means existing defaults remain unchanged and all listed commands support the customization without string manipulation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, cli, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100