plusui-native 0.2.72 → 0.2.73
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 +4 -4
- package/src/index.js +47 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plusui-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.73",
|
|
4
4
|
"description": "PlusUI CLI - Build C++ desktop apps modern UI ",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"semver": "^7.6.0",
|
|
28
28
|
"which": "^4.0.0",
|
|
29
29
|
"execa": "^8.0.1",
|
|
30
|
-
"plusui-native-builder": "^0.1.
|
|
31
|
-
"plusui-native-connect": "^0.1.
|
|
30
|
+
"plusui-native-builder": "^0.1.72",
|
|
31
|
+
"plusui-native-connect": "^0.1.72"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"plusui-native-connect": "^0.1.
|
|
34
|
+
"plusui-native-connect": "^0.1.72"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
package/src/index.js
CHANGED
|
@@ -250,14 +250,57 @@ function findVcvarsall() {
|
|
|
250
250
|
return null;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
// Capture the full environment from vcvarsall.bat (cached per session)
|
|
254
|
+
let _vcEnvCache = undefined;
|
|
255
|
+
function getVcEnvironment() {
|
|
256
|
+
if (_vcEnvCache !== undefined) return _vcEnvCache;
|
|
257
|
+
|
|
258
|
+
if (process.platform !== 'win32') {
|
|
259
|
+
_vcEnvCache = null;
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const vcvarsall = findVcvarsall();
|
|
264
|
+
if (!vcvarsall) {
|
|
265
|
+
_vcEnvCache = null;
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
// Run vcvarsall and dump all environment variables
|
|
271
|
+
const output = execSync(
|
|
272
|
+
`cmd /c ""${vcvarsall}" x64 >nul 2>&1 && set"`,
|
|
273
|
+
{ encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30000, shell: true }
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
// Parse "KEY=VALUE" lines into an env object
|
|
277
|
+
const env = {};
|
|
278
|
+
for (const line of output.split(/\r?\n/)) {
|
|
279
|
+
const idx = line.indexOf('=');
|
|
280
|
+
if (idx > 0) {
|
|
281
|
+
env[line.substring(0, idx)] = line.substring(idx + 1);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Sanity check: we should have PATH and INCLUDE set
|
|
286
|
+
if (env.PATH && env.INCLUDE) {
|
|
287
|
+
_vcEnvCache = env;
|
|
288
|
+
return env;
|
|
289
|
+
}
|
|
290
|
+
} catch { }
|
|
291
|
+
|
|
292
|
+
_vcEnvCache = null;
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
|
|
253
296
|
function runCMake(args, options = {}) {
|
|
254
297
|
const cmake = getCMakePath();
|
|
255
298
|
|
|
256
|
-
// On Windows,
|
|
299
|
+
// On Windows, use the captured vcvarsall environment so cl.exe + ninja are in PATH
|
|
257
300
|
if (process.platform === 'win32') {
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
-
return execSync(`
|
|
301
|
+
const vcEnv = getVcEnvironment();
|
|
302
|
+
if (vcEnv) {
|
|
303
|
+
return execSync(`"${cmake}" ${args}`, { stdio: 'inherit', env: vcEnv, ...options });
|
|
261
304
|
}
|
|
262
305
|
}
|
|
263
306
|
|