whistle.mockbubu 1.0.0-dev.2 → 1.0.0-dev.3
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 +7 -29
- package/README_EN.md +60 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ $ w2 install whistle.mockbubu
|
|
|
13
13
|
|
|
14
14
|
### 配置 [whistle 规则](https://avwo.github.io/whistle/rules/)
|
|
15
15
|
|
|
16
|
-
> mode
|
|
16
|
+
> mode默认使用 pathname
|
|
17
17
|
|
|
18
18
|
```text
|
|
19
19
|
pattern mockbubu://[mode]
|
|
@@ -28,53 +28,31 @@ pattern mockbubu://[mode]
|
|
|
28
28
|
```text
|
|
29
29
|
pattern mockbubu:// 或者 pattern mockbubu://pathname
|
|
30
30
|
```
|
|
31
|
+
> 配置规则并开启插件后,mockbubu将实时获取匹配到的请求数据
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
#### href 模式:使用接口的 路径 作为文件名
|
|
35
|
-
|
|
36
|
-
```text
|
|
37
|
-
pattern mockbubu://href
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
#### pattern 模式:使用 pattern 作为文件名
|
|
44
|
-
|
|
45
|
-
```text
|
|
46
|
-
pattern mockbubu://pattern
|
|
47
|
-
```
|
|
33
|
+

|
|
48
34
|
|
|
49
35
|
---
|
|
50
36
|
|
|
51
37
|
### 开始 mock
|
|
52
38
|
|
|
53
|
-
第一步:开启文件的 mock
|
|
39
|
+
第一步:开启文件的 mock 开关,拦截到对应请求mockbubu将直接返回对应匹配请求的数据,开启mock开关后可在Response面板管理文件内容
|
|
54
40
|
|
|
55
|
-
```
|
|
56
|
-
文件名 resBody:{文件内容}
|
|
57
|
-
```
|
|
58
41
|
|
|
59
42
|
第二步:在 Response 面板管理文件内容
|
|
60
43
|
|
|
61
|
-
手动添加文件
|
|
62
|
-
|
|
63
|
-
- 如果需要提前生成 mock 文件,可手动添加(通常不需要手动添加,通过实时捕获接口即可生成 mock 文件)
|
|
64
|
-
|
|
65
44
|
编辑文件
|
|
66
45
|
|
|
67
46
|
- 支持文件编辑
|
|
47
|
+
- 支持快捷键保存 Mac: Command + s / Windows: Ctrl + s
|
|
68
48
|
|
|
69
49
|
多版本
|
|
70
50
|
|
|
71
|
-
-
|
|
51
|
+
- 支持新增不同版本的文件内容,点击切换不同版本即刻生效返回该版本数据
|
|
72
52
|
- 其中 source 版本是默认生成的,是原始接口响应数据,支持修改
|
|
73
53
|
|
|
74
54
|
切换 mock 文件
|
|
75
55
|
|
|
76
56
|
- mock 返回内容使用当前选中的版本
|
|
77
57
|
|
|
78
|
-

|
|
58
|
+

|
package/README_EN.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# whistle.mockbubu
|
|
2
|
+
|
|
3
|
+
whistle.mockbubu is an extension script plugin for [whistle](https://github.com/avwo/whistle) that provides the following features:
|
|
4
|
+
|
|
5
|
+
- Real-time generation of mock files from captured API responses
|
|
6
|
+
- Mock file management
|
|
7
|
+
|
|
8
|
+
# Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
$ w2 install whistle.mockbubu
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
# Usage
|
|
15
|
+
|
|
16
|
+
### Configure [whistle rules](https://avwo.github.io/whistle/rules/)
|
|
17
|
+
|
|
18
|
+
> Default mode uses pathname
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
pattern mockbubu://[mode]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Generate Mock Files
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
#### Pathname Mode: Uses the interface's origin + pathname as the filename
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
pattern mockbubu:// or pattern mockbubu://pathname
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> After configuring the rules and enabling the plugin, mockbubu will capture matching request data in real-time
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Start Mocking
|
|
41
|
+
|
|
42
|
+
**Step 1:** Enable the mock switch for the file. When mockbubu intercepts the corresponding request, it will directly return the matched request data. After enabling the mock switch, you can manage file content in the Response panel.
|
|
43
|
+
|
|
44
|
+
**Step 2:** Manage file content in the Response panel
|
|
45
|
+
|
|
46
|
+
**Edit Files**
|
|
47
|
+
|
|
48
|
+
- Supports file editing
|
|
49
|
+
- Supports keyboard shortcuts for saving: Mac: Command + S / Windows: Ctrl + S
|
|
50
|
+
|
|
51
|
+
**Multiple Versions**
|
|
52
|
+
|
|
53
|
+
- Supports creating different versions of file content. Click to switch between different versions for instant effect and return that version's data
|
|
54
|
+
- The "source" version is the default generated version containing the original API response data and supports modification
|
|
55
|
+
|
|
56
|
+
**Switch Mock Files**
|
|
57
|
+
|
|
58
|
+
- Mock return content uses the currently selected version
|
|
59
|
+
|
|
60
|
+

|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whistle.mockbubu",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.3",
|
|
4
4
|
"description": "mock response data",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint . --ext .js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
".gitignore",
|
|
26
26
|
"index.js",
|
|
27
27
|
"package.json",
|
|
28
|
-
"
|
|
28
|
+
"*.md",
|
|
29
29
|
"step1.png",
|
|
30
30
|
"step2.png"
|
|
31
31
|
],
|