mockaton 11.1.3 → 11.1.4

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/Makefile CHANGED
@@ -1,10 +1,15 @@
1
- docker: docker-build docker-start
1
+ docker: docker-build docker-run
2
2
 
3
3
  docker-build:
4
- docker build -t mockaton .
4
+ @docker build --tag mockaton $(PWD)
5
5
 
6
- docker-start: docker-stop
7
- docker run --name mockaton -p 127.0.0.1:2020:2020 mockaton
6
+ docker-run: docker-stop
7
+ @docker run --name mockaton \
8
+ --publish 127.0.0.1:2020:2020 \
9
+ --volume $(PWD)/mockaton.config.js:/app/mockaton.config.js \
10
+ --volume $(PWD)/mockaton-mocks:/app/mockaton-mocks \
11
+ --volume $(PWD)/mockaton-static-mocks:/app/mockaton-static-mocks \
12
+ mockaton
8
13
 
9
14
  docker-stop:
10
15
  @docker stop mockaton >/dev/null 2>&1 || true
@@ -23,7 +28,7 @@ test:
23
28
 
24
29
  test-docker:
25
30
  @docker run --rm --interactive --tty \
26
- --volume .:/app \
31
+ --volume $(PWD):/app \
27
32
  --workdir /app \
28
33
  node:24 \
29
34
  make test
@@ -39,8 +44,10 @@ pixaton:
39
44
  --import=./pixaton-tests/_setup.js \
40
45
  'pixaton-tests/**/*.test.js'
41
46
 
47
+
42
48
  outdated:
43
49
  @npm outdated --parseable |\
44
50
  awk -F: '{ printf "npm i %-30s ;# %s\n", $$4, $$2 }'
45
51
 
52
+
46
53
  .PHONY: *
package/README.md CHANGED
@@ -14,12 +14,35 @@ With Mockaton, you don’t need to write code for wiring up your
14
14
  mocks. Instead, a given directory is scanned for filenames
15
15
  following a convention similar to the URLs.
16
16
 
17
- For example, for [/api/user/123](#), the filename could be:
17
+ For example, for [/api/company/123](#), the filename could be:
18
18
 
19
19
  <pre>
20
- <code>my-mocks-dir/<b>api/user</b>/[user-id].GET.200.json</code>
20
+ <code>my-mocks-dir/<b>api/company</b>/[company-id].GET.200.json</code>
21
21
  </pre>
22
22
 
23
+ <br/>
24
+
25
+
26
+ ## Quick Start (Docker)
27
+ This will spin up Mockaton with the mock directories included in this repo:
28
+ [mockaton-mocks/](./mockaton-mocks) and [mockaton-static-mocks/](./mockaton-static-mocks)
29
+ mounted on the container.
30
+
31
+ ```sh
32
+ git clone https://github.com/ericfortis/mockaton.git --depth 1
33
+ cd mockaton
34
+ make docker
35
+ ```
36
+ Dashboard: http://localhost:2020/mockaton
37
+
38
+
39
+ Test it:
40
+ ```shell
41
+ curl localhost:2020/api/user
42
+ ```
43
+
44
+
45
+ <br/>
23
46
 
24
47
  ## Dashboard
25
48
 
@@ -125,7 +148,6 @@ If you commit the mocks to your repo, you don’t have to downgrade backends whe
125
148
 
126
149
  <img src="./demo-app-vite/pixaton-tests/pic-for-readme.vp740x880.light.gold.png" alt="Mockaton Demo App Screenshot" width="740" />
127
150
 
128
- <br/>
129
151
 
130
152
  ### Standalone demo server (Docker)
131
153
  You can demo your app by compiling the frontend and putting
@@ -150,22 +172,6 @@ make start-standalone-demo
150
172
 
151
173
  <br/>
152
174
 
153
- ## Quick Start (Docker)
154
- This will spin up Mockaton with the mocks included in this repo:
155
- [mockaton-mocks/](./mockaton-mocks) and [mockaton-static-mocks/](./mockaton-static-mocks)
156
-
157
- ```sh
158
- git clone https://github.com/ericfortis/mockaton.git --depth 1
159
- make docker
160
- ```
161
- Dashboard: http://localhost:2020/mockaton
162
-
163
-
164
- Test it:
165
- ```shell
166
- curl localhost:2020/api/user
167
- ```
168
-
169
175
 
170
176
  ## Usage Without Docker
171
177
 
@@ -227,8 +233,6 @@ Mockaton looks for a file `mockaton.config.js` in its current working directory.
227
233
  <details>
228
234
  <summary>Defaults Overview… </summary>
229
235
 
230
- As an overview, these are the defaults:
231
-
232
236
  ```js
233
237
  import {
234
238
  defineConfig,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "HTTP Mock Server",
4
4
  "type": "module",
5
- "version": "11.1.3",
5
+ "version": "11.1.4",
6
6
  "types": "./index.d.ts",
7
7
  "exports": {
8
8
  ".": {
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "pixaton": "1.1.3",
30
- "puppeteer": "24.24.1"
30
+ "puppeteer": "24.29.1"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=22.18 <23 || >=23.6"
package/src/Dashboard.css CHANGED
@@ -610,10 +610,7 @@ table {
610
610
  > code {
611
611
  white-space: pre;
612
612
  tab-size: 2;
613
-
614
- > .json {
615
- color: var(--colorSecondaryAction);
616
- }
613
+ color: var(--colorSecondaryAction);
617
614
 
618
615
  .syntaxPunc {
619
616
  color: var(--colorSecondaryAction);
package/src/Dashboard.js CHANGED
@@ -36,7 +36,6 @@ const CSS = {
36
36
  rightSide: null,
37
37
  status4xx: null,
38
38
 
39
- json: null,
40
39
  syntaxAttr: null,
41
40
  syntaxAttrVal: null,
42
41
  syntaxKey: null,
@@ -649,8 +648,8 @@ async function updatePayloadViewer(proxied, file, response) {
649
648
  }))
650
649
  else {
651
650
  const body = await response.text() || t`/* Empty Response Body */`
652
- if (mime === 'application/json')
653
- payloadViewerCodeRef.elem.replaceChildren(r('span', className(CSS.json), SyntaxJSON(body)))
651
+ if (mime === 'application/json')
652
+ payloadViewerCodeRef.elem.replaceChildren(SyntaxJSON(body))
654
653
  else if (isXML(mime))
655
654
  payloadViewerCodeRef.elem.replaceChildren(SyntaxXML(body))
656
655
  else
@@ -755,9 +754,11 @@ function initRealTimeUpdates() {
755
754
  ErrorToast.close()
756
755
 
757
756
  const version = await response.json()
757
+ const shouldSkip = oldVersion === undefined
758
758
  if (oldVersion !== version) { // because it could be < or >
759
759
  oldVersion = version
760
- store.fetchState()
760
+ if (!shouldSkip)
761
+ store.fetchState()
761
762
  }
762
763
  longPoll()
763
764
  }