@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.
- package/bin/dmla-install.js +2 -1
- package/package.json +1 -1
- package/src/index.js +0 -6
- package/src/modules/install.js +26 -3
package/bin/dmla-install.js
CHANGED
package/package.json
CHANGED
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
|
-
}
|
package/src/modules/install.js
CHANGED
|
@@ -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
|
-
|
|
40
|
-
|
|
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
|
// 等待服务就绪
|