@xaidenlabs/uso 1.1.20 → 1.1.21

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": "@xaidenlabs/uso",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "Universal Solana Orchestrator - A one-command setup tool for Solana and Anchor development environments on Windows, macOS, and Linux.",
5
5
  "bin": {
6
6
  "uso": "bin/index.js"
@@ -6,15 +6,43 @@ const path = require('path');
6
6
  const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
7
7
  log.header("🪟 Windows detected.");
8
8
 
9
- // 1. Check for C++ Build Tools
10
- if (shouldInstallRust) {
9
+ // 1. Check for C++ Build Tools (Robust)
10
+ // Rust needs C++, Anchor needs Rust.
11
+ // We check this if we are installing either, because even if Rust is present,
12
+ // Anchor build might fail if C++ tools are missing/broken.
13
+ if (shouldInstallRust || shouldInstallSolana) {
11
14
  const hasCl = shell.which('cl');
15
+ let hasCppTools = false;
16
+
17
+ // Try vswhere if cl is missing
12
18
  if (!hasCl) {
13
- log.warn("⚠️ Visual Studio C++ Build Tools (cl.exe) not found!");
14
- log.error("❌ Rust and Anchor CANNOT run without these tools.");
15
- log.warn("👉 Please install them from: https://visualstudio.microsoft.com/visual-cpp-build-tools/");
16
- log.warn(" Make sure to select 'Desktop development with C++' workload.");
17
- log.warn(" After installing, restart your terminal and run `uso init` again.");
19
+ const programFilesx86 = process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)';
20
+ const vswhere = path.join(programFilesx86, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe');
21
+
22
+ if (fs.existsSync(vswhere)) {
23
+ // Check specifically for VC++ tools
24
+ const toolsCheck = shell.exec(`"${vswhere}" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`, { silent: true });
25
+ if (toolsCheck.code === 0 && toolsCheck.stdout.trim().length > 0) {
26
+ hasCppTools = true;
27
+ }
28
+ }
29
+ } else {
30
+ hasCppTools = true;
31
+ }
32
+
33
+ if (!hasCppTools) {
34
+ log.error("❌ Critical Dependency Missing: Visual Studio C++ Build Tools");
35
+ log.error(" Rust and Anchor CANNOT run without these tools.");
36
+ log.warn("👉 Install from: https://visualstudio.microsoft.com/visual-cpp-build-tools/");
37
+ log.warn(" Workload required: 'Desktop development with C++'");
38
+ log.warn(" Aborting installation to prevent broken setup.");
39
+ return false; // STOP HERE
40
+ }
41
+
42
+ if (!hasCl && hasCppTools) {
43
+ log.warn("⚠️ C++ Build Tools are installed but 'cl.exe' is not in PATH.");
44
+ log.warn(" You may need to restart your terminal or launch 'Developer Command Prompt for VS'.");
45
+ // We continue, hoping rustup might find it, but it's risky.
18
46
  }
19
47
  }
20
48
 
@@ -23,8 +51,12 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
23
51
  log.info("🦀 Installing Rust (rustup-init.exe)...");
24
52
  shell.exec('powershell -Command "Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile rustup-init.exe"');
25
53
 
26
- // Unblock the file to prevent Device Guard/SmartScreen issues
27
- shell.exec('powershell -Command "Unblock-File -Path rustup-init.exe"');
54
+ // Unblock the file (Robust)
55
+ const unblock = shell.exec('powershell -Command "Unblock-File -Path rustup-init.exe"');
56
+ if (unblock.code !== 0) {
57
+ log.warn("⚠️ Failed to unblock rustup-init.exe. Trying elevated...");
58
+ shell.exec('powershell -Command "Start-Process powershell -ArgumentList \'Unblock-File -Path rustup-init.exe\' -Verb RunAs -Wait"');
59
+ }
28
60
 
29
61
  const rustInstall = shell.exec('powershell -Command "./rustup-init.exe -y"');
30
62
 
@@ -49,8 +81,12 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
49
81
  const downloadCmd = 'powershell -Command "Invoke-WebRequest -Uri https://release.anza.xyz/stable/solana-install-init-x86_64-pc-windows-msvc.exe -OutFile solana-install.exe"';
50
82
  const dlResult = shell.exec(downloadCmd);
51
83
 
52
- // Unblock the file to prevent Device Guard/SmartScreen issues
53
- shell.exec('powershell -Command "Unblock-File -Path solana-install.exe"');
84
+ // Unblock the file (Robust)
85
+ const unblockSolana = shell.exec('powershell -Command "Unblock-File -Path solana-install.exe"');
86
+ if (unblockSolana.code !== 0) {
87
+ log.warn("⚠️ Failed to unblock solana-install.exe via Unblock-File. Trying elevated...");
88
+ shell.exec('powershell -Command "Start-Process powershell -ArgumentList \'Unblock-File -Path solana-install.exe\' -Verb RunAs -Wait"');
89
+ }
54
90
 
55
91
  if (dlResult.code !== 0) {
56
92
  log.error("❌ Failed to download Solana installer.");