nuxt-dev-ready 4.0.1 → 5.0.1
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 +12 -12
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -4
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -68,18 +68,18 @@ $ yarn add nuxt-dev-ready
|
|
|
68
68
|
## Usage
|
|
69
69
|
|
|
70
70
|
```js
|
|
71
|
-
import { execaCommand } from 'execa'
|
|
72
|
-
import kill from 'tree-kill-promise'
|
|
73
|
-
import nuxtDevReady from 'nuxt-dev-ready'
|
|
71
|
+
import { execaCommand } from 'execa';
|
|
72
|
+
import kill from 'tree-kill-promise';
|
|
73
|
+
import nuxtDevReady from 'nuxt-dev-ready';
|
|
74
74
|
|
|
75
|
-
const nuxt = execaCommand('nuxt dev')
|
|
75
|
+
const nuxt = execaCommand('nuxt dev');
|
|
76
76
|
|
|
77
77
|
try {
|
|
78
|
-
await nuxtDevReady()
|
|
78
|
+
await nuxtDevReady();
|
|
79
79
|
|
|
80
80
|
// Do some testing
|
|
81
81
|
} finally {
|
|
82
|
-
await kill(nuxt.pid)
|
|
82
|
+
await kill(nuxt.pid);
|
|
83
83
|
}
|
|
84
84
|
```
|
|
85
85
|
|
|
@@ -88,16 +88,16 @@ try {
|
|
|
88
88
|
You can pass a custom port to `nuxtDevReady` like so:
|
|
89
89
|
|
|
90
90
|
```js
|
|
91
|
-
import { execaCommand } from 'execa'
|
|
92
|
-
import kill from 'tree-kill-promise'
|
|
93
|
-
import nuxtDevReady from 'nuxt-dev-ready'
|
|
91
|
+
import { execaCommand } from 'execa';
|
|
92
|
+
import kill from 'tree-kill-promise';
|
|
93
|
+
import nuxtDevReady from 'nuxt-dev-ready';
|
|
94
94
|
|
|
95
|
-
const nuxt = execaCommand('nuxt dev', { env: { PORT: 4000 } })
|
|
95
|
+
const nuxt = execaCommand('nuxt dev', { env: { PORT: 4000 } });
|
|
96
96
|
|
|
97
97
|
try {
|
|
98
|
-
await nuxtDevReady(4000)
|
|
98
|
+
await nuxtDevReady(4000);
|
|
99
99
|
} finally {
|
|
100
|
-
await kill(nuxt.pid)
|
|
100
|
+
await kill(nuxt.pid);
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import pWaitFor from "p-wait-for";
|
|
3
3
|
import portReady from "port-ready";
|
|
4
|
-
export default async (port = 3e3
|
|
4
|
+
export default async (port = 3e3, {
|
|
5
|
+
interval = 500
|
|
6
|
+
} = {}) => {
|
|
5
7
|
await portReady(port);
|
|
6
8
|
await pWaitFor(async () => {
|
|
7
9
|
try {
|
|
8
10
|
const {
|
|
9
11
|
data
|
|
10
|
-
} = await axios.get(`http://localhost:${port}
|
|
12
|
+
} = await axios.get(`http://localhost:${port}`, {
|
|
13
|
+
timeout: interval
|
|
14
|
+
});
|
|
11
15
|
return !data.includes('id="nuxt_loading_screen"');
|
|
12
16
|
} catch (error) {
|
|
13
|
-
return error.response !== void 0 && error.response.status !== 503;
|
|
17
|
+
return error.code !== "ECONNABORTED" && error.response !== void 0 && error.response.status !== 503;
|
|
14
18
|
}
|
|
15
19
|
}, {
|
|
16
|
-
interval
|
|
20
|
+
interval
|
|
17
21
|
});
|
|
18
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-dev-ready",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Waits until the Nuxt dev server is loaded. Mainly useful for testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wait"
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"lint": "base lint",
|
|
31
31
|
"prepare": "base prepare",
|
|
32
32
|
"prepublishOnly": "base prepublishOnly",
|
|
33
|
-
"test": "base test"
|
|
33
|
+
"test": "base test",
|
|
34
|
+
"typecheck": "base typecheck",
|
|
35
|
+
"verify": "base verify"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"axios": "^1.3.6",
|
|
@@ -38,19 +40,19 @@
|
|
|
38
40
|
"port-ready": "^0.1.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@dword-design/base": "^
|
|
43
|
+
"@dword-design/base": "^15.0.0",
|
|
42
44
|
"@playwright/test": "^1.53.0",
|
|
43
45
|
"endent": "npm:@dword-design/endent@^1.4.1",
|
|
44
46
|
"execa": "^9.6.0",
|
|
45
47
|
"fs-extra": "^11.1.1",
|
|
46
48
|
"get-port": "^7.1.0",
|
|
47
49
|
"jsdom": "^26.0.0",
|
|
48
|
-
"nuxt": "^
|
|
49
|
-
"tree-kill-promise": "^
|
|
50
|
+
"nuxt": "^4.0.0",
|
|
51
|
+
"tree-kill-promise": "^4.0.0"
|
|
50
52
|
},
|
|
51
|
-
"packageManager": "pnpm@10.
|
|
53
|
+
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
|
|
52
54
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
55
|
+
"node": ">=20"
|
|
54
56
|
},
|
|
55
57
|
"publishConfig": {
|
|
56
58
|
"access": "public"
|