mockaton 8.11.7 → 8.11.8
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 +2 -5
- package/package.json +2 -1
- package/src/config.js +1 -1
- package/src/utils/openInBrowser.js +10 -1
package/README.md
CHANGED
|
@@ -497,11 +497,8 @@ config.corsExposedHeaders = [] // headers you need to access in client-side JS
|
|
|
497
497
|
|
|
498
498
|
### `onReady?: (dashboardUrl: string) => void`
|
|
499
499
|
By default, it will open the dashboard in your default browser on macOS and
|
|
500
|
-
Windows. But for a more cross-platform utility
|
|
501
|
-
|
|
502
|
-
import open from 'open'
|
|
503
|
-
config.onReady = open
|
|
504
|
-
```
|
|
500
|
+
Windows. But for a more cross-platform utility you could `npm install open` and
|
|
501
|
+
Mockaton will use that implementation instead.
|
|
505
502
|
|
|
506
503
|
If you don’t want to open a browser, pass a noop:
|
|
507
504
|
```js
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mockaton",
|
|
3
3
|
"description": "A deterministic server-side for developing and testing frontend clients",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.11.
|
|
5
|
+
"version": "8.11.8",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"outdated": "npm outdated --parseable | awk -F: '{ printf \"npm i %-30s ;# %s\\n\", $4, $2 }'"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
+
"open": "^10.0.0",
|
|
18
19
|
"pixaton": ">=1.0.2",
|
|
19
20
|
"puppeteer": ">=24.1.1"
|
|
20
21
|
}
|
package/src/config.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { exec } from 'node:child_process'
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export const openInBrowser = (async () => {
|
|
5
|
+
try {
|
|
6
|
+
return (await import('open')).default
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
return _openInBrowser
|
|
10
|
+
}
|
|
11
|
+
})()
|
|
12
|
+
|
|
13
|
+
function _openInBrowser(address) {
|
|
5
14
|
switch (process.platform) {
|
|
6
15
|
case 'darwin':
|
|
7
16
|
exec(`open ${address}`)
|