@icyfenix-dmla/install 2026.5.2-1921 → 2026.5.2-1953
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/package.json +1 -1
- package/src/index.js +47 -30
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -83,15 +83,17 @@ export async function runInstallTUI() {
|
|
|
83
83
|
console.log()
|
|
84
84
|
|
|
85
85
|
const env = await checkEnvironment()
|
|
86
|
+
let dockerAvailable = true
|
|
86
87
|
|
|
87
88
|
if (!env.docker) {
|
|
88
|
-
|
|
89
|
-
console.log(chalk.yellow('
|
|
90
|
-
|
|
89
|
+
dockerAvailable = false
|
|
90
|
+
console.log(chalk.yellow('⚠️ Docker 未安装或未运行'))
|
|
91
|
+
console.log(chalk.gray(' CLI 工具可先安装,稍后在有 Docker 的环境中使用'))
|
|
92
|
+
console.log(chalk.gray(' Docker 安装指南: https://docs.docker.com/get-docker/'))
|
|
93
|
+
} else {
|
|
94
|
+
console.log(chalk.green(`✔ Docker ${env.dockerVersion || ''} 已安装`))
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
console.log(chalk.green(`✔ Docker ${env.dockerVersion || ''} 已安装`))
|
|
94
|
-
|
|
95
97
|
if (!env.node) {
|
|
96
98
|
console.log(chalk.red('❌ Node.js 未安装'))
|
|
97
99
|
console.log(chalk.yellow('请先安装 Node.js: https://nodejs.org/'))
|
|
@@ -100,8 +102,8 @@ export async function runInstallTUI() {
|
|
|
100
102
|
|
|
101
103
|
console.log(chalk.green(`✔ Node.js ${env.nodeVersion} 已安装`))
|
|
102
104
|
|
|
103
|
-
// GPU
|
|
104
|
-
if (env.gpu) {
|
|
105
|
+
// GPU 信息显示(仅当 Docker 可用时)
|
|
106
|
+
if (dockerAvailable && env.gpu) {
|
|
105
107
|
console.log(chalk.green(`✔ GPU: ${env.gpuInfo || '检测到'}`))
|
|
106
108
|
|
|
107
109
|
// 显示驱动版本和 CUDA 兼容上限
|
|
@@ -122,6 +124,8 @@ export async function runInstallTUI() {
|
|
|
122
124
|
console.log(chalk.yellow(` GPU 镜像: 不兼容 (需要驱动 >= ${minDriverForGpuImage})`))
|
|
123
125
|
console.log(chalk.yellow(` 💡 建议:升级 NVIDIA 驱动到 ${minDriverForGpuImage}+ 或使用 CPU 模式`))
|
|
124
126
|
}
|
|
127
|
+
} else if (!dockerAvailable) {
|
|
128
|
+
console.log(chalk.gray(' GPU: 检测已跳过(Docker 不可用)'))
|
|
125
129
|
} else {
|
|
126
130
|
console.log(chalk.gray(' GPU: 未检测到'))
|
|
127
131
|
}
|
|
@@ -131,32 +135,45 @@ export async function runInstallTUI() {
|
|
|
131
135
|
// ─────────────────────────────────────────────────────────────
|
|
132
136
|
// 步骤 2: 选择镜像仓库(或跳过拉取)
|
|
133
137
|
// ─────────────────────────────────────────────────────────────
|
|
134
|
-
const registryChoice = await prompt({
|
|
135
|
-
type: 'select',
|
|
136
|
-
name: 'registry',
|
|
137
|
-
message: '请选择镜像仓库',
|
|
138
|
-
initial: 0, // 默认选择 'auto'(第一项)
|
|
139
|
-
choices: [
|
|
140
|
-
{ name: 'auto', message: '自动选择 (根据网络延迟)' },
|
|
141
|
-
{ name: 'dockerhub', message: 'Docker Hub (全球访问)' },
|
|
142
|
-
{ name: 'acr', message: '阿里云 ACR (国内加速)' },
|
|
143
|
-
{ name: 'skip', message: '暂不拉取镜像 (仅安装 CLI)' }
|
|
144
|
-
]
|
|
145
|
-
})
|
|
146
138
|
|
|
147
|
-
|
|
148
|
-
let
|
|
139
|
+
// Docker 不可用时,强制跳过镜像拉取
|
|
140
|
+
let registry = 'skip'
|
|
141
|
+
let skipPull = true
|
|
149
142
|
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
console.log(
|
|
153
|
-
|
|
154
|
-
console.log(chalk.gray('
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
143
|
+
if (!dockerAvailable) {
|
|
144
|
+
console.log(chalk.bold('镜像安装'))
|
|
145
|
+
console.log()
|
|
146
|
+
console.log(chalk.gray(' Docker 未安装,将仅安装 CLI 工具'))
|
|
147
|
+
console.log(chalk.gray(' 稍后可在有 Docker 的环境中运行: dmla install'))
|
|
148
|
+
console.log()
|
|
149
|
+
} else {
|
|
150
|
+
const registryChoice = await prompt({
|
|
151
|
+
type: 'select',
|
|
152
|
+
name: 'registry',
|
|
153
|
+
message: '请选择镜像仓库',
|
|
154
|
+
initial: 0, // 默认选择 'auto'(第一项)
|
|
155
|
+
choices: [
|
|
156
|
+
{ name: 'auto', message: '自动选择 (根据网络延迟)' },
|
|
157
|
+
{ name: 'dockerhub', message: 'Docker Hub (全球访问)' },
|
|
158
|
+
{ name: 'acr', message: '阿里云 ACR (国内加速)' },
|
|
159
|
+
{ name: 'skip', message: '暂不拉取镜像 (仅安装 CLI)' }
|
|
160
|
+
]
|
|
161
|
+
})
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
registry = registryChoice.registry
|
|
164
|
+
skipPull = false
|
|
165
|
+
|
|
166
|
+
if (registry === 'skip') {
|
|
167
|
+
skipPull = true
|
|
168
|
+
console.log(chalk.gray(' 将仅安装 CLI 工具'))
|
|
169
|
+
} else if (registry === 'auto') {
|
|
170
|
+
console.log(chalk.gray(' 检测网络延迟...'))
|
|
171
|
+
registry = 'acr'
|
|
172
|
+
console.log(chalk.gray(` 已选择: ${registry === 'acr' ? '阿里云 ACR' : 'Docker Hub'}`))
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log()
|
|
176
|
+
}
|
|
160
177
|
|
|
161
178
|
// ─────────────────────────────────────────────────────────────
|
|
162
179
|
// 步骤 3: 选择镜像类型(如果需要拉取)
|