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())
inlineConfig parameter 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
Problem Summary
Consumers cannot customize the Astro configuration from their side. The framework uses a hardcoded
astro.config.mjsfile within the doc-core package, preventing users from: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:
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.The CLI invokes Astro's programmatic API with the hardcoded
astroRootconfig location. Consumers have no way to inject or merge their own configuration.Completion Criteria
The issue is resolved when:
start,build,preview, and other commandssetFsRootDir()with proper config mergingTechnical Notes
mergeConfig()for configuration merging (docs)build(),dev(),preview())inlineConfigparameter in programmatic API allows config overridecli/cli.ts:138-141,cli/setFsRootDir.tscli/setFsRootDir.ts:17-19Related Links