fix(docs): add overwriteExisting option for flexible README overwrite behaviour #6249
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.
The
docs-readme
output target has long supported writing README files to custom locations using thedir
property, helping teams structure their documentation workflows to suit project needs.As part of evolving those workflows, I've introduced the
overwriteExisting
property to give developers precise control over how README files are handled. This addition supports common scenarios like always overwriting, only writing when files are missing, or preserving existing content:true
),'if-missing'
), orfalse
).These options aim to better support workflows where documentation is closely tied to source code, while also offering flexibility for varied project structures.
What is the current behaviour?
By default, the docs-readme output target preserves any manually-entered content in destination README files, but it does not offer flexible controls for different overwrite behaviours. This made it difficult to manage workflows where documentation is expected to be tightly coupled with source code, while also needing different customisation strategies for various parts of a project.
Link to relevant issues/PRs: #5648 #6248
What is the new behaviour?
This PR introduces documentation for the new
overwriteExisting
propertyon the
docs-readme
output target.The documentation includes:
overwriteExisting
configuration option.true
,false
, and'if-missing'
).stencil.config.ts
file.as the canonical source of truth for custom content.
Documentation
A documentation update has been made in stenciljs/site#1521.
Does this introduce a breaking change?
Testing
overwriteExisting
property ondocs-readme
as described in bug: docs-readme output target no longer copies full content to dir path #6248.Other information
See #6248 for a detailed explanation of the use case this PR is covering.