plusui-native 0.2.69 → 0.2.70

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.js +64 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.69",
3
+ "version": "0.2.70",
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.68",
31
- "plusui-native-connect": "^0.1.68"
30
+ "plusui-native-builder": "^0.1.69",
31
+ "plusui-native-connect": "^0.1.69"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-connect": "^0.1.68"
34
+ "plusui-native-connect": "^0.1.69"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.js CHANGED
@@ -211,8 +211,56 @@ function getCMakePath() {
211
211
  return 'cmake';
212
212
  }
213
213
 
214
+ // Find vcvarsall.bat for Windows builds (needed for Ninja generator)
215
+ let _vcvarsallCache = undefined;
216
+ function findVcvarsall() {
217
+ if (_vcvarsallCache !== undefined) return _vcvarsallCache;
218
+
219
+ const vswherePath = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe';
220
+ if (existsSync(vswherePath)) {
221
+ try {
222
+ const installPath = execSync(
223
+ `"${vswherePath}" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`,
224
+ { stdio: ['pipe', 'pipe', 'pipe'], encoding: 'utf8', timeout: 10000 }
225
+ ).trim();
226
+ if (installPath) {
227
+ const vcvars = join(installPath, 'VC', 'Auxiliary', 'Build', 'vcvarsall.bat');
228
+ if (existsSync(vcvars)) {
229
+ _vcvarsallCache = vcvars;
230
+ return vcvars;
231
+ }
232
+ }
233
+ } catch { }
234
+ }
235
+
236
+ // Fallback: scan known paths
237
+ const vsYears = ['2026', '2025', '2024', '2023', '2022', '2019'];
238
+ const vsEditions = ['Community', 'Professional', 'Enterprise', 'BuildTools'];
239
+ for (const year of vsYears) {
240
+ for (const edition of vsEditions) {
241
+ const vcvars = `C:\\Program Files\\Microsoft Visual Studio\\${year}\\${edition}\\VC\\Auxiliary\\Build\\vcvarsall.bat`;
242
+ if (existsSync(vcvars)) {
243
+ _vcvarsallCache = vcvars;
244
+ return vcvars;
245
+ }
246
+ }
247
+ }
248
+
249
+ _vcvarsallCache = null;
250
+ return null;
251
+ }
252
+
214
253
  function runCMake(args, options = {}) {
215
254
  const cmake = getCMakePath();
255
+
256
+ // On Windows, wrap cmake in vcvarsall to ensure cl.exe is in PATH (needed for Ninja)
257
+ if (process.platform === 'win32') {
258
+ const vcvarsall = findVcvarsall();
259
+ if (vcvarsall) {
260
+ return execSync(`cmd /c ""${vcvarsall}" x64 >nul 2>&1 && "${cmake}" ${args}"`, { stdio: 'inherit', shell: true, ...options });
261
+ }
262
+ }
263
+
216
264
  return execSync(`"${cmake}" ${args}`, { stdio: 'inherit', ...options });
217
265
  }
218
266
 
@@ -598,6 +646,9 @@ function buildBackend(platform = null, devMode = false) {
598
646
 
599
647
  if (platformConfig.generator) {
600
648
  cmakeArgs += ` -G "${platformConfig.generator}"`;
649
+ } else if (process.platform === 'win32') {
650
+ // Use Ninja on Windows to avoid VS generator compatibility issues
651
+ cmakeArgs += ' -G Ninja';
601
652
  }
602
653
 
603
654
  log(`Configuring CMake...`, 'blue');
@@ -789,9 +840,15 @@ async function startBackend() {
789
840
 
790
841
  const buildDir = getDevBuildDir();
791
842
 
843
+ // On Windows, use Ninja generator to avoid VS generator compatibility issues
844
+ let generatorArgs = '';
845
+ if (process.platform === 'win32') {
846
+ generatorArgs = ' -G Ninja';
847
+ }
848
+
792
849
  // Always configure with dev mode to ensure PLUSUI_DEV_MODE is set correctly
793
850
  log('Configuring CMake...', 'blue');
794
- runCMake(`-S . -B "${buildDir}" -DPLUSUI_DEV_MODE=ON`);
851
+ runCMake(`-S . -B "${buildDir}" -DPLUSUI_DEV_MODE=ON${generatorArgs}`);
795
852
 
796
853
  log('Compiling...', 'blue');
797
854
  runCMake(`--build "${buildDir}"`);
@@ -799,16 +856,17 @@ async function startBackend() {
799
856
  // Find executable
800
857
  let exePath;
801
858
  if (process.platform === 'win32') {
802
- // Visual Studio puts exe in build/dev/<projectname>/Debug/<projectname>.exe
803
- exePath = join(buildDir, projectName, 'Debug', `${projectName}.exe`);
859
+ // Ninja puts exe directly in build dir
860
+ exePath = join(buildDir, `${projectName}.exe`);
804
861
  if (!existsSync(exePath)) {
805
- exePath = join(buildDir, 'Debug', `${projectName}.exe`);
862
+ exePath = join(buildDir, 'bin', `${projectName}.exe`);
806
863
  }
864
+ // Fallback for VS generator (Debug subfolder)
807
865
  if (!existsSync(exePath)) {
808
- exePath = join(buildDir, 'bin', `${projectName}.exe`);
866
+ exePath = join(buildDir, projectName, 'Debug', `${projectName}.exe`);
809
867
  }
810
868
  if (!existsSync(exePath)) {
811
- exePath = join(buildDir, `${projectName}.exe`);
869
+ exePath = join(buildDir, 'Debug', `${projectName}.exe`);
812
870
  }
813
871
  } else {
814
872
  exePath = join(buildDir, projectName);