plusui-native 0.2.65 → 0.2.66

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
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.64",
31
- "plusui-native-connect": "^0.1.64"
30
+ "plusui-native-builder": "^0.1.65",
31
+ "plusui-native-connect": "^0.1.65"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-connect": "^0.1.64"
34
+ "plusui-native-connect": "^0.1.65"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -105,11 +105,20 @@ export class EnvironmentDoctor {
105
105
  for (const result of fixResults) {
106
106
  if (result.success) {
107
107
  console.log(chalk.green(`✓ ${result.name} installed successfully`));
108
+ if (result.pathRefreshNeeded) {
109
+ console.log(chalk.gray(' Note: open a new terminal for the updated PATH to take effect'));
110
+ }
108
111
  } else {
109
112
  console.log(chalk.red(`✗ ${result.name} installation failed`));
110
113
  if (result.message) {
111
114
  console.log(chalk.gray(` ${result.message}`));
112
115
  }
116
+ if (result.reason) {
117
+ console.log(chalk.gray(` Reason: ${result.reason}`));
118
+ }
119
+ if (result.downloadUrl) {
120
+ console.log(chalk.yellow(` Download manually: ${result.downloadUrl}`));
121
+ }
113
122
  if (result.instructions) {
114
123
  console.log(chalk.yellow('\n Manual installation required:'));
115
124
  result.instructions.forEach(line => {
@@ -9,7 +9,9 @@ async function tryCommand(command, timeout = 30000) {
9
9
  }).trim();
10
10
  return { success: true, output };
11
11
  } catch (error) {
12
- return { success: false, error };
12
+ const stderr = (error.stderr || '').toString().trim();
13
+ const stdout = (error.stdout || '').toString().trim();
14
+ return { success: false, error, stderr, stdout };
13
15
  }
14
16
  }
15
17
 
@@ -20,10 +22,14 @@ async function checkWinget() {
20
22
 
21
23
  const INSTALL_COMMANDS = {
22
24
  cmake: {
23
- command: 'winget install -e --id Kitware.CMake --scope user --accept-package-agreements --accept-source-agreements --disable-interactivity',
25
+ // NOTE: Kitware.CMake does NOT support --scope user; omit it so winget
26
+ // uses the package's default (machine) scope. winget will request UAC
27
+ // elevation automatically when needed.
28
+ command: 'winget install -e --id Kitware.CMake --accept-package-agreements --accept-source-agreements --disable-interactivity',
24
29
  manual: 'https://cmake.org/download/',
25
30
  name: 'CMake',
26
- timeout: 300000
31
+ timeout: 300000,
32
+ requiresElevation: true
27
33
  },
28
34
  nodejs: {
29
35
  command: 'winget install -e --id OpenJS.NodeJS --scope user --accept-package-agreements --accept-source-agreements --disable-interactivity',
@@ -91,18 +97,39 @@ export async function installTool(toolName) {
91
97
  return {
92
98
  success: true,
93
99
  message: `${tool.name} installed successfully`,
94
- output: result.output
100
+ output: result.output,
101
+ // Remind callers that the current process PATH won't include the new
102
+ // install – they should re-spawn or check known filesystem paths.
103
+ pathRefreshNeeded: true
95
104
  };
96
105
  }
97
106
 
98
- return {
107
+ // Build a human-readable reason from winget's own output
108
+ const reason = result.stderr || result.stdout ||
109
+ (result.error && result.error.message) ||
110
+ 'Unknown error';
111
+
112
+ const failResult = {
99
113
  success: false,
100
114
  autoInstallAvailable: true,
101
115
  error: result.error,
102
116
  message: `Failed to install ${tool.name} automatically`,
117
+ reason,
103
118
  manual: tool.manual,
104
119
  downloadUrl: tool.manual
105
120
  };
121
+
122
+ if (tool.requiresElevation) {
123
+ failResult.instructions = [
124
+ 'This tool requires administrator rights to install system-wide.',
125
+ 'Option 1: Re-run from an elevated (Run as Administrator) terminal:',
126
+ ' plusui doctor --fix',
127
+ `Option 2: Install manually via winget (elevated): ${tool.command}`,
128
+ `Option 3: Download from: ${tool.manual}`
129
+ ];
130
+ }
131
+
132
+ return failResult;
106
133
  }
107
134
 
108
135
  export function getInstallInstructions(toolName) {
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { mkdir, readFile, stat, rm, readdir, writeFile, copyFile } from 'fs/promises';
4
4
  import { existsSync, watch, statSync, mkdirSync } from 'fs';