@dephub/package-install
Advanced tools
+18
-18
@@ -1,2 +0,2 @@ | ||
| import { confirm as t } from "@dephub/ask"; | ||
| import { confirm as e } from "@dephub/ask"; | ||
| import { log as r, error as s, warn as n } from "@dephub/log"; | ||
@@ -7,4 +7,4 @@ import { packageManager as i } from "@dephub/package-manager"; | ||
| #a; | ||
| #e = ""; | ||
| #t = "production"; | ||
| #t = ""; | ||
| #e = "production"; | ||
| /** | ||
@@ -15,3 +15,3 @@ * Creates a new InstallBuilder instance. | ||
| constructor(a) { | ||
| a?.packageManager && (this.#a = a.packageManager), a?.name && (this.#e = a.name), a?.scope && (this.#t = a.scope); | ||
| a?.packageManager && (this.#a = a.packageManager), a?.name && (this.#t = a.name), a?.scope && (this.#e = a.scope); | ||
| } | ||
@@ -32,3 +32,3 @@ /** | ||
| setName(a) { | ||
| return this.#e = a, this; | ||
| return this.#t = a, this; | ||
| } | ||
@@ -41,3 +41,3 @@ /** | ||
| setScope(a) { | ||
| return this.#t = a, this; | ||
| return this.#e = a, this; | ||
| } | ||
@@ -63,3 +63,3 @@ /** | ||
| async install() { | ||
| if (!this.#e) | ||
| if (!this.#t) | ||
| throw new Error("Package name must be set"); | ||
@@ -71,4 +71,4 @@ this.#a || await this.detectPackageManager(); | ||
| } catch (a) { | ||
| const e = a instanceof Error ? a.message : String(a); | ||
| return s(`Failed to install ${this.#e}: ${e}`), this.#r(!1, e); | ||
| const t = a instanceof Error ? a.message : String(a); | ||
| return s(`Failed to install ${this.#t}: ${t}`), this.#r(!1, t); | ||
| } | ||
@@ -97,3 +97,3 @@ } | ||
| yarn: ["add"] | ||
| }, e = { | ||
| }, t = { | ||
| dev: { | ||
@@ -126,12 +126,12 @@ bun: ["--dev"], | ||
| ...a[this.#a], | ||
| ...e[this.#t][this.#a], | ||
| this.#e | ||
| ...t[this.#e][this.#a], | ||
| this.#t | ||
| ]; | ||
| } | ||
| #r(a, e) { | ||
| #r(a, t) { | ||
| return { | ||
| error: e, | ||
| name: this.#e, | ||
| error: t, | ||
| name: this.#t, | ||
| packageManager: this.#a, | ||
| scope: this.#t, | ||
| scope: this.#e, | ||
| success: a | ||
@@ -141,4 +141,4 @@ }; | ||
| async #n() { | ||
| return await t( | ||
| `? Install ${this.#e} with ${this.#a}? [y/N]: ` | ||
| return this.#a || await this.detectPackageManager(), await e( | ||
| `? Install ${this.#t} with ${this.#a}? [y/N]: ` | ||
| ); | ||
@@ -145,0 +145,0 @@ } |
@@ -1,2 +0,2 @@ | ||
| const e = "@dephub/package-install", a = "1.0.0", s = "Install packages with flexible scope support using your preferred package manager", n = { | ||
| const e = "@dephub/package-install", a = "1.0.1", s = "Install packages with flexible scope support using your preferred package manager", n = { | ||
| name: e, | ||
@@ -3,0 +3,0 @@ version: a, |
+1
-1
| { | ||
| "name": "@dephub/package-install", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "Install packages with flexible scope support using your preferred package manager", | ||
@@ -5,0 +5,0 @@ "type": "module", |
21073
0.22%