-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR #1116 broke simple getExampleFilename customisation #1338
Comments
I don't remember why it was removed ;-) But we have a similar condition here:
so probably adding it back won't break anything. Feel free to send a PR with a fix. |
The code fix itself is pretty simple and I can do that, but updating the |
Historically we use real files in tests instead of mocking the file system. It's not ideal and I did mocking with https://github.com/streamich/memfs on another project. So both would be fine. |
If file is not exist in fs we have errors during the build. In this case we should continue to use default example file iss: styleguidist#1338
## New features ### Support React Hooks in examples You can now use hooks in the examples, like the `useState` hook: ```jsx const [count, setCount] = React.useState(42); <Button onClick={() => setCount(count + 1)}>{count}</Button> ``` (#1353 by @eragon512) ## Bug fixes * Accessibility fixes ([#1359](#1359) by @J-Kallunki) * `getExampleFilename` should use default example if file does not exist ([#1362](#1362)) by @mendrew, closes [#1338](#1338) * Hide HTML comments in Markdown files ([#1347](#1347) by @eragon512, closes #1326)
🎉 This issue has been resolved in version 9.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Current behavior
Previously, the documented
getExampleFilename
configuration allowed for just returning the path to where an examples file was expected to be found, but following #1116 a custom function now needs to returnfalse
ornull
if the file does not exist, because thefs.existsSync()
check was removed fromgetExamples()
.This change was not documented.
To reproduce
See example: https://github.com/eemeli/styleguidist-example/commits/get-examples
If you clone that repo,
npm install && npm start
from that branch will give you something like these errors:Expected behavior
Applying the changes of commit
882f8ee
worked on previous versions of react-styleguidist. They should still work.To fix, there are really two options here:
getExamples()
.The text was updated successfully, but these errors were encountered: