@hile/cli 1.0.3 → 1.0.7

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
@@ -26,13 +26,15 @@ pnpm add -g @hile/cli
26
26
  若上述两者均未提供任何可加载项,CLI 会输出 `no services to load` 并退出。每个加载项(模块或 boot 文件)的默认导出须通过 `isService` 校验,否则会抛出 `invalid service file`。
27
27
 
28
28
  ```bash
29
- hile start # 生产模式,扫描 dist/ 目录
30
- hile start --dev # 开发模式,扫描 src/ 目录(通过 tsx 支持 TypeScript)
29
+ hile start # 生产模式:NODE_ENV=production,扫描 dist/ 目录
30
+ hile start --dev # 开发模式:NODE_ENV=development,扫描 src/ 目录(通过 tsx 支持 TypeScript)
31
31
  ```
32
32
 
33
33
  | 选项 | 说明 | 默认值 |
34
34
  |------|------|--------|
35
- | `-d, --dev` | 开发模式,使用 tsx 运行 TypeScript | `false` |
35
+ | `-d, --dev` | 开发模式:设置 `NODE_ENV=development`,使用 tsx 运行 TypeScript,扫描 `src/` | `false` |
36
+
37
+ 未使用 `--dev` 时,CLI 会将 `process.env.NODE_ENV` 设为 `production`;使用 `--dev` 时设为 `development`,便于业务代码区分环境。
36
38
 
37
39
  ### 其他
38
40
 
package/dist/index.js CHANGED
@@ -24,8 +24,13 @@ program
24
24
  .description('启动服务,加载所有后缀为 boot.ts 或 boot.js 的服务,并注册退出钩子,在进程退出时销毁所有服务')
25
25
  .action(async (options) => {
26
26
  // 开发模式下,使用 tsx 运行
27
- if (options.dev)
27
+ if (options.dev) {
28
28
  await import('tsx/esm');
29
+ process.env.NODE_ENV = 'development';
30
+ }
31
+ else {
32
+ process.env.NODE_ENV = 'production';
33
+ }
29
34
  const cwd = process.cwd();
30
35
  const files = [];
31
36
  // 加载 package.json 文件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,10 +25,10 @@
25
25
  "vitest": "^4.0.18"
26
26
  },
27
27
  "dependencies": {
28
- "@hile/core": "1.0.11",
28
+ "@hile/core": "1.0.14",
29
29
  "async-exit-hook": "^2.0.1",
30
30
  "commander": "^14.0.3",
31
31
  "glob": "^13.0.6"
32
32
  },
33
- "gitHead": "6454023e85118e1ae4d71545b59adf71890aace5"
33
+ "gitHead": "c71a9452cf379f28c6d02e6b3603b90bc4891680"
34
34
  }