@jayfong/x-server 2.59.0 → 2.61.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/lib/_cjs/cli/build_util.js +1 -0
- package/lib/_cjs/cli/cli.js +2 -1
- package/lib/_cjs/cli/deploy_util.js +1 -1
- package/lib/_cjs/core/handler.js +1 -1
- package/lib/_cjs/core/server.js +0 -3
- package/lib/cli/build_util.js +1 -0
- package/lib/cli/cli.js +2 -1
- package/lib/cli/deploy_util.d.ts +1 -0
- package/lib/cli/deploy_util.js +1 -1
- package/lib/core/handler.js +1 -1
- package/lib/core/server.js +0 -3
- package/lib/core/types.d.ts +1 -1
- package/package.json +1 -1
package/lib/_cjs/cli/cli.js
CHANGED
|
@@ -219,7 +219,8 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
219
219
|
key: deployEnv.KEY,
|
|
220
220
|
dir: deployEnv.DIR,
|
|
221
221
|
cmd: deployEnv.CMD,
|
|
222
|
-
memory: deployEnv.MEMORY
|
|
222
|
+
memory: deployEnv.MEMORY,
|
|
223
|
+
cron: deployEnv.CRON
|
|
223
224
|
});
|
|
224
225
|
}
|
|
225
226
|
}).parse();
|
|
@@ -39,7 +39,7 @@ class DeployUtil {
|
|
|
39
39
|
cd ${appDir}/dist
|
|
40
40
|
[ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
|
|
41
41
|
${options.cmd || ''}
|
|
42
|
-
${options.memory ? `PM2_MEMORY=${options.memory} ` : ''}pm2 startOrReload pm2.config.js
|
|
42
|
+
${options.memory ? `PM2_MEMORY=${options.memory} ` : ''}${options.cron ? `PM2_CRON="${options.cron}" ` : ''}pm2 startOrReload pm2.config.js
|
|
43
43
|
`, {
|
|
44
44
|
cwd: options.dir,
|
|
45
45
|
onStdout: buf => console.log(buf.toString()),
|
package/lib/_cjs/core/handler.js
CHANGED
|
@@ -26,7 +26,7 @@ class Handler {
|
|
|
26
26
|
if (Handler.hooks.length) {
|
|
27
27
|
await Promise.all(Handler.hooks.map(hook => hook(this.options, data, ctx)));
|
|
28
28
|
}
|
|
29
|
-
let useAsyncContext = _server.Server.options.useAsyncContext
|
|
29
|
+
let useAsyncContext = !!_server.Server.options.useAsyncContext;
|
|
30
30
|
if (this.options.useAsyncContext != null) {
|
|
31
31
|
useAsyncContext = this.options.useAsyncContext;
|
|
32
32
|
}
|
package/lib/_cjs/core/server.js
CHANGED
|
@@ -16,9 +16,6 @@ class Server {
|
|
|
16
16
|
this.options = options;
|
|
17
17
|
this.fastify = void 0;
|
|
18
18
|
this.routes = [];
|
|
19
|
-
if (options.useAsyncContext == null) {
|
|
20
|
-
options.useAsyncContext = true;
|
|
21
|
-
}
|
|
22
19
|
Server.options = options;
|
|
23
20
|
_nodeProcess.default.on('unhandledRejection', (reason, promise) => {
|
|
24
21
|
console.error('未捕获的错误', reason, promise);
|
package/lib/cli/build_util.js
CHANGED
|
@@ -185,6 +185,7 @@ export class BuildUtil {
|
|
|
185
185
|
interpreter_args: 'exec node'
|
|
186
186
|
} : {})}),
|
|
187
187
|
...(process.env.PM2_MEMORY ? { max_memory_restart: process.env.PM2_MEMORY } : {}),
|
|
188
|
+
...(process.env.PM2_CRON ? { cron_restart: process.env.PM2_CRON } : {}),
|
|
188
189
|
},
|
|
189
190
|
],
|
|
190
191
|
}
|
package/lib/cli/cli.js
CHANGED
package/lib/cli/deploy_util.d.ts
CHANGED
package/lib/cli/deploy_util.js
CHANGED
|
@@ -34,7 +34,7 @@ export class DeployUtil {
|
|
|
34
34
|
cd ${appDir}/dist
|
|
35
35
|
[ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
|
|
36
36
|
${options.cmd || ''}
|
|
37
|
-
${options.memory ? `PM2_MEMORY=${options.memory} ` : ''}pm2 startOrReload pm2.config.js
|
|
37
|
+
${options.memory ? `PM2_MEMORY=${options.memory} ` : ''}${options.cron ? `PM2_CRON="${options.cron}" ` : ''}pm2 startOrReload pm2.config.js
|
|
38
38
|
`, {
|
|
39
39
|
cwd: options.dir,
|
|
40
40
|
onStdout: buf => console.log(buf.toString()),
|
package/lib/core/handler.js
CHANGED
|
@@ -20,7 +20,7 @@ export class Handler {
|
|
|
20
20
|
if (Handler.hooks.length) {
|
|
21
21
|
await Promise.all(Handler.hooks.map(hook => hook(this.options, data, ctx)));
|
|
22
22
|
}
|
|
23
|
-
let useAsyncContext = Server.options.useAsyncContext
|
|
23
|
+
let useAsyncContext = !!Server.options.useAsyncContext;
|
|
24
24
|
if (this.options.useAsyncContext != null) {
|
|
25
25
|
useAsyncContext = this.options.useAsyncContext;
|
|
26
26
|
}
|
package/lib/core/server.js
CHANGED
|
@@ -10,9 +10,6 @@ export class Server {
|
|
|
10
10
|
this.options = options;
|
|
11
11
|
this.fastify = void 0;
|
|
12
12
|
this.routes = [];
|
|
13
|
-
if (options.useAsyncContext == null) {
|
|
14
|
-
options.useAsyncContext = true;
|
|
15
|
-
}
|
|
16
13
|
Server.options = options;
|
|
17
14
|
process.on('unhandledRejection', (reason, promise) => {
|
|
18
15
|
console.error('未捕获的错误', reason, promise);
|
package/lib/core/types.d.ts
CHANGED