Skip to content

Commit 4bfde6e

Browse files
authored
Fix: process is undefined error (#178)
1 parent 692c5ba commit 4bfde6e

File tree

10 files changed

+1745
-1719
lines changed

10 files changed

+1745
-1719
lines changed

.changeset/tasty-lions-glow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'docusaurus-theme-redoc': patch
3+
---
4+
5+
Add back node-polyfill to fix client errors

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
1414
"lint:fix": "yarn lint --fix",
1515
"release": "yarn build:packages && changeset publish --no-git-tag",
16-
"start": "yarn build && yarn workspace redocusaurus-website run start",
16+
"serve": "yarn workspace redocusaurus-website run serve",
17+
"start": "yarn build:packages && yarn workspace redocusaurus-website run start",
1718
"test": "echo \"Error: no test specified\" && exit 1",
1819
"version": "changeset version && yarn install --no-immutable && sh scripts/combine-changelog.sh",
1920
"prepare": "husky install"
@@ -36,11 +37,11 @@
3637
},
3738
"homepage": "https://github.com/rohit-gohri/redocusaurus#readme",
3839
"devDependencies": {
39-
"@changesets/changelog-github": "^0.4.3",
40-
"@changesets/cli": "^2.21.1",
40+
"@changesets/changelog-github": "^0.4.4",
41+
"@changesets/cli": "^2.22.0",
4142
"@typescript-eslint/eslint-plugin": "^5.14.0",
4243
"@typescript-eslint/parser": "^5.14.0",
43-
"concurrently": "^7.0.0",
44+
"concurrently": "^7.1.0",
4445
"eslint": "^8.11.0",
4546
"eslint-config-airbnb-typescript": "^16.1.1",
4647
"eslint-config-prettier": "^8.5.0",
@@ -52,7 +53,7 @@
5253
"husky": "^7.0.4",
5354
"lint-staged": "^12.3.5",
5455
"prettier": "2.5.1",
55-
"typescript": "^4.6.2"
56+
"typescript": "^4.6.4"
5657
},
5758
"engines": {
5859
"node": ">=14"

packages/docusaurus-plugin-redoc/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
"src"
2020
],
2121
"keywords": [
22-
"redoc",
23-
"api-doc",
2422
"docusaurus",
2523
"docusaurus-plugin"
2624
],

packages/docusaurus-theme-redoc/package.json

