claudeup 3.7.0 → 3.7.1
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
|
@@ -160,13 +160,28 @@ async function installBrewPackages(packages, result) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* Detect the best available Node.js package installer for globals
|
|
164
|
+
* Prefers: bun > npm
|
|
164
165
|
*/
|
|
165
|
-
async function
|
|
166
|
+
async function detectNpmCommand() {
|
|
167
|
+
const bunPath = await which("bun");
|
|
168
|
+
if (bunPath) {
|
|
169
|
+
return { cmd: bunPath, args: ["install", "-g"], label: "bun" };
|
|
170
|
+
}
|
|
166
171
|
const npmPath = await which("npm");
|
|
167
|
-
if (
|
|
172
|
+
if (npmPath) {
|
|
173
|
+
return { cmd: npmPath, args: ["install", "-g"], label: "npm" };
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Install global Node.js packages (prefers bun > npm)
|
|
179
|
+
*/
|
|
180
|
+
async function installNpmPackages(packages, result) {
|
|
181
|
+
const installer = await detectNpmCommand();
|
|
182
|
+
if (!installer) {
|
|
168
183
|
for (const pkg of packages) {
|
|
169
|
-
result.failed.push({ pkg: `npm:${pkg}`, error: "npm
|
|
184
|
+
result.failed.push({ pkg: `npm:${pkg}`, error: "No bun or npm found" });
|
|
170
185
|
}
|
|
171
186
|
return;
|
|
172
187
|
}
|
|
@@ -175,12 +190,12 @@ async function installNpmPackages(packages, result) {
|
|
|
175
190
|
result.skipped.push(`npm:${pkg}`);
|
|
176
191
|
continue;
|
|
177
192
|
}
|
|
178
|
-
const { ok, stderr } = await run(
|
|
193
|
+
const { ok, stderr } = await run(installer.cmd, [...installer.args, pkg]);
|
|
179
194
|
if (ok) {
|
|
180
|
-
result.installed.push(
|
|
195
|
+
result.installed.push(`${installer.label}:${pkg}`);
|
|
181
196
|
}
|
|
182
197
|
else {
|
|
183
|
-
result.failed.push({ pkg:
|
|
198
|
+
result.failed.push({ pkg: `${installer.label}:${pkg}`, error: stderr });
|
|
184
199
|
}
|
|
185
200
|
}
|
|
186
201
|
}
|
|
@@ -196,16 +196,36 @@ async function installBrewPackages(
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* Detect the best available Node.js package installer for globals
|
|
200
|
+
* Prefers: bun > npm
|
|
201
|
+
*/
|
|
202
|
+
async function detectNpmCommand(): Promise<{
|
|
203
|
+
cmd: string;
|
|
204
|
+
args: string[];
|
|
205
|
+
label: string;
|
|
206
|
+
} | null> {
|
|
207
|
+
const bunPath = await which("bun");
|
|
208
|
+
if (bunPath) {
|
|
209
|
+
return { cmd: bunPath, args: ["install", "-g"], label: "bun" };
|
|
210
|
+
}
|
|
211
|
+
const npmPath = await which("npm");
|
|
212
|
+
if (npmPath) {
|
|
213
|
+
return { cmd: npmPath, args: ["install", "-g"], label: "npm" };
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Install global Node.js packages (prefers bun > npm)
|
|
200
220
|
*/
|
|
201
221
|
async function installNpmPackages(
|
|
202
222
|
packages: string[],
|
|
203
223
|
result: SetupResult,
|
|
204
224
|
): Promise<void> {
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
225
|
+
const installer = await detectNpmCommand();
|
|
226
|
+
if (!installer) {
|
|
207
227
|
for (const pkg of packages) {
|
|
208
|
-
result.failed.push({ pkg: `npm:${pkg}`, error: "npm
|
|
228
|
+
result.failed.push({ pkg: `npm:${pkg}`, error: "No bun or npm found" });
|
|
209
229
|
}
|
|
210
230
|
return;
|
|
211
231
|
}
|
|
@@ -216,11 +236,11 @@ async function installNpmPackages(
|
|
|
216
236
|
continue;
|
|
217
237
|
}
|
|
218
238
|
|
|
219
|
-
const { ok, stderr } = await run(
|
|
239
|
+
const { ok, stderr } = await run(installer.cmd, [...installer.args, pkg]);
|
|
220
240
|
if (ok) {
|
|
221
|
-
result.installed.push(
|
|
241
|
+
result.installed.push(`${installer.label}:${pkg}`);
|
|
222
242
|
} else {
|
|
223
|
-
result.failed.push({ pkg:
|
|
243
|
+
result.failed.push({ pkg: `${installer.label}:${pkg}`, error: stderr });
|
|
224
244
|
}
|
|
225
245
|
}
|
|
226
246
|
}
|