Skip to content

Commit 233f6a8

Browse files
feat: migrate from node-fetch to native fetch (#1848)
1 parent 9ff3159 commit 233f6a8

File tree

19 files changed

+316
-213
lines changed

19 files changed

+316
-213
lines changed

.changeset/warm-tips-sit.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@redocly/openapi-core": minor
3+
"@redocly/cli": minor
4+
---
5+
6+
Switched to using native `fetch` API instead of `node-fetch` dependency, improving performance and reducing bundle size.

.github/workflows/smoke.yaml

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
node-version: 18
105105
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redoc redocly-cli.tgz" "npm run"
106106

107-
run-smoke--npm--node-16:
107+
run-smoke--yarn--node-22:
108108
needs: prepare-smoke
109109
runs-on: ubuntu-latest
110110
steps:
@@ -114,10 +114,10 @@ jobs:
114114
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
115115
- uses: actions/setup-node@v3
116116
with:
117-
node-version: 16
118-
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
117+
node-version: 22
118+
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
119119

120-
run-smoke--npm--node-16--redoc:
120+
run-smoke--yarn--node-22--redoc:
121121
needs: prepare-smoke
122122
runs-on: ubuntu-latest
123123
steps:
@@ -127,10 +127,10 @@ jobs:
127127
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
128128
- uses: actions/setup-node@v3
129129
with:
130-
node-version: 16
131-
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redoc redocly-cli.tgz" "npm run"
130+
node-version: 22
131+
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
132132

133-
run-smoke--npm--node-14:
133+
run-smoke--yarn--node-20:
134134
needs: prepare-smoke
135135
runs-on: ubuntu-latest
136136
steps:
@@ -140,10 +140,10 @@ jobs:
140140
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
141141
- uses: actions/setup-node@v3
142142
with:
143-
node-version: 14
144-
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
143+
node-version: 20
144+
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
145145

146-
run-smoke--npm--node-14--redoc:
146+
run-smoke--yarn--node-20--redoc:
147147
needs: prepare-smoke
148148
runs-on: ubuntu-latest
149149
steps:
@@ -153,10 +153,10 @@ jobs:
153153
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
154154
- uses: actions/setup-node@v3
155155
with:
156-
node-version: 14
157-
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redoc redocly-cli.tgz" "npm run"
156+
node-version: 20
157+
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
158158

159-
run-smoke--yarn--node-22:
159+
run-smoke--yarn--node-18:
160160
needs: prepare-smoke
161161
runs-on: ubuntu-latest
162162
steps:
@@ -166,10 +166,10 @@ jobs:
166166
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
167167
- uses: actions/setup-node@v3
168168
with:
169-
node-version: 22
169+
node-version: 18
170170
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
171171

172-
run-smoke--yarn--node-22--redoc:
172+
run-smoke--yarn--node-18--redoc:
173173
needs: prepare-smoke
174174
runs-on: ubuntu-latest
175175
steps:
@@ -179,10 +179,10 @@ jobs:
179179
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
180180
- uses: actions/setup-node@v3
181181
with:
182-
node-version: 22
182+
node-version: 18
183183
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
184184

185-
run-smoke--yarn--node-20:
185+
run-smoke--webpack--node-22:
186186
needs: prepare-smoke
187187
runs-on: ubuntu-latest
188188
steps:
@@ -192,64 +192,68 @@ jobs:
192192
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
193193
- uses: actions/setup-node@v3
194194
with:
195-
node-version: 20
196-
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
195+
node-version: 22
196+
- run: |
197+
cd __tests__/smoke/
198+
node bundle.js --version
199+
node bundle.js lint openapi.yaml --extends minimal
200+
node bundle.js bundle openapi.yaml
197201
198-
run-smoke--yarn--node-20--redoc:
202+
run-smoke--npm--node-22--windows:
199203
needs: prepare-smoke
200-
runs-on: ubuntu-latest
204+
runs-on: windows-latest
201205
steps:
202206
- uses: actions/cache@v3
203207
with:
204208
path: __tests__/smoke/
205209
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
210+
enableCrossOsArchive: true
206211
- uses: actions/setup-node@v3
207212
with:
208-
node-version: 20
209-
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
213+
node-version: 22
214+
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
210215

211-
run-smoke--yarn--node-18:
216+
run-smoke--yarn--node-22--windows:
212217
needs: prepare-smoke
213-
runs-on: ubuntu-latest
218+
runs-on: windows-latest
214219
steps:
215220
- uses: actions/cache@v3
216221
with:
217222
path: __tests__/smoke/
218223
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
224+
enableCrossOsArchive: true
219225
- uses: actions/setup-node@v3
220226
with:
221-
node-version: 18
227+
node-version: 22
222228
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
223229

224-
run-smoke--yarn--node-18--redoc:
230+
run-smoke--npm--node-20--windows:
225231
needs: prepare-smoke
226-
runs-on: ubuntu-latest
232+
runs-on: windows-latest
227233
steps:
228234
- uses: actions/cache@v3
229235
with:
230236
path: __tests__/smoke/
231237
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
238+
enableCrossOsArchive: true
232239
- uses: actions/setup-node@v3
233240
with:
234-
node-version: 18
235-
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
241+
node-version: 20
242+
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
236243

237-
run-smoke--webpack--node-14:
244+
run-smoke--yarn--node-20--windows:
238245
needs: prepare-smoke
239-
runs-on: ubuntu-latest
246+
runs-on: windows-latest
240247
steps:
241248
- uses: actions/cache@v3
242249
with:
243250
path: __tests__/smoke/
244251
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
252+
enableCrossOsArchive: true
245253
- uses: actions/setup-node@v3
246254
with:
247-
node-version: 14
248-
- run: |
249-
cd __tests__/smoke/
250-
node bundle.js --version
251-
node bundle.js lint openapi.yaml --extends minimal
252-
node bundle.js bundle openapi.yaml
255+
node-version: 20
256+
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
253257

254258
run-smoke--npm--node-18--windows:
255259
needs: prepare-smoke

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Before submitting a pull request, please make sure the following is done:
3636

3737
## Development setup
3838

39-
[Node.js](http://nodejs.org) at v14.19.0+ and NPM v7.0.0+ are required.
39+
[Node.js](http://nodejs.org) at v18.17.0+ and NPM v10.8.2+ are required.
4040

4141
After forking the repo, run:
4242

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Then you can use it as `redocly [command] [options]`, for example:
2828
redocly lint path-to-root-file.yaml
2929
```
3030

31-
The minimum required versions of Node.js and NPM are 14.19.0 and 7.0.0 respectively.
31+
The minimum required versions of Node.js and NPM are 18.17.0 and 10.8.2 respectively.
3232

3333
### Docker
3434

0 commit comments

Comments
 (0)