+7-10
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
"url": "git+https://github.com/rohit-gohri/redocusaurus.git"
2323
},
2424
"keywords": [
25-
"redoc",
26-
"api-doc",
2725
"docusaurus",
2826
"docusaurus-theme"
2927
],
@@ -39,21 +37,20 @@
3937
"clsx": "^1.1.1",
4038
"copyfiles": "^2.4.1",
4139
"lodash": "^4.17.21",
42-
"mobx": "^6.3.13",
40+
"mobx": "^6.5.0",
4341
"redoc": "2.0.0-rc.69",
44-
"styled-components": "^5.3.3",
45-
"to-arraybuffer": "^1.0.1"
42+
"styled-components": "^5.3.5"
4643
},
4744
"devDependencies": {
4845
"@docusaurus/module-type-aliases": "^2.0.0-beta.20",
4946
"@docusaurus/theme-classic": "^2.0.0-beta.20",
50-
"@types/lodash": "^4.14.179",
51-
"@types/react-dom": "^17.0.13",
47+
"@types/lodash": "^4.14.182",
48+
"@types/react-dom": "^17.0.17",
5249
"@types/react-router-dom": "^5.3.3",
53-
"@types/rtlcss": "^3.1.2",
54-
"@types/styled-components": "^5.1.24",
50+
"@types/rtlcss": "^3.1.4",
51+
"@types/styled-components": "^5.1.25",
5552
"nodemon": "^2.0.15",
56-
"typescript": "^4.6.2"
53+
"typescript": "^4.6.4"
5754
},
5855
"engines": {
5956
"node": ">=14"

packages/docusaurus-theme-redoc/src/index.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@ export default function redocTheme(
1616
name: 'docusaurus-theme-redoc',
1717
configureWebpack(_config, isServer) {
1818
return {
19-
resolve: {
20-
fallback: {
21-
tty: false,
22-
},
23-
},
2419
plugins: [
20+
new webpack.NormalModuleReplacementPlugin(
21+
/^tty$/,
22+
require.resolve('./tty'),
23+
),
2524
new webpack.DefinePlugin({
2625
'process.versions.node': JSON.stringify(
2726
process.versions.node || '0.0.0',
2827
),
28+
'process.platform': JSON.stringify(''),
29+
'process.env': JSON.stringify({}),
2930
}),
30-
new webpack.NormalModuleReplacementPlugin(
31-
/^redoc$/,
32-
require.resolve('redoc/bundles/redoc.browser.lib'),
33-
),
3431
...(isServer
3532
? [
3633
new webpack.NormalModuleReplacementPlugin(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const isatty = () => false;

packages/redocusaurus/Readme.md

+67-51
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Redocusaurus](https://github.com/rohit-gohri/redocusaurus)
1+
# [Redocusaurus](https://redocusaurus.vercel.app/)
22

33
![npm](https://img.shields.io/npm/v/redocusaurus?style=flat-square)
44

@@ -8,69 +8,85 @@
88

99
1. Install redocusaurus:
1010

11-
```sh
12-
npm i --save redocusaurus
13-
```
11+
```sh
12+
npm i --save redocusaurus
13+
# OR
14+
yarn add redocusaurus
15+
```
1416

1517
1. Add it as a preset to your docusaurus config and pass options:
1618

1719
- Pass it a path to a local OpenAPI YAML file
1820

19-
```js
20-
// docusaurus.config.js
21-
22-
module.exports = {
23-
// ...
24-
presets: [
25-
[
26-
'redocusaurus',
27-
{
28-
specs: [
29-
{
30-
spec: 'openapi.yaml',
31-
},
32-
],
33-
},
34-
],
35-
],
36-
// ...
37-
};
38-
```
39-
40-
- Pass it a OpenAPI spec URL
41-
42-
```js
43-
// docusaurus.config.js
44-
45-
module.exports = {
46-
// ...
47-
presets: [
48-
[
49-
'redocusaurus',
50-
{
51-
specs: [
52-
{
53-
spec: 'https://redocly.github.io/redoc/openapi.yaml',
54-
},
55-
],
56-
},
57-
],
58-
],
59-
// ...
60-
};
61-
```
62-
63-
The API Doc will be available by default at `/api/` path. To customize it see [full plugin options](../docusaurus-plugin-redoc/Readme.md).
21+
```js
22+
// docusaurus.config.js
23+
24+
module.exports = {
25+
// ...
26+
presets: [
27+
[
28+
'redocusaurus',
29+
{
30+
// Plugin Options for loading OpenAPI files
31+
specs: [
32+
{
33+
spec: 'openapi/openapi.yaml',
34+
route: '/api/',
35+
},
36+
],
37+
// Theme Options for modifying how redoc renders them
38+
theme: {
39+
// Change with your site colors
40+
primaryColor: '#1890ff',
41+
},
42+
},
43+
],
44+
],
45+
// ...
46+
};
47+
```
48+
49+
- OR Pass it a OpenAPI spec URL
50+
51+
```js
52+
// docusaurus.config.js
53+
54+
module.exports = {
55+
// ...
56+
presets: [
57+
[
58+
'redocusaurus',
59+
{
60+
// Plugin Options for loading OpenAPI files
61+
specs: [
62+
{
63+
spec: 'https://redocly.github.io/redoc/openapi.yaml',
64+
route: '/api/',
65+
},
66+
],
67+
// Theme Options for modifying how redoc renders them
68+
theme: {
69+
// Change with your site colors
70+
primaryColor: '#1890ff',
71+
},
72+
},
73+
],
74+
],
75+
// ...
76+
};
77+
```
78+
79+
The API Doc will be available at the route specified (`/api/` in the example above). To customize it see [full plugin options](https://redocusaurus.vercel.app/docs/getting-started/plugin-options).
6480

6581
### Options
6682

6783
#### specs
6884

69-
Pass it an array of plugin options, see [docusaurus-plugin-redoc](../docusaurus-plugin-redoc/Readme.md) for individual option details.
85+
Pass it an array of plugin options, see [docusaurus-plugin-redoc](https://redocusaurus.vercel.app/docs/getting-started/plugin-options) for individual option details.
7086

7187
#### theme
7288

73-
Pass options to customize the theme, see [docusaurus-theme-redoc](../docusaurus-theme-redoc/Readme.md) for individual option details.
89+
Pass options to customize the theme, see [docusaurus-theme-redoc](https://redocusaurus.vercel.app/docs/getting-started/theme-options) for individual option details.
7490

7591
## Docs
7692

packages/redocusaurus/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"keywords": [
2828
"redoc",
2929
"openapi",
30-
"documentations",
30+
"api",
31+
"swagger",
32+
"documentation",
3133
"api-doc",
3234
"docusaurus",
3335
"docusaurus-preset"

website/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"redocusaurus": "^1.0.3"
3131
},
3232
"devDependencies": {
33-
"@percy/cli": "^1.0.0-beta.76",
34-
"@types/react": "^17.0.39"
33+
"@percy/cli": "^1.1.4",
34+
"@types/react": "^17.0.45"
3535
},
3636
"browserslist": {
3737
"production": [

0 commit comments

Comments
 (0)