Skip to content

Commit

Permalink
feat: migrate from node-fetch to native fetch (#1848)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky authored Jan 30, 2025
1 parent 9ff3159 commit 233f6a8
Show file tree
Hide file tree
Showing 19 changed files with 316 additions and 213 deletions.
6 changes: 6 additions & 0 deletions .changeset/warm-tips-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@redocly/openapi-core": minor
"@redocly/cli": minor
---

Switched to using native `fetch` API instead of `node-fetch` dependency, improving performance and reducing bundle size.
80 changes: 42 additions & 38 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
node-version: 18
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redoc redocly-cli.tgz" "npm run"

run-smoke--npm--node-16:
run-smoke--yarn--node-22:
needs: prepare-smoke
runs-on: ubuntu-latest
steps:
Expand All @@ -114,10 +114,10 @@ jobs:
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 16
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
node-version: 22
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

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

run-smoke--npm--node-14:
run-smoke--yarn--node-20:
needs: prepare-smoke
runs-on: ubuntu-latest
steps:
Expand All @@ -140,10 +140,10 @@ jobs:
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 14
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"
node-version: 20
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

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

run-smoke--yarn--node-22:
run-smoke--yarn--node-18:
needs: prepare-smoke
runs-on: ubuntu-latest
steps:
Expand All @@ -166,10 +166,10 @@ jobs:
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 22
node-version: 18
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

run-smoke--yarn--node-22--redoc:
run-smoke--yarn--node-18--redoc:
needs: prepare-smoke
runs-on: ubuntu-latest
steps:
Expand All @@ -179,10 +179,10 @@ jobs:
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 22
node-version: 18
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"

run-smoke--yarn--node-20:
run-smoke--webpack--node-22:
needs: prepare-smoke
runs-on: ubuntu-latest
steps:
Expand All @@ -192,64 +192,68 @@ jobs:
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 20
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"
node-version: 22
- run: |
cd __tests__/smoke/
node bundle.js --version
node bundle.js lint openapi.yaml --extends minimal
node bundle.js bundle openapi.yaml
run-smoke--yarn--node-20--redoc:
run-smoke--npm--node-22--windows:
needs: prepare-smoke
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 20
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
node-version: 22
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"

run-smoke--yarn--node-18:
run-smoke--yarn--node-22--windows:
needs: prepare-smoke
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

run-smoke--yarn--node-18--redoc:
run-smoke--npm--node-20--windows:
needs: prepare-smoke
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 18
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"
node-version: 20
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"

run-smoke--webpack--node-14:
run-smoke--yarn--node-20--windows:
needs: prepare-smoke
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 14
- run: |
cd __tests__/smoke/
node bundle.js --version
node bundle.js lint openapi.yaml --extends minimal
node bundle.js bundle openapi.yaml
node-version: 20
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

run-smoke--npm--node-18--windows:
needs: prepare-smoke
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Before submitting a pull request, please make sure the following is done:

## Development setup

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

After forking the repo, run:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Then you can use it as `redocly [command] [options]`, for example:
redocly lint path-to-root-file.yaml
```

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

### Docker

Expand Down
Loading

1 comment on commit 233f6a8

@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.63% 5052/6425
🟡 Branches 67.23% 2058/3061
🟡 Functions 73.16% 834/1140
🟡 Lines 78.92% 4766/6039

Test suite run success

835 tests passing in 120 suites.

Report generated by 🧪jest coverage report action from 233f6a8

Please sign in to comment.