From 425eeb7eab1370b40a3118a77b35c2f2d21f8241 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Wed, 19 Jun 2024 13:03:45 -0400 Subject: [PATCH] Update peer dep and readme --- README.md | 15 +++++++++------ package.json | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bf356c0..7833e6b 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ Experimental [MirageJS](https://miragejs.com/) interceptor using [MSW](https://m ### Installation -Pick one depending on your package manager. Mirage `0.2.0-alpha.1+` and MSW `2.0.0+` are peer dependencies. +Pick one depending on your package manager. Mirage `0.2.0-alpha.3+` and MSW `2.0.0+` are peer dependencies. ```shell -npm i --save-dev mirage-msw mirage@^0.2.0-alpha.1 msw@^2 -pnpm i --save-dev mirage-msw mirage@^0.2.0-alpha.1 msw@^2 -yarn add --dev mirage-msw mirage@^0.2.0-alpha.1 msw@^2 +npm i --save-dev mirage-msw mirage@^0.2.0-alpha.3 msw@^2 +pnpm i --save-dev mirage-msw mirage@^0.2.0-alpha.3 msw@^2 +yarn add --dev mirage-msw mirage@^0.2.0-alpha.3 msw@^2 ``` Be sure to run [`msw init`](https://mswjs.io/docs/integrations/browser#copy-the-worker-script) as well, if you haven't previously. @@ -24,10 +24,13 @@ Wherever you are creating your miragejs server, set the interceptor: import MSWInterceptor from 'mirage-msw'; import { createServer } from 'miragejs'; -await createServer({ +const server = createServer({ interceptor: new MSWInterceptor(), // ... rest of your config }); + +// Important to wait for msw to start up before rendering your app +await server.start(); ``` This will cause msw to be used instead of the default interceptor, [pretender](https://github.com/pretenderjs/pretender). @@ -39,5 +42,5 @@ This is very early, experimental software. There are probably a lot of bugs, so Here are the known issues so far: - [x] MSW starts up asynchronously, whereas Mirage up to now has always been completely synchronous. We will probably need to make a breaking change to Mirage to make `createServer` an async function. (Added in mirage 0.2.0-alpha.1) -- [x] Currently no support for FormData requests. +- [ ] Currently no support for FormData requests. - [ ] Only works in the browser, same as pretender. But MSW does have an option for node.js, so we may be able to support that in the future. (https://github.com/miragejs/mirage-msw/issues/17) diff --git a/package.json b/package.json index cff0a46..53d0862 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "devDependencies": { "@tsconfig/recommended": "^1.0.2", - "miragejs": "^0.2.0-alpha.1", + "miragejs": "^0.2.0-alpha.3", "msw": "2.3.0", "prettier": "^3.0.1", "tsup": "^7.2.0", @@ -42,7 +42,7 @@ } }, "peerDependancies": { - "miragejs": ">=0.2.0-alpha.1", + "miragejs": ">=0.2.0-alpha.3", "msw": "^2.0.0" }, "author": "Brian Gantzler",