-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #82: Providing the motivation and how to use this guide #281
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,3 +39,5 @@ jspm_packages | |
| temp/ | ||
| playground/dist | ||
| playground/storybook-static | ||
|
|
||
| CLAUDE.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| This folder is a playground project for testing the code examples that can be found in the guide. They are all tested with the most recent supported version of TypeScript and third-party type-definitions (like `@types/react` or `@types/react-redux`) to ensure the examples are still working when new third-party type-definitions are released. | ||
|
|
||
| The playground app and the style guide are two different ways of browsing the same examples: | ||
|
|
||
| - `src/routes/home.tsx` renders the example `*.usage.tsx` files into the app home page. | ||
| - `styleguide/styleguide.config.js` organizes selected components and markdown docs into the Styleguidist site. | ||
|
|
||
| If the browser output looks different between those two views, that is expected. They share source files, but they assemble and present them differently. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| ### Styleguide | ||
|
|
||
| This style guide is a documentation view over the examples in `/playground/src`. | ||
|
|
||
| The sections and component list come from `playground/styleguide/styleguide.config.js`. | ||
| The rendered examples are loaded from the same component, markdown, and usage files that power the playground app, so this page may look different from `/playground/src/routes/home.tsx` while still using the same source material. | ||
|
|
||
| [⇦ back to guide](https://github.com/piotrwitek/react-redux-typescript-guide#table-of-contents) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| const test = require('node:test'); | ||
| const assert = require('node:assert/strict'); | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const readmePath = path.join(__dirname, '..', 'README.md'); | ||
| const readme = fs.readFileSync(readmePath, 'utf8'); | ||
|
|
||
| test('README explains what the guide is and is not', () => { | ||
| assert.match( | ||
| readme, | ||
| /### \*\*What This Guide Is\*\*/ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /This repository is a reference guide and recipe collection for using React, Redux, and TypeScript together\./ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /It is \*\*not\*\* a boilerplate, starter kit, or library that introduces its own replacement APIs for React\./ | ||
| ); | ||
| }); | ||
|
Comment on lines
+9
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test matches long, exact strings from the README, making it brittle to minor documentation changes (e.g., rephrasing or typo fixes). Consider using more resilient matches for key phrases or headers to improve maintainability. test('README explains what the guide is and is not', () => {
assert.match(readme, /### \*\*What This Guide Is\*\*/);
assert.match(readme, /reference guide and recipe collection/);
assert.match(readme, /not\*\* a boilerplate/);
}); |
||
|
|
||
| test('README gives beginners a reading path and clarifies the styleguide', () => { | ||
| assert.match( | ||
| readme, | ||
| /### \*\*How to Use This Guide\*\*/ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /Start with the \[Playground Project\]\(#playground-project\) to see where the examples live\./ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /### \*\*Understanding the Playground and Style Guide\*\*/ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /The Styleguidist demo is a separate view over the same source files\./ | ||
| ); | ||
| assert.match( | ||
| readme, | ||
| /It renders markdown docs and live examples from `playground\/src`, organized by `playground\/styleguide\/styleguide\.config\.js`\./ | ||
| ); | ||
| }); | ||
|
Comment on lines
+24
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matching exact sentences from the README is prone to failure upon minor edits. Using partial matches for essential keywords or structural elements (like headers) would be more robust. test('README gives beginners a reading path and clarifies the styleguide', () => {
assert.match(readme, /### \*\*How to Use This Guide\*\*/);
assert.match(readme, /Start with the \[Playground Project\]/);
assert.match(readme, /### \*\*Understanding the Playground and Style Guide\*\*/);
assert.match(readme, /Styleguidist demo is a separate view/);
assert.match(readme, /organized by `playground\/styleguide\/styleguide\.config\.js`/);
}); |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
doctocscript has been replaced with a log message, effectively disabling automatic Table of Contents generation. However, theREADME.mdandREADME_SOURCE.mdfiles still contain the<!-- START doctoc -->markers and instructions to rundoctocfor updates. This creates a contradiction for contributors. Additionally, thedoctocpackage remains indevDependencies. If manual maintenance is the goal, please remove the markers and the dependency. If not, consider restoring the script's functionality.