@hile/cli 2.0.7 → 2.0.8
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/dist/index.js +11 -2
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createRequire } from 'node:module';
|
|
|
9
9
|
import { Registry } from '@hile/micro';
|
|
10
10
|
import { useExit } from './exitHook.js';
|
|
11
11
|
import { listConfigs, getConfig, setConfig, delConfig } from './configs.js';
|
|
12
|
+
import { createLogger } from '@hile/logger';
|
|
12
13
|
const requireCli = createRequire(import.meta.url);
|
|
13
14
|
/** 从包入口文件路径向上找到 `package.json` 的 `name` 与 `packageName` 一致的目录 */
|
|
14
15
|
function packageDirFromResolvedMain(resolvedMain, packageName) {
|
|
@@ -114,12 +115,20 @@ registryCmd
|
|
|
114
115
|
.allowExcessArguments(true)
|
|
115
116
|
.option('--port <port>', '注册中心端口', '9876')
|
|
116
117
|
.option('--host <host>', '注册中心主机', '127.0.0.1')
|
|
118
|
+
.option('--level <level>', '日志级别', 'info')
|
|
119
|
+
.option('--pretty', '美化输出', false)
|
|
117
120
|
.description('启动注册中心')
|
|
118
121
|
.action(async (options) => {
|
|
119
122
|
const port = options.port ? Number(options.port) : 9876;
|
|
120
|
-
const registry = new Registry({
|
|
123
|
+
const registry = new Registry({
|
|
124
|
+
advertiseHost: options.host,
|
|
125
|
+
logger: createLogger({
|
|
126
|
+
level: options.level,
|
|
127
|
+
pretty: !!options.pretty
|
|
128
|
+
})
|
|
129
|
+
});
|
|
121
130
|
useExit(await registry.listen(port));
|
|
122
|
-
|
|
131
|
+
registry.logger.info(`+ registry started on port ${port}`);
|
|
123
132
|
});
|
|
124
133
|
// Registry configs subcommands
|
|
125
134
|
const configs = registryCmd.command('configs');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hile/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@hile/core": "^2.0.1",
|
|
32
|
+
"@hile/logger": "^2.0.1",
|
|
32
33
|
"@hile/micro": "^2.0.5",
|
|
33
34
|
"async-exit-hook": "^2.0.1",
|
|
34
35
|
"commander": "^14.0.3",
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"tsx": "^4.21.0",
|
|
38
39
|
"yaml": "^2.9.0"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "ee65892b77e87ff14470dee72a3ff45b6c467311"
|
|
41
42
|
}
|