@hile/cli 1.0.19 → 1.0.20

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 CHANGED
@@ -48,7 +48,7 @@ hile start --env-file .env --env-file .env.local
48
48
 
49
49
  ### 启动日志(基于 @hile/core 事件)
50
50
 
51
- CLI 已接入容器事件日志(仅开发模式输出),格式统一、列对齐:
51
+ CLI 已接入容器事件日志(仅开发模式输出):
52
52
 
53
53
  - 服务启动:`service:init` / `service:ready`(含耗时)
54
54
  - 服务失败:`service:error`(错误对象单独一行)
package/dist/index.js CHANGED
@@ -22,46 +22,41 @@ const c = {
22
22
  };
23
23
  const colorize = process.stdout.isTTY;
24
24
  function logContainerEvent(event) {
25
- const pad = (s, n) => s.padEnd(n);
26
- const padNum = (n, width) => n.toString().padStart(width);
27
25
  const tag = colorize ? `${c.dim}${c.cyan}${TAG}${c.reset}` : TAG;
28
26
  const target = (s) => (colorize ? `${c.cyan}${s}${c.reset}` : s);
29
27
  const ok = (s) => (colorize ? `${c.green}${s}${c.reset}` : s);
30
28
  const warn = (s) => (colorize ? `${c.yellow}${s}${c.reset}` : s);
31
29
  const err = (s) => (colorize ? `${c.red}${s}${c.reset}` : s);
32
30
  const dim = (s) => (colorize ? `${c.dim}${s}${c.reset}` : s);
33
- const fmt = (t, status, durationMs) => durationMs !== undefined
34
- ? `${tag} ${target(pad(t, 14))} ${status} ${dim(padNum(durationMs, 5) + 'ms')}`
35
- : `${tag} ${target(pad(t, 14))} ${status}`;
36
31
  switch (event.type) {
37
32
  case 'service:init':
38
- console.info(fmt(`service#${event.id}`, dim('init')));
33
+ console.info(`${tag} ${target(`service#${event.id}`)} ${dim('init')}`);
39
34
  break;
40
35
  case 'service:ready':
41
- console.info(fmt(`service#${event.id}`, ok(pad('ready', 14)), event.durationMs));
36
+ console.info(`${tag} ${target(`service#${event.id}`)} ${ok('ready')} ${dim(`(${event.durationMs}ms)`)}`);
42
37
  break;
43
38
  case 'service:error':
44
- console.error(fmt(`service#${event.id}`, err(`failed (${event.durationMs}ms)`)));
39
+ console.error(`${tag} ${target(`service#${event.id}`)} ${err('failed')} ${dim(`(${event.durationMs}ms)`)}`);
45
40
  console.error(event.error);
46
41
  break;
47
42
  case 'service:shutdown:start':
48
- console.info(fmt(`service#${event.id}`, warn('stopping')));
43
+ console.info(`${tag} ${target(`service#${event.id}`)} ${warn('stopping')}`);
49
44
  break;
50
45
  case 'service:shutdown:done':
51
- console.info(fmt(`service#${event.id}`, dim(pad('stopped', 14)), event.durationMs));
46
+ console.info(`${tag} ${target(`service#${event.id}`)} ${dim('stopped')} ${dim(`(${event.durationMs}ms)`)}`);
52
47
  break;
53
48
  case 'service:shutdown:error':
54
- console.error(fmt(`service#${event.id}`, err('shutdown error')));
49
+ console.error(`${tag} ${target(`service#${event.id}`)} ${err('shutdown error')}`);
55
50
  console.error(event.error);
56
51
  break;
57
52
  case 'container:shutdown:start':
58
- console.info(fmt('container', dim('shutdown start')));
53
+ console.info(`${tag} ${target('container')} ${dim('shutdown start')}`);
59
54
  break;
60
55
  case 'container:shutdown:done':
61
- console.info(fmt('container', ok(pad('shutdown done', 14)), event.durationMs));
56
+ console.info(`${tag} ${target('container')} ${ok('shutdown done')} ${dim(`(${event.durationMs}ms)`)}`);
62
57
  break;
63
58
  case 'container:error':
64
- console.error(fmt('container', err('error')));
59
+ console.error(`${tag} ${target('container')} ${err('error')}`);
65
60
  console.error(event.error);
66
61
  break;
67
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/cli",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -31,5 +31,5 @@
31
31
  "glob": "^13.0.6",
32
32
  "tsx": "^4.21.0"
33
33
  },
34
- "gitHead": "f5d59f9f131456cf14e5ca62eeea6becde84ebef"
34
+ "gitHead": "a913724465de986a7891746ced001ff6dcd3ff88"
35
35
  }