@vyr/cli 0.0.40 → 0.0.41
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/setup/index.js +2 -2
- package/.bin/setup/install-vcredist.js +91 -31
- package/output/auto-provider-plugin/package.json +1 -1
- package/output/builtin/package.json +1 -1
- package/output/class-wrapper-plugin/package.json +1 -1
- package/output/declare/package.json +2 -2
- package/output/design/package.json +1 -1
- package/output/engine/package.json +2 -2
- package/output/gateway/package.json +2 -2
- package/output/locale/package.json +1 -1
- package/output/remote/package.json +1 -1
- package/output/rollup-config-plugin/package.json +1 -1
- package/output/runtime/package.json +1 -1
- package/output/service/package.json +1 -1
- package/output/service-asset/package.json +1 -1
- package/output/service-chat/package.json +1 -1
- package/output/service-gateway/package.json +1 -1
- package/output/service-graph/package.json +1 -1
- package/output/service-prefab/package.json +1 -1
- package/output/service-user/package.json +1 -1
- package/output/var-rename-plugin/package.json +1 -1
- package/package.json +2 -2
package/.bin/setup/index.js
CHANGED
|
@@ -5,13 +5,13 @@ const { installVcredist } = require('./install-vcredist');
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
name: "setup",
|
|
7
7
|
options: { isDefault: false },
|
|
8
|
-
run(options) {
|
|
8
|
+
async run(options) {
|
|
9
9
|
const cwd = getCwd()
|
|
10
10
|
if (validateCwd(cwd) === false) return
|
|
11
11
|
|
|
12
12
|
initDatabase(options, cwd)
|
|
13
13
|
|
|
14
|
-
installVcredist()
|
|
14
|
+
await installVcredist()
|
|
15
15
|
|
|
16
16
|
process.exit(0)
|
|
17
17
|
},
|
|
@@ -29,7 +29,9 @@ function getSystemArchitecture() {
|
|
|
29
29
|
encoding: 'utf8',
|
|
30
30
|
windowsHide: true
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
let architecture = result.trim().split('\n')[1].trim().toLowerCase();
|
|
33
|
+
// 清理架构名称,移除多余字符
|
|
34
|
+
architecture = architecture.replace(/[^a-z0-9]/g, '');
|
|
33
35
|
console.log(`[INFO] 系统架构: ${architecture}`);
|
|
34
36
|
return architecture;
|
|
35
37
|
} catch (error) {
|
|
@@ -72,13 +74,35 @@ function checkNetworkConnectivity() {
|
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
function checkVCRedistFiles(architecture) {
|
|
78
|
+
// 检查关键 DLL 文件是否存在
|
|
79
|
+
const systemDir = architecture === 'x64' ?
|
|
80
|
+
process.env.WINDIR + '\\System32' :
|
|
81
|
+
process.env.WINDIR + '\\SysWOW64';
|
|
82
|
+
|
|
83
|
+
const dllFiles = [
|
|
84
|
+
'vcruntime140.dll',
|
|
85
|
+
'msvcp140.dll'
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
for (const dll of dllFiles) {
|
|
89
|
+
const dllPath = path.join(systemDir, dll);
|
|
90
|
+
if (fs.existsSync(dllPath)) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
75
97
|
function getInstalledVCRedistVersions() {
|
|
76
98
|
console.log('[INFO] 检查已安装的 Visual C++ Redistributable 版本...');
|
|
77
99
|
|
|
78
|
-
const
|
|
100
|
+
const installed = [];
|
|
101
|
+
const seen = new Set(); // 用于跟踪已添加的版本和架构组合
|
|
79
102
|
|
|
80
103
|
try {
|
|
81
|
-
|
|
104
|
+
// 使用更精确的 wmic 查询,只获取实际安装的产品
|
|
105
|
+
const result = execSync('wmic product where "name like \'Microsoft Visual C++%\' AND NOT name like \'%Preview%\'" get name,version', {
|
|
82
106
|
encoding: 'utf8',
|
|
83
107
|
windowsHide: true
|
|
84
108
|
});
|
|
@@ -89,23 +113,59 @@ function getInstalledVCRedistVersions() {
|
|
|
89
113
|
const line = lines[i].trim();
|
|
90
114
|
const versionMatch = line.match(/(\d+\.\d+\.\d+)/);
|
|
91
115
|
if (versionMatch) {
|
|
92
|
-
|
|
116
|
+
const version = versionMatch[1];
|
|
117
|
+
let architecture = 'unknown';
|
|
118
|
+
if (line.toLowerCase().includes('x64') || line.toLowerCase().includes('64-bit')) {
|
|
119
|
+
architecture = 'x64';
|
|
120
|
+
} else if (line.toLowerCase().includes('x86') || line.toLowerCase().includes('32-bit')) {
|
|
121
|
+
architecture = 'x86';
|
|
122
|
+
} else if (line.toLowerCase().includes('arm')) {
|
|
123
|
+
architecture = 'arm64';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 验证文件系统中是否存在相关 DLL 文件
|
|
127
|
+
if (checkVCRedistFiles(architecture)) {
|
|
128
|
+
const key = `${version}-${architecture}`;
|
|
129
|
+
if (!seen.has(key)) {
|
|
130
|
+
seen.add(key);
|
|
131
|
+
installed.push({ version, architecture });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
93
134
|
}
|
|
94
135
|
}
|
|
95
136
|
|
|
96
137
|
} catch (error) {
|
|
97
138
|
console.log('[WARN] wmic查询失败,尝试注册表查询...');
|
|
98
139
|
try {
|
|
99
|
-
|
|
140
|
+
// 使用更精确的注册表查询,检查是否存在 UninstallString
|
|
141
|
+
const result = execSync('powershell -Command "Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | Where-Object {$_.DisplayName -match \'Microsoft Visual C\\+\\+\\ .*Redistributable\' -and $_.UninstallString} | Select-Object DisplayName, DisplayVersion"', {
|
|
100
142
|
encoding: 'utf8',
|
|
101
143
|
windowsHide: true
|
|
102
144
|
});
|
|
103
145
|
|
|
104
146
|
const lines = result.split('\n').filter(line => line.trim());
|
|
105
|
-
for (
|
|
106
|
-
const
|
|
147
|
+
for (let i = 1; i < lines.length; i++) {
|
|
148
|
+
const line = lines[i].trim();
|
|
149
|
+
const versionMatch = line.match(/(\d+\.\d+\.\d+)/);
|
|
107
150
|
if (versionMatch) {
|
|
108
|
-
|
|
151
|
+
const version = versionMatch[1];
|
|
152
|
+
let architecture = 'unknown';
|
|
153
|
+
if (line.toLowerCase().includes('x64') || line.toLowerCase().includes('64-bit')) {
|
|
154
|
+
architecture = 'x64';
|
|
155
|
+
} else if (line.toLowerCase().includes('x86') || line.toLowerCase().includes('32-bit')) {
|
|
156
|
+
architecture = 'x86';
|
|
157
|
+
} else if (line.toLowerCase().includes('arm')) {
|
|
158
|
+
architecture = 'arm64';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 验证文件系统中是否存在相关 DLL 文件
|
|
162
|
+
if (checkVCRedistFiles(architecture)) {
|
|
163
|
+
const key = `${version}-${architecture}`;
|
|
164
|
+
if (!seen.has(key)) {
|
|
165
|
+
seen.add(key);
|
|
166
|
+
installed.push({ version, architecture });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
109
169
|
}
|
|
110
170
|
}
|
|
111
171
|
} catch (e) {
|
|
@@ -113,7 +173,7 @@ function getInstalledVCRedistVersions() {
|
|
|
113
173
|
}
|
|
114
174
|
}
|
|
115
175
|
|
|
116
|
-
return
|
|
176
|
+
return installed;
|
|
117
177
|
}
|
|
118
178
|
|
|
119
179
|
function parseVersion(versionStr) {
|
|
@@ -144,11 +204,14 @@ function compareVersion(version1, version2) {
|
|
|
144
204
|
return 0;
|
|
145
205
|
}
|
|
146
206
|
|
|
147
|
-
function isVersion2022OrHigher(
|
|
148
|
-
for (const
|
|
149
|
-
const comparison = compareVersion(version, config.MIN_VERSION);
|
|
150
|
-
if (comparison >= 0) {
|
|
151
|
-
|
|
207
|
+
function isVersion2022OrHigher(installed, requiredArchitecture) {
|
|
208
|
+
for (const item of installed) {
|
|
209
|
+
const comparison = compareVersion(item.version, config.MIN_VERSION);
|
|
210
|
+
if (comparison >= 0 && (item.architecture === requiredArchitecture || item.architecture === 'unknown')) {
|
|
211
|
+
// 再次验证文件系统中是否存在相关 DLL 文件,确保不是注册表残留
|
|
212
|
+
if (checkVCRedistFiles(requiredArchitecture)) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
152
215
|
}
|
|
153
216
|
}
|
|
154
217
|
return false;
|
|
@@ -219,22 +282,13 @@ function installVCRedist(installerPath) {
|
|
|
219
282
|
|
|
220
283
|
const args = ['/install', '/quiet', '/norestart'];
|
|
221
284
|
|
|
222
|
-
let
|
|
223
|
-
if (!isAdmin()) {
|
|
224
|
-
console.log('[INFO] 非管理员权限,尝试以管理员身份运行安装程序...');
|
|
225
|
-
process = spawn('powershell', [
|
|
285
|
+
let process = spawn('powershell', [
|
|
226
286
|
'-Command',
|
|
227
287
|
`Start-Process "${installerPath}" -ArgumentList "${args.join(' ')}" -Verb RunAs -Wait`
|
|
228
288
|
], {
|
|
229
289
|
windowsHide: true,
|
|
230
290
|
stdio: 'ignore'
|
|
231
291
|
});
|
|
232
|
-
} else {
|
|
233
|
-
process = spawn(installerPath, args, {
|
|
234
|
-
windowsHide: true,
|
|
235
|
-
stdio: 'ignore'
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
292
|
|
|
239
293
|
process.on('close', (code) => {
|
|
240
294
|
if (code === 0 || code === 3010) {
|
|
@@ -279,15 +333,21 @@ exports.installVcredist = async () => {
|
|
|
279
333
|
|
|
280
334
|
// 确定架构对应的下载链接
|
|
281
335
|
let downloadUrl;
|
|
336
|
+
let requiredArchitecture;
|
|
282
337
|
if (architecture.includes('64') || architecture === 'x64') {
|
|
283
338
|
downloadUrl = config.VC_REDIST_2022_URL['x64'];
|
|
339
|
+
requiredArchitecture = 'x64';
|
|
284
340
|
} else if (architecture.includes('arm') || architecture === 'arm64') {
|
|
285
341
|
downloadUrl = config.VC_REDIST_2022_URL['arm64'];
|
|
342
|
+
requiredArchitecture = 'arm64';
|
|
286
343
|
} else {
|
|
287
344
|
downloadUrl = config.VC_REDIST_2022_URL['x86'];
|
|
345
|
+
requiredArchitecture = 'x86';
|
|
288
346
|
}
|
|
289
347
|
|
|
290
348
|
console.log(`[INFO] 最低要求版本: ${config.MIN_VERSION} (Visual Studio 2022)`);
|
|
349
|
+
console.log(`[INFO] 系统架构: ${architecture}`);
|
|
350
|
+
console.log(`[INFO] 需要架构: ${requiredArchitecture}`);
|
|
291
351
|
console.log(`[INFO] 下载链接: ${downloadUrl}`);
|
|
292
352
|
console.log('');
|
|
293
353
|
|
|
@@ -295,25 +355,25 @@ exports.installVcredist = async () => {
|
|
|
295
355
|
|
|
296
356
|
console.log('[INFO] 已安装的版本:');
|
|
297
357
|
if (installedVersions.length > 0) {
|
|
298
|
-
installedVersions.forEach(
|
|
358
|
+
installedVersions.forEach(item => console.log(` - ${item.version} (${item.architecture})`));
|
|
299
359
|
} else {
|
|
300
360
|
console.log(' 未找到已安装的版本');
|
|
301
361
|
}
|
|
302
362
|
|
|
303
363
|
console.log('');
|
|
304
364
|
|
|
305
|
-
if (isVersion2022OrHigher(installedVersions)) {
|
|
306
|
-
console.log(
|
|
365
|
+
if (isVersion2022OrHigher(installedVersions, requiredArchitecture)) {
|
|
366
|
+
console.log(`[OK] Visual C++ Redistributable 2022 或更高版本已安装 (${requiredArchitecture}架构)`);
|
|
307
367
|
console.log('');
|
|
308
368
|
return
|
|
309
369
|
}
|
|
310
370
|
|
|
311
|
-
console.log(
|
|
371
|
+
console.log(`[WARN] 未安装 Visual C++ Redistributable 2022 或更高版本 (${requiredArchitecture}架构)`);
|
|
312
372
|
console.log('[INFO] 正在下载并安装...');
|
|
313
373
|
console.log('');
|
|
314
374
|
|
|
315
375
|
const tempDir = path.join(process.env.TEMP || 'C:\\Temp', 'vc_redist_install');
|
|
316
|
-
const installerPath = path.join(tempDir,
|
|
376
|
+
const installerPath = path.join(tempDir, `vc_redist.${requiredArchitecture}.exe`);
|
|
317
377
|
|
|
318
378
|
try {
|
|
319
379
|
if (!fs.existsSync(tempDir)) {
|
|
@@ -331,8 +391,8 @@ exports.installVcredist = async () => {
|
|
|
331
391
|
console.log('[INFO] 验证安装结果...');
|
|
332
392
|
const newVersions = getInstalledVCRedistVersions();
|
|
333
393
|
|
|
334
|
-
if (isVersion2022OrHigher(newVersions)) {
|
|
335
|
-
console.log(
|
|
394
|
+
if (isVersion2022OrHigher(newVersions, requiredArchitecture)) {
|
|
395
|
+
console.log(`[OK] 验证成功: Visual C++ Redistributable 已正确安装 (${requiredArchitecture}架构)`);
|
|
336
396
|
} else {
|
|
337
397
|
console.log('[WARN] 验证未找到新版本,可能需要重启系统');
|
|
338
398
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/declare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vyr/locale": "0.0.
|
|
9
|
+
"@vyr/locale": "0.0.41"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {},
|
|
12
12
|
"files": [
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vyr/locale": "0.0.
|
|
9
|
+
"@vyr/locale": "0.0.41",
|
|
10
10
|
"decamelize-keys": "^2.0.1",
|
|
11
11
|
"camelcase-keys": "^10.0.1",
|
|
12
12
|
"tinycolor2": "1.6.0",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/gateway",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vyr/engine": "0.0.
|
|
9
|
+
"@vyr/engine": "0.0.41",
|
|
10
10
|
"moment": "^2.30.1"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.20.0"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"output/*"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vyr/locale": "0.0.
|
|
43
|
+
"@vyr/locale": "0.0.41",
|
|
44
44
|
"@babel/preset-typescript": "^7.26.0",
|
|
45
45
|
"@fastify/cors": "^11.1.0",
|
|
46
46
|
"@fastify/multipart": "^9.3.0",
|