@dotcom-tool-kit/node 5.0.1-beta.9 → 5.1.0-beta.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/lib/tasks/node.d.ts +3 -0
- package/lib/tasks/node.d.ts.map +1 -1
- package/lib/tasks/node.js +10 -2
- package/package.json +3 -3
- package/readme.md +8 -7
package/lib/tasks/node.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ declare const NodeSchema: z.ZodObject<{
|
|
|
6
6
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
7
|
useDoppler: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
ports: z.ZodDefault<z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodLiteral<false>]>>;
|
|
9
|
+
portTimeout: z.ZodDefault<z.ZodNumber>;
|
|
9
10
|
watch: z.ZodOptional<z.ZodBoolean>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
entry: string;
|
|
12
13
|
useDoppler: boolean;
|
|
13
14
|
ports: false | number[];
|
|
15
|
+
portTimeout: number;
|
|
14
16
|
args?: string[] | undefined;
|
|
15
17
|
watch?: boolean | undefined;
|
|
16
18
|
}, {
|
|
@@ -18,6 +20,7 @@ declare const NodeSchema: z.ZodObject<{
|
|
|
18
20
|
args?: string[] | undefined;
|
|
19
21
|
useDoppler?: boolean | undefined;
|
|
20
22
|
ports?: false | number[] | undefined;
|
|
23
|
+
portTimeout?: number | undefined;
|
|
21
24
|
watch?: boolean | undefined;
|
|
22
25
|
}>;
|
|
23
26
|
export { NodeSchema as schema };
|
package/lib/tasks/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/tasks/node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAA;AAIlD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/tasks/node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAA;AAIlD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EA2B+C,CAAA;AAC/D,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAA;AAE/B,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,UAAU,CAAA;CAAE,CAAC;IACjE,KAAK,CAAC,EAAE,YAAY,CAAA;IAEd,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiEnD,IAAI;CAMX"}
|
package/lib/tasks/node.js
CHANGED
|
@@ -23,6 +23,10 @@ const NodeSchema = z
|
|
|
23
23
|
.union([z.number().array(), z.literal(false)])
|
|
24
24
|
.default([3001, 3002, 3003])
|
|
25
25
|
.describe("ports to try to bind to for this application. set to `false` for an entry point that wouldn't bind to a port, such as a worker process or one-off script."),
|
|
26
|
+
portTimeout: z
|
|
27
|
+
.number()
|
|
28
|
+
.default(0)
|
|
29
|
+
.describe('how long (in milliseconds) to wait for the app to listen on its port for before exiting. if `0` (the default), will wait forever.'),
|
|
26
30
|
watch: z
|
|
27
31
|
.boolean()
|
|
28
32
|
.optional()
|
|
@@ -64,10 +68,14 @@ class Node extends base_1.Task {
|
|
|
64
68
|
if (port) {
|
|
65
69
|
const unhook = (0, logger_1.hookConsole)(this.logger, 'wait-port');
|
|
66
70
|
try {
|
|
67
|
-
await (0, wait_port_1.default)({
|
|
71
|
+
const { open } = await (0, wait_port_1.default)({
|
|
68
72
|
host: 'localhost',
|
|
69
|
-
port
|
|
73
|
+
port,
|
|
74
|
+
timeout: this.options.portTimeout
|
|
70
75
|
});
|
|
76
|
+
if (this.options.portTimeout && !open) {
|
|
77
|
+
this.logger.warn(`Node process didn't listen on port ${logger_1.styles.code(port)} within ${logger_1.styles.code(this.options.portTimeout)}ms`);
|
|
78
|
+
}
|
|
71
79
|
}
|
|
72
80
|
finally {
|
|
73
81
|
unhook();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcom-tool-kit/node",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dotcom-tool-kit/base": "^2.1.0
|
|
13
|
+
"@dotcom-tool-kit/base": "^2.1.0",
|
|
14
14
|
"@dotcom-tool-kit/doppler": "^3.0.0",
|
|
15
15
|
"@dotcom-tool-kit/error": "^5.0.0",
|
|
16
16
|
"@dotcom-tool-kit/state": "^5.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
".toolkitrc.yml"
|
|
32
32
|
],
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"dotcom-tool-kit": "5.x
|
|
34
|
+
"dotcom-tool-kit": "5.x"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=20.x"
|
package/readme.md
CHANGED
|
@@ -27,13 +27,14 @@ plugins:
|
|
|
27
27
|
Run a Node.js application for local development.
|
|
28
28
|
#### Task options
|
|
29
29
|
|
|
30
|
-
| Property
|
|
31
|
-
|
|
|
32
|
-
| `entry`
|
|
33
|
-
| `args`
|
|
34
|
-
| `useDoppler`
|
|
35
|
-
| `ports`
|
|
36
|
-
| `
|
|
30
|
+
| Property | Description | Type | Default |
|
|
31
|
+
| :------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------- | :------------------ |
|
|
32
|
+
| `entry` | path to the node application | `string` | `'./server/app.js'` |
|
|
33
|
+
| `args` | additional arguments to pass to your application | `Array<string>` | |
|
|
34
|
+
| `useDoppler` | whether to run the application with environment variables from Doppler | `boolean` | `true` |
|
|
35
|
+
| `ports` | ports to try to bind to for this application. set to `false` for an entry point that wouldn't bind to a port, such as a worker process or one-off script. | `Array<number> \| false` | `[3001,3002,3003]` |
|
|
36
|
+
| `portTimeout` | how long (in milliseconds) to wait for the app to listen on its port for before exiting. if `0` (the default), will wait forever. | `number` | `0` |
|
|
37
|
+
| `watch` | run Node in watch mode, which restarts your application when the entrypoint or any imported files are changed. **nb** this option is experimental in versions of Node before v20.13. | `boolean` | |
|
|
37
38
|
|
|
38
39
|
_All properties are optional._
|
|
39
40
|
<!-- end autogenerated docs -->
|