@xaidenlabs/uso 1.1.68 → 1.1.69
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 +1 -1
- package/src/commands/init.js +4 -3
- package/src/platforms/wsl.js +48 -13
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -28,13 +28,14 @@ const init = async (component, options) => {
|
|
|
28
28
|
|
|
29
29
|
const wslInstalled = await installWslFeature();
|
|
30
30
|
|
|
31
|
-
if (!wslInstalled) {
|
|
31
|
+
if (!wslInstalled && !shell.which('wsl')) {
|
|
32
32
|
// installWslFeature already printed the relevant error/reboot message
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
// If
|
|
37
|
-
//
|
|
36
|
+
// If wsl.exe is now available, continue straight into the Ubuntu setup.
|
|
37
|
+
// On some machines this still needs a reboot, but we let the distro phase
|
|
38
|
+
// run immediately so setup can continue as far as the system allows.
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
// WSL binary is present — run the full WSL toolchain install
|
package/src/platforms/wsl.js
CHANGED
|
@@ -8,6 +8,39 @@ const { spawnSync } = require("child_process");
|
|
|
8
8
|
const chalk = require("chalk");
|
|
9
9
|
const WSL_DISTRO = "Ubuntu";
|
|
10
10
|
|
|
11
|
+
const progressHelpers = `
|
|
12
|
+
print_progress() {
|
|
13
|
+
local label="$1"
|
|
14
|
+
local percent="$2"
|
|
15
|
+
printf "\r%s %d%%" "$label" "$percent"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
run_with_progress() {
|
|
19
|
+
local label="$1"
|
|
20
|
+
local start="$2"
|
|
21
|
+
local end="$3"
|
|
22
|
+
shift 3
|
|
23
|
+
|
|
24
|
+
"$@" &
|
|
25
|
+
local pid=$!
|
|
26
|
+
local current="$start"
|
|
27
|
+
|
|
28
|
+
while kill -0 "$pid" 2>/dev/null; do
|
|
29
|
+
print_progress "$label" "$current"
|
|
30
|
+
if [ "$current" -lt "$((end - 1))" ]; then
|
|
31
|
+
current=$((current + 1))
|
|
32
|
+
fi
|
|
33
|
+
sleep 2
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
wait "$pid"
|
|
37
|
+
local status=$?
|
|
38
|
+
print_progress "$label" "$end"
|
|
39
|
+
printf "\n"
|
|
40
|
+
return "$status"
|
|
41
|
+
}
|
|
42
|
+
`.replace(/\r\n/g, "\n");
|
|
43
|
+
|
|
11
44
|
/**
|
|
12
45
|
* Installs the WSL Windows Feature via an elevated PowerShell UAC prompt.
|
|
13
46
|
* This is needed when `wsl.exe` is not present on the system at all.
|
|
@@ -126,9 +159,7 @@ const installWsl = async () => {
|
|
|
126
159
|
"\n👉 ACTION REQUIRED: Run this command manually in PowerShell as Administrator:",
|
|
127
160
|
);
|
|
128
161
|
console.log(
|
|
129
|
-
chalk.bold.yellow(
|
|
130
|
-
` wsl --install -d ${WSL_DISTRO} --web-download`,
|
|
131
|
-
),
|
|
162
|
+
chalk.bold.yellow(` wsl --install -d ${WSL_DISTRO} --web-download`),
|
|
132
163
|
);
|
|
133
164
|
log.warn(
|
|
134
165
|
"\nOnce that completes successfully, run 'uso setup --wsl' again.",
|
|
@@ -168,10 +199,10 @@ const installWsl = async () => {
|
|
|
168
199
|
set -e
|
|
169
200
|
export DEBIAN_FRONTEND=noninteractive
|
|
170
201
|
|
|
202
|
+
${progressHelpers}
|
|
203
|
+
|
|
171
204
|
if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
|
|
172
|
-
|
|
173
|
-
apt-get update -y -qq
|
|
174
|
-
apt-get install -y -qq curl build-essential pkg-config libssl-dev libudev-dev
|
|
205
|
+
run_with_progress "📦 Installing system build tools..." 0 100 bash -lc "apt-get update -y -qq && apt-get install -y -qq curl build-essential pkg-config libssl-dev libudev-dev"
|
|
175
206
|
echo "✅ Build tools installed."
|
|
176
207
|
else
|
|
177
208
|
echo "✅ Build tools already present."
|
|
@@ -201,6 +232,8 @@ fi
|
|
|
201
232
|
# NO set -e — we handle errors per-step
|
|
202
233
|
FAILURES=""
|
|
203
234
|
|
|
235
|
+
${progressHelpers}
|
|
236
|
+
|
|
204
237
|
# Hush login
|
|
205
238
|
touch ~/.hushlogin
|
|
206
239
|
|
|
@@ -224,7 +257,7 @@ else
|
|
|
224
257
|
echo "✅ Rust repaired."
|
|
225
258
|
else
|
|
226
259
|
echo "🦀 Installing Rust..."
|
|
227
|
-
|
|
260
|
+
if run_with_progress "🦀 Installing Rust..." 10 35 bash -lc "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; then
|
|
228
261
|
source $HOME/.cargo/env 2>/dev/null || true
|
|
229
262
|
rustup toolchain install stable >/dev/null 2>&1 || true
|
|
230
263
|
rustup default stable >/dev/null 2>&1 || true
|
|
@@ -248,9 +281,9 @@ source $HOME/.cargo/env 2>/dev/null || true
|
|
|
248
281
|
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
249
282
|
if ! command -v solana &> /dev/null; then
|
|
250
283
|
echo "☀️ Installing Solana CLI..."
|
|
251
|
-
|
|
284
|
+
if run_with_progress "☀️ Installing Solana CLI..." 35 60 bash -lc 'sh -c "$(curl -sSfL https://release.solana.com/stable/install)"'; then
|
|
252
285
|
echo "✅ Solana installed."
|
|
253
|
-
|
|
286
|
+
elif run_with_progress "☀️ Installing Solana CLI..." 35 60 bash -lc 'sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"'; then
|
|
254
287
|
echo "✅ Solana installed (via Agave)."
|
|
255
288
|
else
|
|
256
289
|
FAILURES="$FAILURES solana"
|
|
@@ -266,7 +299,7 @@ if ! command -v anchor &> /dev/null; then
|
|
|
266
299
|
# Install AVM if not present
|
|
267
300
|
if ! command -v avm &> /dev/null; then
|
|
268
301
|
echo "⚓ Installing AVM (compiling from source, ~5 min)..."
|
|
269
|
-
|
|
302
|
+
if run_with_progress "⚓ Installing AVM (compiling from source)..." 60 85 cargo install --git https://github.com/coral-xyz/anchor avm --locked --force; then
|
|
270
303
|
echo "✅ AVM compiled."
|
|
271
304
|
else
|
|
272
305
|
FAILURES="$FAILURES avm"
|
|
@@ -279,12 +312,12 @@ if ! command -v anchor &> /dev/null; then
|
|
|
279
312
|
# Install Anchor via AVM (try binary first, then compile from source)
|
|
280
313
|
if command -v avm &> /dev/null; then
|
|
281
314
|
echo "⚓ Installing Anchor CLI..."
|
|
282
|
-
|
|
315
|
+
if run_with_progress "⚓ Installing Anchor CLI..." 85 100 avm install latest; then
|
|
283
316
|
avm use latest
|
|
284
317
|
echo "✅ Anchor installed."
|
|
285
318
|
else
|
|
286
319
|
echo "⚠️ Binary download timed out. Building from source (this takes ~10 min)..."
|
|
287
|
-
|
|
320
|
+
if run_with_progress "⚓ Building Anchor CLI from source..." 85 100 avm install latest --force; then
|
|
288
321
|
avm use latest
|
|
289
322
|
echo "✅ Anchor built from source."
|
|
290
323
|
else
|
|
@@ -316,7 +349,9 @@ fi
|
|
|
316
349
|
const spin2 = spinner(
|
|
317
350
|
"Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...",
|
|
318
351
|
).start();
|
|
319
|
-
const userRes = shell.exec(
|
|
352
|
+
const userRes = shell.exec(
|
|
353
|
+
`wsl -d ${WSL_DISTRO} -e bash "${wslUserScriptPath}"`,
|
|
354
|
+
);
|
|
320
355
|
fs.unlinkSync(userScriptPath);
|
|
321
356
|
|
|
322
357
|
if (userRes.code === 0) {
|