create-yeow 0.2.124 → 0.2.126

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-yeow",
3
- "version": "0.2.124",
3
+ "version": "0.2.126",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -468,6 +468,20 @@ async function runHeadless() {
468
468
  const log = OUTFILE ? createWriteStream(OUTFILE, { flags: 'a' }) : null;
469
469
  const out = (line) => { if (log) log.write(line + '\n'); else console.log(line); };
470
470
 
471
+ // 流程级超时:覆盖下载/初始化/启动/加载全程(--timeout,默认 2m)
472
+ let done = false;
473
+ const finish = (code) => {
474
+ if (waitTimer) clearTimeout(waitTimer);
475
+ try { if (log) log.end(); } catch {}
476
+ process.exit(code);
477
+ };
478
+ const failTimer = setTimeout(() => {
479
+ if (done) return;
480
+ fail(`流程在 ${TIMEOUT}s 内未完成加载——请检查网络/依赖下载,或加大超时(--timeout=3m)`);
481
+ killProc();
482
+ finish(1);
483
+ }, TIMEOUT * 1000);
484
+
471
485
  info('正在下载/准备服务端…');
472
486
  await ensurePaper();
473
487
  mkdirSync(SERVER, { recursive: true });
@@ -485,18 +499,7 @@ async function runHeadless() {
485
499
  proc = spawn('java', [...jvmArgs, '-jar', resolve(SERVER, PAPER_JAR), '--nogui'], { cwd: SERVER, stdio: ['ignore', 'pipe', 'pipe'] });
486
500
  info(`Server PID: ${proc.pid}`);
487
501
 
488
- let started = false, done = false, waitTimer = null;
489
- const finish = (code) => {
490
- if (waitTimer) clearTimeout(waitTimer);
491
- try { if (log) log.end(); } catch {}
492
- process.exit(code);
493
- };
494
- const failTimer = setTimeout(() => {
495
- if (done) return;
496
- fail(`服务器在 ${TIMEOUT}s 内未完成加载——请检查网络/依赖下载,或加大超时(--timeout=3m)`);
497
- killProc();
498
- finish(1);
499
- }, TIMEOUT * 1000);
502
+ let started = false, waitTimer = null;
500
503
 
501
504
  const onLine = (line) => {
502
505
  out(line);