msw-dev-tool 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/package.json +2 -1
package/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Install
|
2
|
+
|
3
|
+
```bash
|
4
|
+
npm i msw-dev-tool --save-dev
|
5
|
+
```
|
6
|
+
|
7
|
+
## Peer Dep
|
8
|
+
|
9
|
+
These dependencies are assumed to already exist in your project.
|
10
|
+
If not, please install it.
|
11
|
+
|
12
|
+
```json
|
13
|
+
"react": "^18.0.0",
|
14
|
+
"react-dom": "^18.0.0",
|
15
|
+
"zustand": "^5.0.2",
|
16
|
+
"msw": "^2.7.0"
|
17
|
+
```
|
18
|
+
|
19
|
+
# Usage
|
20
|
+
|
21
|
+
## UI
|
22
|
+
|
23
|
+
```jsx
|
24
|
+
import { MSWDevTool } from "msw-dev-tool";
|
25
|
+
import "msw-dev-tool/msw-dev-tool.css"
|
26
|
+
|
27
|
+
function App() {
|
28
|
+
|
29
|
+
return (
|
30
|
+
<>
|
31
|
+
<MSWDevTool />
|
32
|
+
{/* ... */}
|
33
|
+
</>
|
34
|
+
);
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
## Integration with msw
|
39
|
+
|
40
|
+
```typescript
|
41
|
+
import { setupWorker } from "msw/browser";
|
42
|
+
import { handlers } from "./handlers";
|
43
|
+
import { initMSWDevTool } from "msw-dev-tool";
|
44
|
+
|
45
|
+
// Wrap worker init logic with `initMSWDevTool` middleware.
|
46
|
+
export const worker = initMSWDevTool(setupWorker(...handlers));
|
47
|
+
|
48
|
+
```
|
49
|
+
|
50
|
+
# Structure
|
51
|
+
|
52
|
+
This project uses pnpm workspaces.
|
53
|
+
|
54
|
+
| Project | Description |
|
55
|
+
| ---------------- | ----------------------------------------------------------------------------------------------------- |
|
56
|
+
| **example** | A sample project to develop and test `msw-dev-tool`. You need to build `msw-dev-tool` before testing. |
|
57
|
+
| **msw-dev-tool** | The source code of the library. |
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "msw-dev-tool",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.16",
|
4
4
|
"main": "dist/cjs/index.js",
|
5
5
|
"module": "dist/esm/index.js",
|
6
6
|
"types": "dist/types/index.d.ts",
|
@@ -9,6 +9,7 @@
|
|
9
9
|
"LICENSE",
|
10
10
|
"README.md"
|
11
11
|
],
|
12
|
+
"description": "msw-dev-tool is a powerful library that enhances the Mock Service Worker (MSW) experience in React by providing an intuitive UI to control mock logic dynamically. It allows developers to modify mock data, adjust response statuses, and monitor API requests in real-time, making API mocking and debugging more seamless and efficient. 🚀",
|
12
13
|
"exports": {
|
13
14
|
".": {
|
14
15
|
"types": "./dist/types/index.d.ts",
|