From bfcbf25ceaf30eb066b7a571eed7d3a98b5edfa3 Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Wed, 28 Aug 2024 20:56:43 +0100 Subject: [PATCH 1/3] build: fix broken circleci config --- .circleci/config.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f1ec1db..92575c22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,12 +111,6 @@ workflows: fetch-mock-ci-cd: jobs: - checkout_code: *triggerable-by-tag - - test: - <<: *triggerable-by-tag - requires: - // because in the monorepo any package that requires another can - // only do so after build - - build - lint: <<: *triggerable-by-tag requires: @@ -125,6 +119,10 @@ workflows: <<: *triggerable-by-tag requires: - checkout_code + - test: + <<: *triggerable-by-tag + requires: + - build - typecheck: <<: *triggerable-by-tag <<: *after-build-lint From 66e4ffc5ff6f5ff2bba992c2dceb8150b282a5cf Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Wed, 28 Aug 2024 21:09:06 +0100 Subject: [PATCH 2/3] chore: order package.json properties more sensibly --- package.json | 2 +- packages/core/package.json | 56 ++++++++++++++++---------------- packages/fetch-mock/package.json | 56 ++++++++++++++++---------------- packages/vitest/package.json | 50 ++++++++++++++-------------- 4 files changed, 82 insertions(+), 82 deletions(-) diff --git a/package.json b/package.json index 4e2f7703..ca99dacc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fetch-mock-monorepo", - "version": "1.0.0", "description": "Mock http requests made using fetch (or isomorphic-fetch)", + "version": "1.0.0", "type": "module", "repository": { "type": "git", diff --git a/packages/core/package.json b/packages/core/package.json index e3b6827c..c7a48fe1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,19 +1,7 @@ { - "author": "Rhys Evans", - "bugs": { - "url": "https://github.com/wheresrhys/fetch-mock/issues" - }, - "dependencies": { - "@types/glob-to-regexp": "^0.4.4", - "dequal": "^2.0.3", - "glob-to-regexp": "^0.4.1", - "is-subset-of": "^3.1.10", - "regexparam": "^3.0.0" - }, + "name": "@fetch-mock/core", "description": "Mock http requests made using fetch", - "engines": { - "node": ">=18.0.0" - }, + "version": "0.6.1", "exports": { "browser": "./dist/esm/index.js", "import": { @@ -25,19 +13,20 @@ "types": "./dist/cjs/index.d.ts" } }, - "homepage": "https://github.com/wheresrhys/fetch-mock#readme", - "keywords": [ - "fetch", - "http", - "mock", - "testing", - "spy", - "stub" - ], - "license": "MIT", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", - "name": "@fetch-mock/core", + "types": "./dist/esm/index.d.ts", + "type": "module", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@types/glob-to-regexp": "^0.4.4", + "dequal": "^2.0.3", + "glob-to-regexp": "^0.4.1", + "is-subset-of": "^3.1.10", + "regexparam": "^3.0.0" + }, "repository": { "directory": "packages/core", "type": "git", @@ -46,7 +35,18 @@ "scripts": { "build": "rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node ../../scripts/declare-dist-type.js" }, - "type": "module", - "types": "./dist/esm/index.d.ts", - "version": "0.6.1" + "license": "MIT", + "author": "Rhys Evans", + "bugs": { + "url": "https://github.com/wheresrhys/fetch-mock/issues" + }, + "homepage": "http://www.wheresrhys.co.uk/fetch-mock", + "keywords": [ + "fetch", + "http", + "mock", + "testing", + "spy", + "stub" + ] } diff --git a/packages/fetch-mock/package.json b/packages/fetch-mock/package.json index 15aec0f6..0ea993e8 100644 --- a/packages/fetch-mock/package.json +++ b/packages/fetch-mock/package.json @@ -1,19 +1,7 @@ { - "author": "Rhys Evans", - "bugs": { - "url": "https://github.com/wheresrhys/fetch-mock/issues" - }, - "dependencies": { - "@types/glob-to-regexp": "^0.4.4", - "dequal": "^2.0.3", - "glob-to-regexp": "^0.4.1", - "is-subset": "^0.1.1", - "regexparam": "^3.0.0" - }, + "name": "fetch-mock", "description": "Mock http requests made using fetch", - "engines": { - "node": ">=8.0.0" - }, + "version": "11.1.2", "exports": { "browser": "./dist/esm/index.js", "import": { @@ -25,19 +13,20 @@ "types": "./dist/cjs/types/index.d.ts" } }, - "homepage": "http://www.wheresrhys.co.uk/fetch-mock", - "keywords": [ - "fetch", - "http", - "mock", - "testing", - "spy", - "stub" - ], - "license": "MIT", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", - "name": "fetch-mock", + "types": "./dist/esm/types/index.d.ts", + "type": "module", + "engines": { + "node": ">=8.0.0" + }, + "dependencies": { + "@types/glob-to-regexp": "^0.4.4", + "dequal": "^2.0.3", + "glob-to-regexp": "^0.4.1", + "is-subset": "^0.1.1", + "regexparam": "^3.0.0" + }, "peerDependenciesMeta": { "node-fetch": { "optional": true @@ -52,7 +41,18 @@ "build": "rm -rf dist && rollup -c --environment FORMAT:cjs && rollup -c --environment FORMAT:esm", "types:check": "tsd -t types/index.d.ts -f types/index.test-d.ts" }, - "type": "module", - "types": "./dist/esm/types/index.d.ts", - "version": "11.1.2" + "license": "MIT", + "author": "Rhys Evans", + "bugs": { + "url": "https://github.com/wheresrhys/fetch-mock/issues" + }, + "homepage": "http://www.wheresrhys.co.uk/fetch-mock", + "keywords": [ + "fetch", + "http", + "mock", + "testing", + "spy", + "stub" + ] } diff --git a/packages/vitest/package.json b/packages/vitest/package.json index e7cc21e6..b4247437 100644 --- a/packages/vitest/package.json +++ b/packages/vitest/package.json @@ -1,35 +1,23 @@ { - "author": "", - "bugs": { - "url": "https://github.com/wheresrhys/fetch-mock/issues" - }, - "dependencies": { - "@fetch-mock/core": "^0.6.0" - }, + "name": "@fetch-mock/vitest", "description": "Vitest wrapper for fetch-mock", - "engines": { - "node": ">=18.0.0" - }, + "version": "0.1.0", "exports": { "browser": "./src/index.js", "import": "./src/index.js", "require": "./dist/commonjs.js", "types": "./types/index.d.ts" }, - "homepage": "http://www.wheresrhys.co.uk/fetch-mock", - "keywords": [ - "fetch", - "http", - "mock", - "testing", - "spy", - "stub", - "vitest" - ], - "license": "ISC", "main": "./dist/commonjs.js", "module": "./src/index.js", - "name": "@fetch-mock/vitest", + "types": "./types/index.d.ts", + "type": "module", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@fetch-mock/core": "^0.6.0" + }, "repository": { "directory": "packages/vitest", "type": "git", @@ -38,7 +26,19 @@ "scripts": { "build": "rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node ../../scripts/declare-dist-type.js" }, - "type": "module", - "types": "./types/index.d.ts", - "version": "0.1.0" + "license": "MIT", + "author": "Rhys Evans", + "bugs": { + "url": "https://github.com/wheresrhys/fetch-mock/issues" + }, + "homepage": "http://www.wheresrhys.co.uk/fetch-mock", + "keywords": [ + "fetch", + "http", + "mock", + "testing", + "spy", + "stub", + "vitest" + ] } From 7510b21e811ebb74f8c43c97eb4433e1196fe75f Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Wed, 28 Aug 2024 21:11:29 +0100 Subject: [PATCH 3/3] test: fix types test for fetch-mock package --- packages/fetch-mock/types/index.test-d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fetch-mock/types/index.test-d.ts b/packages/fetch-mock/types/index.test-d.ts index aeb82460..d03e7790 100644 --- a/packages/fetch-mock/types/index.test-d.ts +++ b/packages/fetch-mock/types/index.test-d.ts @@ -113,7 +113,7 @@ lastUrl = fetchMock.lastUrl("http://test.com", "GET"); lastUrl = fetchMock.lastUrl("http://test.com", { method: "GET", }); -let lastOptions: (fetchMock.MockOptions|undefined) = fetchMock.lastOptions(); +let lastOptions: (RequestInit|undefined) = fetchMock.lastOptions(); lastOptions = fetchMock.lastOptions(true); lastOptions = fetchMock.lastOptions("http://test.com"); lastOptions = fetchMock.lastOptions(/https?:\/\/test.com/);