Skip to content

Commit

Permalink
fix: build-docs failure with React 19 (#1892)
Browse files Browse the repository at this point in the history
* fix: build-docs failure with React 19

* Apply suggestions from code review

---------

Co-authored-by: Jacek Łękawa <[email protected]>
  • Loading branch information
tatomyr and JLekawa authored Feb 7, 2025
1 parent 4e5ef2b commit f77f19b
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 825 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-windows-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---

Fixed an issue where the `build-docs` command failed when React 19 was installed in the project folder.
4 changes: 2 additions & 2 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ jobs:
docker run --rm -v $PWD:/spec redocly/cli:latest bundle openapi.yaml --ext json
docker run --rm -v $PWD:/spec redocly/cli:latest build-docs openapi.yaml
# Check for broken styles (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
if [[ "$(wc -l redoc-static.html)" == "300 redoc-static.html" ]]; then
if [[ "$(wc -l redoc-static.html)" == "324 redoc-static.html" ]]; then
echo "Docs built correctly."
else
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 300 lines in redoc-static.html)."
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 324 lines in redoc-static.html)."
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`E2E build-docs build docs with config option 1`] = `
Found nested/redocly.yaml and using theme.openapi options
Prerendering docs
🎉 bundled successfully in: nested/redoc-static.html (33 KiB) [⏱ <test>ms].
🎉 bundled successfully in: nested/redoc-static.html (36 KiB) [⏱ <test>ms].
`;
2 changes: 1 addition & 1 deletion __tests__/build-docs/simple-build-docs/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`E2E build-docs simple build-docs 1`] = `
Found undefined and using theme.openapi options
Prerendering docs
🎉 bundled successfully in: redoc-static.html (324 KiB) [⏱ <test>ms].
🎉 bundled successfully in: redoc-static.html (330 KiB) [⏱ <test>ms].
`;
2 changes: 1 addition & 1 deletion __tests__/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ describe('E2E', () => {
(<any>expect(cleanupOutput(result))).toMatchSpecificSnapshot(join(testPath, 'snapshot.js'));

expect(fs.existsSync(join(testPath, 'nested/redoc-static.html'))).toEqual(true);
expect(fs.statSync(join(testPath, 'nested/redoc-static.html')).size).toEqual(32952);
expect(fs.statSync(join(testPath, 'nested/redoc-static.html')).size).toEqual(36237);
});
});

Expand Down
4 changes: 2 additions & 2 deletions __tests__/smoke/run-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ $2 redocly-lint
$2 redocly-bundle
$2 redocly-build-docs
# Check for broken styles (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
if [[ "$(wc -l redoc-static.html)" == "300 redoc-static.html" ]]; then
if [[ "$(wc -l redoc-static.html)" == "324 redoc-static.html" ]]; then
echo "Docs built correctly."
else
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 300 lines in redoc-static.html)."
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 324 lines in redoc-static.html)."
exit 1
fi
Loading

1 comment on commit f77f19b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.6% 5053/6429
🟡 Branches 67.18% 2059/3065
🟡 Functions 73.16% 834/1140
🟡 Lines 78.88% 4767/6043

Test suite run success

836 tests passing in 120 suites.

Report generated by 🧪jest coverage report action from f77f19b

Please sign in to comment.