@xaidenlabs/uso 1.1.86 → 1.1.89

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.86",
3
+ "version": "1.1.89",
4
4
  "description": "Universal Solana Development Toolchain. Native or Stealth WSL Mode. Build, test, and deploy without the friction.",
5
5
  "bin": {
6
6
  "uso": "bin/index.js"
@@ -116,16 +116,49 @@ const installWsl = async () => {
116
116
  );
117
117
  log.warn("⏳ This may take a few minutes (Downloading ~500MB)...");
118
118
 
119
- // Helper to try install commands
119
+ // Helper to try install commands cleanly
120
120
  const tryInstall = (args, description) => {
121
- log.info(`👉 Attempting: ${description}...`);
122
- // Fix Deprecation: shell: false is safer and prevents warning
123
- const proc = spawnSync("wsl", args, { stdio: "inherit", shell: false });
124
- return proc.status === 0;
121
+ return new Promise((resolve) => {
122
+ const { spawn } = require("child_process");
123
+ const spin = spinner(`Attempting: ${description}...`).start();
124
+ const proc = spawn("wsl", args, { shell: false });
125
+ let output = "";
126
+
127
+ proc.stdout.on("data", (data) => {
128
+ const text = data.toString().replace(/\x00/g, "");
129
+ output += text;
130
+ // Parse progress percentages (e.g., [==== 8.4% ])
131
+ const match = text.match(/(\d+\.\d+)%/);
132
+ if (match) {
133
+ spin.text = `Downloading (${description})... ${match[1]}%`;
134
+ }
135
+ });
136
+
137
+ proc.stderr.on("data", (data) => {
138
+ output += data.toString().replace(/\x00/g, "");
139
+ });
140
+
141
+ proc.on("close", (code) => {
142
+ if (code === 0) {
143
+ spin.succeed(`${description} successful.`);
144
+ resolve(true);
145
+ } else if (
146
+ output.includes("ERROR_ALREADY_EXISTS") ||
147
+ output.includes("already exists") ||
148
+ output.includes("A distribution with the supplied name already exists")
149
+ ) {
150
+ spin.succeed("Uso Engine is already downloaded.");
151
+ resolve(true);
152
+ } else {
153
+ spin.fail(`${description} failed.`);
154
+ resolve(false);
155
+ }
156
+ });
157
+ });
125
158
  };
126
159
 
127
160
  // Attempt 1: Standard Install
128
- let success = tryInstall(
161
+ let success = await tryInstall(
129
162
  ["--install", "-d", WSL_DISTRO],
130
163
  "Standard Install",
131
164
  );
@@ -135,8 +168,8 @@ const installWsl = async () => {
135
168
  log.warn(
136
169
  "⚠️ Standard install failed. Attempting to update WSL kernel...",
137
170
  );
138
- spawnSync("wsl", ["--update"], { stdio: "inherit", shell: false });
139
- success = tryInstall(
171
+ await tryInstall(["--update"], "Update WSL Kernel");
172
+ success = await tryInstall(
140
173
  ["--install", "-d", WSL_DISTRO],
141
174
  "Install after Update",
142
175
  );
@@ -145,7 +178,7 @@ const installWsl = async () => {
145
178
  // Attempt 3: Web Download (Bypasses Microsoft Store blocks)
146
179
  if (!success) {
147
180
  log.warn("⚠️ Still failing. Trying --web-download (Bypasses Store)...");
148
- success = tryInstall(
181
+ success = await tryInstall(
149
182
  ["--install", "-d", WSL_DISTRO, "--web-download"],
150
183
  "Web Download Install",
151
184
  );