apteva 0.2.10 → 0.2.11
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/binary.ts +7 -5
package/package.json
CHANGED
package/src/binary.ts
CHANGED
|
@@ -489,7 +489,7 @@ export async function downloadLatestBinary(binDir: string): Promise<{
|
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
// Install via npm (
|
|
492
|
+
// Install/update via npm (locally in project)
|
|
493
493
|
export async function installViaNpm(): Promise<{
|
|
494
494
|
success: boolean;
|
|
495
495
|
version?: string;
|
|
@@ -497,12 +497,14 @@ export async function installViaNpm(): Promise<{
|
|
|
497
497
|
}> {
|
|
498
498
|
const packageName = getNpmPackageName();
|
|
499
499
|
|
|
500
|
-
console.log(`${c.gray}
|
|
500
|
+
console.log(`${c.gray}Updating ${packageName}...${c.reset}`);
|
|
501
501
|
|
|
502
502
|
try {
|
|
503
|
-
|
|
503
|
+
// Install locally (not globally) - updates the package in node_modules
|
|
504
|
+
const proc = Bun.spawn(["npm", "update", packageName], {
|
|
504
505
|
stdout: "pipe",
|
|
505
506
|
stderr: "pipe",
|
|
507
|
+
cwd: join(import.meta.dir, ".."), // Run in package root
|
|
506
508
|
});
|
|
507
509
|
|
|
508
510
|
const exitCode = await proc.exited;
|
|
@@ -511,7 +513,7 @@ export async function installViaNpm(): Promise<{
|
|
|
511
513
|
const stderr = await new Response(proc.stderr).text();
|
|
512
514
|
return {
|
|
513
515
|
success: false,
|
|
514
|
-
error: stderr || `npm
|
|
516
|
+
error: stderr || `npm update failed with code ${exitCode}`,
|
|
515
517
|
};
|
|
516
518
|
}
|
|
517
519
|
|
|
@@ -519,7 +521,7 @@ export async function installViaNpm(): Promise<{
|
|
|
519
521
|
if (version) {
|
|
520
522
|
saveVersion(version);
|
|
521
523
|
}
|
|
522
|
-
console.log(`${c.green}
|
|
524
|
+
console.log(`${c.green}Updated agent to v${version || "latest"}${c.reset}`);
|
|
523
525
|
|
|
524
526
|
return {
|
|
525
527
|
success: true,
|