Custom readme data doesn't persist when using a custom `dir`
Stencil version:
@stencil/[email protected]
I'm submitting a:
[x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
Per the docs, setting a custom dir will generate readme files in a custom directory. Also per the docs:
Once you've generated a readme.md file you can customize it with your own markdown content. Simply add your own markdown above the comment that reads: .
However, when a custom dir is used, the entire readme file is replaced on subsequent builds, eliminating any custom markdown the user has added.
Expected behavior:
Custom markdown added above <!-- Auto Generated Below --> should persist.
Steps to reproduce:
- Create a stencil project using a custom
dirfor thedocs-readmeoutput target - Create a component and add some custom text above
<!-- Auto Generated Below -->in the readme - Rebuild the proect
- The readme is overwritten, erasing the custom text
Related code:
// stencil.config.ts
{
type: 'docs-readme',
dir: __dirname + '/docs'
}
Other information:
Important I discovered that if you keep a copy of the readme file in its original directory, the index of <!-- Auto Generated Below --> will be used to truncate the readme in the custom directory.
Thus, it seems as though the bug may be as simple as the custom directory not being considered when evaluating the existing readme file.
This issue was previously brought up in https://github.com/ionic-team/stencil/issues/2108 by @asifahmedfw, but I don't think the issue was fully understood.
I'm trying to narrow this down. It looks like the offending lines are here:
https://github.com/ionic-team/stencil/blob/184da80d039ff53a54e7ba0269cfa2b6d8d7998e/src/compiler/docs/generate-doc-data.ts#L22-L24
When reading the existing readme file, the path is always the same as the component file.
Our team is running in to this issue as well and look forward to seeing this resolved.
@claviska @elizabethsjudd Sorry you ran into this problem and that this issue has sat unanswered for so long!
I quickly tested out the listed reproduction steps with the latest version on Stencil and wasn't experiencing the overwrite issue you had run into. If either of you are still running into this with a recent version, please update the issue with a minimum reproduction and we can get it into our backlog from there. Otherwise, feel free to close this out or our team will in the near future if we don't hear back! Sorry again, but hopefully this is no longer a problem!
Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.
Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.
For a guide on how to create a good reproduction, see our Contributing Guide.
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.
Thank you for using Stencil!