mockaton 8.26.0 → 8.27.0
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 +31 -8
- package/index.js +1 -2
- package/mockup.svg +1037 -0
- package/package.json +4 -4
- package/src/Dashboard.css +28 -15
- package/src/Dashboard.js +105 -37
package/README.md
CHANGED
|
@@ -55,9 +55,9 @@ Nonetheless, there’s a programmatic API, which is handy
|
|
|
55
55
|
for setting up tests (see **Commander API** section below).
|
|
56
56
|
|
|
57
57
|
<picture>
|
|
58
|
-
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
59
|
-
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
60
|
-
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.
|
|
58
|
+
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.vp810x768.light.gold.png">
|
|
59
|
+
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.vp810x768.dark.gold.png">
|
|
60
|
+
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.vp810x768.light.gold.png">
|
|
61
61
|
</picture>
|
|
62
62
|
|
|
63
63
|
|
|
@@ -116,20 +116,43 @@ They will be saved in your `config.mocksDir` following the filename convention.
|
|
|
116
116
|
|
|
117
117
|
<br/>
|
|
118
118
|
|
|
119
|
+
## Privacy and Security
|
|
120
|
+
- Zero dependencies (no runtime and no build packages).
|
|
121
|
+
- Does not write to disk. Except when you select ✅ **Save Mocks** for scraping mocks from a backend.
|
|
122
|
+
- Does not initiate network connections (no logs, no telemetry).
|
|
123
|
+
- Does not hijack your HTTP client.
|
|
124
|
+
- Auditable. Organized and small — under 4 KLoC (50% is UI and tests) with 92% code coverage.
|
|
125
|
+
|
|
119
126
|
|
|
120
127
|
## Basic Usage
|
|
121
|
-
|
|
122
|
-
Node.js, you can create a sample mock in the default mocks directory, which
|
|
123
|
-
is `./mockaton-mocks`. Then run it with `npx`, which installs it if needed.
|
|
128
|
+
Create a sample mock in the default mocks directory (`./mockaton-mocks`).
|
|
124
129
|
```sh
|
|
125
130
|
mkdir -p mockaton-mocks/api/
|
|
126
131
|
echo "[1,2,3]" > mockaton-mocks/api/foo.GET.200.json
|
|
132
|
+
```
|
|
127
133
|
|
|
134
|
+
Mockaton is a Node.js program, so you install and run it with:
|
|
135
|
+
```shell
|
|
128
136
|
npx mockaton --port 2345
|
|
129
137
|
```
|
|
130
138
|
|
|
139
|
+
Or, if you have a `package.json`
|
|
140
|
+
```shell
|
|
141
|
+
npm install mockaton --save-dev
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"scripts": {
|
|
147
|
+
"mockaton": "mockaton --port 2345"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
131
154
|
## CLI Options
|
|
132
|
-
CLI options override their counterparts in `mockaton.config.js`
|
|
155
|
+
The CLI options override their counterparts in `mockaton.config.js`
|
|
133
156
|
|
|
134
157
|
```txt
|
|
135
158
|
-c, --config <file> (default: ./mockaton.config.js)
|
|
@@ -147,7 +170,7 @@ CLI options override their counterparts in `mockaton.config.js`
|
|
|
147
170
|
|
|
148
171
|
|
|
149
172
|
## mockaton.config.js (Optional)
|
|
150
|
-
As an overview, these are the
|
|
173
|
+
As an overview, these are the defaults:
|
|
151
174
|
```js
|
|
152
175
|
import {
|
|
153
176
|
defineConfig,
|
package/index.js
CHANGED
|
@@ -2,9 +2,8 @@ export { Mockaton } from './src/Mockaton.js'
|
|
|
2
2
|
export { Commander } from './src/ApiCommander.js'
|
|
3
3
|
|
|
4
4
|
export { jwtCookie } from './src/utils/jwt.js'
|
|
5
|
-
export { openInBrowser } from './src/utils/openInBrowser.js'
|
|
6
5
|
export { jsToJsonPlugin } from './src/MockDispatcher.js'
|
|
7
|
-
export { parseJSON
|
|
6
|
+
export { parseJSON } from './src/utils/http-request.js'
|
|
8
7
|
|
|
9
8
|
/** @param {Partial<Config>} opts */
|
|
10
9
|
export const defineConfig = opts => opts
|