@icyfenix-dmla/install 2026.4.19-39 → 2026.4.19-856

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.
@@ -2,4 +2,5 @@
2
2
  /**
3
3
  * DMLA Install TUI 入口
4
4
  */
5
- import '../src/index.js'
5
+ import { runInstallTUI } from '../src/index.js'
6
+ runInstallTUI()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icyfenix-dmla/install",
3
- "version": "2026.4.19-39",
3
+ "version": "2026.4.19-856",
4
4
  "description": "DMLA 沙箱环境 TUI 安装向导",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -262,9 +262,3 @@ export async function runInstallTUI() {
262
262
  }
263
263
  }
264
264
 
265
- // 直接运行时执行主流程(通过检测是否为主模块)
266
- // ES Module 中使用 import.meta.url 检测
267
- const isMainModule = import.meta.url === `file://${process.argv[1].replace(/\\/g, '/')}`
268
- if (isMainModule) {
269
- runInstallTUI()
270
- }
@@ -35,9 +35,32 @@ export async function installNpmPackage() {
35
35
  export async function verifyInstallation(port = 3001) {
36
36
  console.log(chalk.gray('启动服务...'))
37
37
 
38
- // 启动服务
39
- const serverProcess = spawn('dmla', ['start', '--port', port.toString()], {
40
- stdio: 'inherit'
38
+ // 检查 dmla 命令是否可用
39
+ let dmlaAvailable = false
40
+ try {
41
+ execSync('dmla --version', { encoding: 'utf8' })
42
+ dmlaAvailable = true
43
+ } catch {
44
+ // dmla 命令暂不可用,使用 npx 启动
45
+ console.log(chalk.gray('dmla 命令暂不可用,使用 npx 启动...'))
46
+ }
47
+
48
+ // 启动服务(优先使用 dmla,否则用 npx)
49
+ const cmd = dmlaAvailable ? 'dmla' : 'npx'
50
+ const args = dmlaAvailable
51
+ ? ['start', '--port', port.toString()]
52
+ : ['@icyfenix-dmla/cli', 'start', '--port', port.toString()]
53
+
54
+ const serverProcess = spawn(cmd, args, {
55
+ stdio: 'inherit',
56
+ shell: true // Windows 需要 shell: true
57
+ })
58
+
59
+ // 处理启动错误
60
+ serverProcess.on('error', (err) => {
61
+ console.log(chalk.yellow('⚠️ 服务启动失败'))
62
+ console.log(chalk.yellow(`💡 请手动执行: npx @icyfenix-dmla/cli start --port ${port}`))
63
+ return false
41
64
  })
42
65
 
43
66
  // 等待服务就绪