From f7997bf3a57bde193a092f673538cb332ead8305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:18:42 -0500 Subject: [PATCH 01/12] fix: github actions was checking out the wrong ref --- .github/workflows/checks.yml | 2 ++ .github/workflows/pr.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6dc5a19f..dc213a93 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,6 +13,8 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.sha }} - uses: actions/cache@v3 with: path: ~/.npm # this is cache where npm installs from before going out to the network diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 464d1729..d8c0e418 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -29,6 +29,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Cache node_modules id: cacheModules uses: actions/cache@v3 From 4bc910e1e9194e406122e883931fc74e14e06999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:17:56 -0500 Subject: [PATCH 02/12] chore: set up workflow inputs --- .github/workflows/branch.yml | 2 ++ .github/workflows/checks.yml | 17 +++++++++++++++-- .github/workflows/pr.yml | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 67b2d0ae..e9109ea7 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -31,6 +31,8 @@ jobs: name: Check needs: [install] uses: ./.github/workflows/checks.yml + with: + ref: ${{ github.sha }} # The security job can't run on pull requests opened from forks because # Github doesn't pass down the SNYK_TOKEN environment variable. diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index dc213a93..f7405585 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,6 +1,13 @@ name: v4.x checks -on: [workflow_call] +on: + workflow_call: + inputs: + ref: + description: 'The commit the workflow should check out' + required: true + default: ${{ github.sha }} + type: string jobs: test-node: @@ -14,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - ref: ${{ github.sha }} + ref: ${{ inputs.ref }} - uses: actions/cache@v3 with: path: ~/.npm # this is cache where npm installs from before going out to the network @@ -31,6 +38,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} - uses: actions/cache@v3 with: path: ~/.npm # this is cache where npm installs from before going out to the network @@ -47,6 +56,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} - uses: actions/cache@v3 with: path: ~/.npm # this is cache where npm installs from before going out to the network @@ -59,6 +70,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} - uses: actions/cache@v3 with: path: ~/.npm # this is cache where npm installs from before going out to the network diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d8c0e418..a3bd10f7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -45,3 +45,5 @@ jobs: name: Checks needs: [install] uses: ./.github/workflows/checks.yml + with: + ref: ${{ github.event.pull_request.head.sha }} From 67e778fe64741acfdf3de37c0354dd8fa429f167 Mon Sep 17 00:00:00 2001 From: Leonardo Quixada <195494+lquixada@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:11:12 -0500 Subject: [PATCH 03/12] chore: switched minifier from @rollup/plugin-terser to rollup-plugin-esbuild (#195) * fix: github actions was checking out the wrong ref * chore: switched minifier from @roll-up/plugin-terser to rollup-plugin-esbuild-minify * chore: chore: switched minifier from @roll-up/plugin-terser to rollup-plugin-esbuild --- package.json | 3 ++- rollup.config.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 30f06907..c88009b7 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "devDependencies": { "@commitlint/cli": "17.6.6", "@commitlint/config-conventional": "17.6.6", - "@rollup/plugin-terser": "0.4.3", "@types/chai": "4.3.5", "@types/mocha": "10.0.1", "@types/node": "18.15.13", @@ -92,6 +91,8 @@ "rimraf": "5.0.1", "rollup": "3.26.0", "rollup-plugin-copy": "3.4.0", + "rollup-plugin-esbuild": "6.1.1", + "rollup-plugin-esbuild-minify": "1.1.2", "semver": "7.5.3", "serve-index": "1.9.1", "standard": "17.1.0", diff --git a/rollup.config.js b/rollup.config.js index dfd00e5d..0958bd28 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,7 @@ /* Rollup creates the browser version of the polyfill and ponyfill. */ import path from 'path' import copy from 'rollup-plugin-copy' -import terser from '@rollup/plugin-terser' +import { minify } from 'rollup-plugin-esbuild' const input = path.join(__dirname, 'node_modules', 'whatwg-fetch', 'fetch.js') @@ -128,7 +128,7 @@ export default [ `) }, plugins: [ - terser() + minify() ] } ] From 2a20dbff81c7ced378ab66d5144edd6bcec795d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:15:59 -0500 Subject: [PATCH 04/12] chore: updated actions/checkout and actions/cache to v4 --- .github/workflows/branch.yml | 8 ++++---- .github/workflows/checks.yml | 16 ++++++++-------- .github/workflows/pr.yml | 4 ++-- .github/workflows/release.yml | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index e9109ea7..6b043ec8 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -10,10 +10,10 @@ jobs: name: Install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache node_modules id: cacheModules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -41,8 +41,8 @@ jobs: needs: [install] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index f7405585..d258c411 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -19,10 +19,10 @@ jobs: node-version: [14.x, 16.x, 18.x, 20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -37,10 +37,10 @@ jobs: name: Browser Test Specs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -55,10 +55,10 @@ jobs: name: Code Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -69,10 +69,10 @@ jobs: name: Types runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a3bd10f7..5822a9ba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -28,12 +28,12 @@ jobs: name: Install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - name: Cache node_modules id: cacheModules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c064dba8..d3ae55d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,10 +16,10 @@ jobs: name: Install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache node_modules id: cacheModules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.npm # cache where "npm install" uses before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -45,8 +45,8 @@ jobs: needs: [install] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: ~/.npm # cache where "npm install" uses before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} @@ -60,13 +60,13 @@ jobs: runs-on: ubuntu-latest needs: [checks, security] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' # Setup .npmrc file to publish to npm registry-url: 'https://registry.npmjs.org' - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} From 2ec3f7de734fb9995487f8f33327ff76231fed70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Wed, 11 Dec 2024 20:27:33 -0500 Subject: [PATCH 05/12] chore: updated action/setup-node to v4 and hmarr/debug-action to v3 --- .github/workflows/branch.yml | 2 +- .github/workflows/checks.yml | 4 ++-- .github/workflows/pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 6b043ec8..d1ff7881 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -25,7 +25,7 @@ jobs: name: Debug runs-on: ubuntu-latest steps: - - uses: hmarr/debug-action@v2 + - uses: hmarr/debug-action@v3 checks: name: Check diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d258c411..932d476a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -27,7 +27,7 @@ jobs: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm install --prefer-offline @@ -45,7 +45,7 @@ jobs: path: ~/.npm # this is cache where npm installs from before going out to the network key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm install --prefer-offline diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5822a9ba..d0a72612 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,7 +22,7 @@ jobs: name: Debug runs-on: ubuntu-latest steps: - - uses: hmarr/debug-action@v2 + - uses: hmarr/debug-action@v3 install: name: Install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3ae55d1..5333a3a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: name: Debug runs-on: ubuntu-latest steps: - - uses: hmarr/debug-action@v2 + - uses: hmarr/debug-action@v3 checks: name: Check @@ -61,7 +61,7 @@ jobs: needs: [checks, security] steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' # Setup .npmrc file to publish to npm From 086f8c2a4331d43b2238919be24b4e9d117a6bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Thu, 12 Dec 2024 06:11:26 -0500 Subject: [PATCH 06/12] chore: changed default node version to 20 --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 8351c193..209e3ef4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14 +20 From de5cd7f1489f33a8c6f24cedb0f629e852d6f430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:47:24 -0500 Subject: [PATCH 07/12] chore: added tests for node 22 --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 932d476a..812c1c27 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [14.x, 16.x, 18.x, 20.x] + node-version: [14.x, 16.x, 18.x, 20.x, 22.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v4 From c376265d256eca4ad8f6620c0577ffcd1b8531ce Mon Sep 17 00:00:00 2001 From: Leonardo Quixada <195494+lquixada@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:13:36 -0500 Subject: [PATCH 08/12] chore: updated node-fetch to 2.7.0 (#192) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c88009b7..0d590710 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "url": "https://github.com/lquixada/cross-fetch/issues" }, "dependencies": { - "node-fetch": "^2.6.12" + "node-fetch": "^2.7.0" }, "devDependencies": { "@commitlint/cli": "17.6.6", From 0ac3ff728e7057ade8a3b8b98251c71bc0ba2395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:13:53 -0500 Subject: [PATCH 09/12] refactor: improved make targets output --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c0ca39e5..5cc35fd3 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,13 @@ all: test lint typecheck .PHONY: clean clean: + @echo "" + @echo "=> cleaning dependencies and builds..." @rm -Rf node_modules dist .PHONY: commit commit: - npx cz + @npx cz .PHONY: publish publish: @@ -29,7 +31,9 @@ server: # Builds node_modules: package.json - npm install && /usr/bin/touch node_modules + @echo "" + @echo "=> installing dependencies..." + @npm install && /usr/bin/touch node_modules dist: package.json rollup.config.js $(wildcard src/*.js) node_modules @echo "" @@ -47,11 +51,15 @@ test/fetch-api/api.spec.js: test/fetch-api/api.spec.ts .PHONY: commitlint commitlint: node_modules - npx commitlint --from origin/main --to HEAD --verbose + @echo "" + @echo "=> linting commits..." + @npx commitlint --from origin/main --to HEAD --verbose .PHONY: cov cov: - npx nyc report --reporter=text-lcov > .reports/coverage.lcov && npx codecov + @echo "" + @echo "=> checking code coverage..." + @npx nyc report --reporter=text-lcov > .reports/coverage.lcov && npx codecov .PHONY: lint lint: From 5518a175f9db7f3bb99af1c9264b13abf2d61c79 Mon Sep 17 00:00:00 2001 From: Leonardo Quixada <195494+lquixada@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:35:07 -0500 Subject: [PATCH 10/12] chore: updated whatwg-fetch to 3.6.20 (#197) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d590710..2392b797 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "typescript": "5.1.6", "webpack": "5.88.1", "webpack-cli": "5.1.4", - "whatwg-fetch": "3.6.2", + "whatwg-fetch": "3.6.20", "yargs": "17.7.2" }, "files": [ From 84b25657f1dc8f1affc4625a0f7faceb196da36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:14:40 -0500 Subject: [PATCH 11/12] refactor: updated rollup and plugins --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2392b797..9a094c4d 100644 --- a/package.json +++ b/package.json @@ -89,10 +89,10 @@ "nock": "13.3.1", "nyc": "15.1.0", "rimraf": "5.0.1", - "rollup": "3.26.0", - "rollup-plugin-copy": "3.4.0", + "rollup": "4.28.1", + "rollup-plugin-copy": "3.5.0", "rollup-plugin-esbuild": "6.1.1", - "rollup-plugin-esbuild-minify": "1.1.2", + "rollup-plugin-esbuild-minify": "1.2.0", "semver": "7.5.3", "serve-index": "1.9.1", "standard": "17.1.0", From 857212a0e7799c1f67c879754a09267ba9f0377f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Quixada=CC=81?= <195494+lquixada@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:18:59 -0500 Subject: [PATCH 12/12] refactor: updated patches --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9a094c4d..0641974d 100644 --- a/package.json +++ b/package.json @@ -74,12 +74,12 @@ "@commitlint/cli": "17.6.6", "@commitlint/config-conventional": "17.6.6", "@types/chai": "4.3.5", - "@types/mocha": "10.0.1", + "@types/mocha": "10.0.10", "@types/node": "18.15.13", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "chai": "4.3.7", "codecov": "3.8.3", - "commitizen": "4.3.0", + "commitizen": "4.3.1", "cz-conventional-changelog": "3.3.0", "express": "4.18.2", "husky": "8.0.3", @@ -95,7 +95,7 @@ "rollup-plugin-esbuild-minify": "1.2.0", "semver": "7.5.3", "serve-index": "1.9.1", - "standard": "17.1.0", + "standard": "17.1.2", "standard-version": "9.5.0", "typescript": "5.1.6", "webpack": "5.88.1",