@jayfong/x-server 2.92.0 → 2.92.2
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 +9 -6
- package/lib/_cjs/cli/cli.js +9 -3
- package/lib/_cjs/cli/deploy_util.js +1 -1
- package/lib/cli/build_util.d.ts +2 -0
- package/lib/cli/build_util.js +9 -6
- package/lib/cli/cli.js +9 -3
- package/lib/cli/deploy_util.d.ts +0 -2
- package/lib/cli/deploy_util.js +1 -1
- package/package.json +1 -1
|
@@ -232,12 +232,15 @@ class BuildUtil {
|
|
|
232
232
|
{
|
|
233
233
|
name: ${JSON.stringify(distPkgContent.name)},
|
|
234
234
|
script: './main.js',
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
${hasNvmrc ? `
|
|
236
|
+
interpreter: 'node',
|
|
237
|
+
interpreter_args: [],
|
|
238
|
+
env: {
|
|
239
|
+
PATH: \`\${require('child_process').execSync('fnm exec which node').toString().trim().replace(/\\/node$/, '')}:\${process.env.PATH}\`,
|
|
240
|
+
},
|
|
241
|
+
` : ''}
|
|
242
|
+
${options.pm2MaxMemoryRestart ? `max_memory_restart: '${options.pm2MaxMemoryRestart}',` : ''}
|
|
243
|
+
${options.pm2CronRestart ? `cron_restart: '${options.pm2CronRestart}',` : ''}
|
|
241
244
|
},
|
|
242
245
|
],
|
|
243
246
|
}
|
package/lib/_cjs/cli/cli.js
CHANGED
|
@@ -51,8 +51,6 @@ async function deploy(argv) {
|
|
|
51
51
|
pass: deployEnv.PASSWORD,
|
|
52
52
|
dir: deployEnv.DIR,
|
|
53
53
|
cmd: deployEnv.CMD,
|
|
54
|
-
memory: deployEnv.MEMORY,
|
|
55
|
-
cron: deployEnv.CRON,
|
|
56
54
|
channel: channel
|
|
57
55
|
});
|
|
58
56
|
}
|
|
@@ -191,6 +189,12 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
191
189
|
channel: channel
|
|
192
190
|
});
|
|
193
191
|
envMap.NODE_ENV = 'production';
|
|
192
|
+
const deployEnvFiles = _env_util.EnvUtil.getFile('deploy', channel, true);
|
|
193
|
+
const deployEnv = await _env_util.EnvUtil.parseFileAsMap({
|
|
194
|
+
cwd: process.cwd(),
|
|
195
|
+
file: deployEnvFiles,
|
|
196
|
+
channel: channel
|
|
197
|
+
});
|
|
194
198
|
await _template_util.TemplateUtil.init(process.cwd());
|
|
195
199
|
await (0, _vscodeGenerateIndexStandalone.generateManyIndex)({
|
|
196
200
|
cwd: process.cwd(),
|
|
@@ -217,7 +221,9 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
217
221
|
}),
|
|
218
222
|
prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
|
|
219
223
|
noPrismaEngine: argv['prisma-engine'] === false,
|
|
220
|
-
noEmptyDistDir: argv['empty-dist-dir'] === false
|
|
224
|
+
noEmptyDistDir: argv['empty-dist-dir'] === false,
|
|
225
|
+
pm2MaxMemoryRestart: deployEnv.MEMORY,
|
|
226
|
+
pm2CronRestart: deployEnv.CRON
|
|
221
227
|
});
|
|
222
228
|
console.log('构建成功');
|
|
223
229
|
if (argv.deploy) {
|
|
@@ -40,7 +40,7 @@ class DeployUtil {
|
|
|
40
40
|
cd "${appDir}/${options.channel || 'dist'}"
|
|
41
41
|
[ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
|
|
42
42
|
${options.cmd || ''}
|
|
43
|
-
|
|
43
|
+
pm2 startOrReload pm2.config.js
|
|
44
44
|
`, {
|
|
45
45
|
cwd: options.dir,
|
|
46
46
|
onStdout: buf => console.log(buf.toString()),
|
package/lib/cli/build_util.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface BuildOptions {
|
|
|
10
10
|
prismaCliBinaryTargets?: string;
|
|
11
11
|
noPrismaEngine?: boolean;
|
|
12
12
|
noEmptyDistDir?: boolean;
|
|
13
|
+
pm2MaxMemoryRestart?: string;
|
|
14
|
+
pm2CronRestart?: string;
|
|
13
15
|
}
|
|
14
16
|
export declare class BuildUtil {
|
|
15
17
|
static build(options: BuildOptions): Promise<void>;
|
package/lib/cli/build_util.js
CHANGED
|
@@ -226,12 +226,15 @@ export class BuildUtil {
|
|
|
226
226
|
{
|
|
227
227
|
name: ${JSON.stringify(distPkgContent.name)},
|
|
228
228
|
script: './main.js',
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
${hasNvmrc ? `
|
|
230
|
+
interpreter: 'node',
|
|
231
|
+
interpreter_args: [],
|
|
232
|
+
env: {
|
|
233
|
+
PATH: \`\${require('child_process').execSync('fnm exec which node').toString().trim().replace(/\\/node$/, '')}:\${process.env.PATH}\`,
|
|
234
|
+
},
|
|
235
|
+
` : ''}
|
|
236
|
+
${options.pm2MaxMemoryRestart ? `max_memory_restart: '${options.pm2MaxMemoryRestart}',` : ''}
|
|
237
|
+
${options.pm2CronRestart ? `cron_restart: '${options.pm2CronRestart}',` : ''}
|
|
235
238
|
},
|
|
236
239
|
],
|
|
237
240
|
}
|
package/lib/cli/cli.js
CHANGED
|
@@ -49,8 +49,6 @@ async function deploy(argv) {
|
|
|
49
49
|
pass: deployEnv.PASSWORD,
|
|
50
50
|
dir: deployEnv.DIR,
|
|
51
51
|
cmd: deployEnv.CMD,
|
|
52
|
-
memory: deployEnv.MEMORY,
|
|
53
|
-
cron: deployEnv.CRON,
|
|
54
52
|
channel: channel
|
|
55
53
|
});
|
|
56
54
|
}
|
|
@@ -189,6 +187,12 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
189
187
|
channel: channel
|
|
190
188
|
});
|
|
191
189
|
envMap.NODE_ENV = 'production';
|
|
190
|
+
const deployEnvFiles = EnvUtil.getFile('deploy', channel, true);
|
|
191
|
+
const deployEnv = await EnvUtil.parseFileAsMap({
|
|
192
|
+
cwd: process.cwd(),
|
|
193
|
+
file: deployEnvFiles,
|
|
194
|
+
channel: channel
|
|
195
|
+
});
|
|
192
196
|
await TemplateUtil.init(process.cwd());
|
|
193
197
|
await generateManyIndex({
|
|
194
198
|
cwd: process.cwd(),
|
|
@@ -215,7 +219,9 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
215
219
|
}),
|
|
216
220
|
prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
|
|
217
221
|
noPrismaEngine: argv['prisma-engine'] === false,
|
|
218
|
-
noEmptyDistDir: argv['empty-dist-dir'] === false
|
|
222
|
+
noEmptyDistDir: argv['empty-dist-dir'] === false,
|
|
223
|
+
pm2MaxMemoryRestart: deployEnv.MEMORY,
|
|
224
|
+
pm2CronRestart: deployEnv.CRON
|
|
219
225
|
});
|
|
220
226
|
console.log('构建成功');
|
|
221
227
|
if (argv.deploy) {
|
package/lib/cli/deploy_util.d.ts
CHANGED
package/lib/cli/deploy_util.js
CHANGED
|
@@ -35,7 +35,7 @@ export class DeployUtil {
|
|
|
35
35
|
cd "${appDir}/${options.channel || 'dist'}"
|
|
36
36
|
[ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
|
|
37
37
|
${options.cmd || ''}
|
|
38
|
-
|
|
38
|
+
pm2 startOrReload pm2.config.js
|
|
39
39
|
`, {
|
|
40
40
|
cwd: options.dir,
|
|
41
41
|
onStdout: buf => console.log(buf.toString()),
|