# whistle.savefor-mock

> whistle plugin for saving mock data, then automatically generate rule to clipboard.

Latest version **1.1.0** (published 2021-08-10) · 4 weekly downloads

## Install

```sh
npm install whistle.savefor-mock
pnpm add whistle.savefor-mock
yarn add whistle.savefor-mock
bun add whistle.savefor-mock
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-08-10 |
| First published | 2021-08-05 |
| Weekly downloads | 4 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 102.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pilipala6868 |
| Keywords | whistle plugin, mock, generate rule |

## Links

- npm: https://www.npmjs.com/package/whistle.savefor-mock
- npm.io page: https://npm.io/package/whistle.savefor-mock

## Dependencies (9)

- [koa](https://npm.io/package/koa.md) ^2.7.0
- [zlib](https://npm.io/package/zlib.md) ^1.0.5
- [clipboardy](https://npm.io/package/clipboardy.md) ^2.3.0
- [koa-router](https://npm.io/package/koa-router.md) ^7.4.0
- [koa-static](https://npm.io/package/koa-static.md) ^5.0.0
- [koa-onerror](https://npm.io/package/koa-onerror.md) ^4.1.0
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^4.2.1
- [write-file-safe](https://npm.io/package/write-file-safe.md) ^1.3.1
- [write-json-safe](https://npm.io/package/write-json-safe.md) ^2.1.0

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [@precisa-saude/fhir-rnds-sandbox](https://npm.io/package/@precisa-saude/fhir-rnds-sandbox.md) — 0 weekly downloads
- [@codegrenade/naija-faker-mcp](https://npm.io/package/@codegrenade/naija-faker-mcp.md) — 0 weekly downloads
- [@hainaio/page-spy-plugin-ospy](https://npm.io/package/@hainaio/page-spy-plugin-ospy.md) — 0 weekly downloads
- [@hainaio/page-spy-browser](https://npm.io/package/@hainaio/page-spy-browser.md) — 0 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-08-10
- 1.0.0 — 2021-08-05

## README

# whistle.savefor-mock

### whistle 懒人插件
在需要新建mock数据时，自动保存 responseBody 到指定路径，并生成对应规则到剪切板

### 安装
#### whistle
请参考：[https://github.com/avwo/whistle#whistle](https://github.com/avwo/whistle#whistle)

#### whistle.savefor-mock
- `$ npm install -g whistle.savefor-mock`
- 在 Plugins 模块中开启插件

### 使用示例
![image](https://user-images.githubusercontent.com/25118028/128805193-dbe1e460-7793-49f9-919c-d0d4a3c0d8c1.gif)

- 接口：豆瓣 - 影视分类
- 找到接口 API 后，建立规则：`movie.douban.com/j/new_search_subjects savefor-mock://movie`
- 下一次刷新页面后，该接口数据便自动保存到 `默认路径/movie.json`（默认路径可配置）
- 可配置自动打开保存的文件，以立刻编辑 mock 数据（需先[配置 VS Code 环境变量](https://doc.zzax.io/t/vscode/setup/config-code-env/)）
- 此时还会自动生成代理规则，并拷贝到剪切板，形如：`**/j/new_search_subjects file://默认路径/movie.json`，粘贴到 `Rules` 后即可开始代理

### 配置面板
![image](https://user-images.githubusercontent.com/25118028/128805352-127801f3-d6cf-4878-b0d4-755d51b7c823.png)

---
_Source: https://npm.io/package/whistle.savefor-mock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
