Skip to content

Commit

Permalink
Update peer dep and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Jun 19, 2024
1 parent 2887dae commit f17c271
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand All @@ -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)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -42,7 +42,7 @@
}
},
"peerDependancies": {
"miragejs": ">=0.2.0-alpha.1",
"miragejs": ">=0.2.0-alpha.3",
"msw": "^2.0.0"
},
"author": "Brian Gantzler",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f17c271

Please sign in to comment.