@dephub/package-install
Advanced tools
+28
-28
@@ -1,9 +0,9 @@ | ||
| import { confirm as e } from "@dephub/ask"; | ||
| import { log as r, error as s, warn as n } from "@dephub/log"; | ||
| import { packageManager as i } from "@dephub/package-manager"; | ||
| import { spawnStream as c } from "@dephub/spawn"; | ||
| class l { | ||
| import { confirm as r } from "@dephub/ask"; | ||
| import { logger as t } from "@dephub/logger"; | ||
| import { packageManager as s } from "@dephub/package-manager"; | ||
| import { spawnStream as n } from "@dephub/spawn"; | ||
| class i { | ||
| #a; | ||
| #t = ""; | ||
| #e = "production"; | ||
| #e = ""; | ||
| #t = "production"; | ||
| /** | ||
@@ -14,3 +14,3 @@ * Creates a new InstallBuilder instance. | ||
| constructor(a) { | ||
| a?.packageManager && (this.#a = a.packageManager), a?.name && (this.#t = a.name), a?.scope && (this.#e = a.scope); | ||
| a?.packageManager && (this.#a = a.packageManager), a?.name && (this.#e = a.name), a?.scope && (this.#t = a.scope); | ||
| } | ||
@@ -31,3 +31,3 @@ /** | ||
| setName(a) { | ||
| return this.#t = a, this; | ||
| return this.#e = a, this; | ||
| } | ||
@@ -40,3 +40,3 @@ /** | ||
| setScope(a) { | ||
| return this.#e = a, this; | ||
| return this.#t = a, this; | ||
| } | ||
@@ -49,3 +49,3 @@ /** | ||
| async detectPackageManager() { | ||
| const a = await i.detectFirst(); | ||
| const a = await s.detectFirst(); | ||
| if (a) | ||
@@ -63,3 +63,3 @@ this.#a = a; | ||
| async install() { | ||
| if (!this.#t) | ||
| if (!this.#e) | ||
| throw new Error("Package name must be set"); | ||
@@ -69,6 +69,6 @@ this.#a || await this.detectPackageManager(); | ||
| const a = this.#s(); | ||
| return r(this.#a, ...a), await c(this.#a, a), this.#r(!0); | ||
| return t.log(this.#a, ...a), await n(this.#a, a), this.#r(!0); | ||
| } catch (a) { | ||
| const t = a instanceof Error ? a.message : String(a); | ||
| return s(`Failed to install ${this.#t}: ${t}`), this.#r(!1, t); | ||
| const e = a instanceof Error ? a.message : String(a); | ||
| return t.error(`Failed to install ${this.#e}: ${e}`), this.#r(!1, e); | ||
| } | ||
@@ -86,3 +86,3 @@ } | ||
| async askInstall() { | ||
| return await this.#n() ? await this.install() : (n("Skipped installation."), { | ||
| return await this.#n() ? await this.install() : (t.warn("Skipped installation."), { | ||
| ...this.#r(!1), | ||
@@ -98,3 +98,3 @@ skipped: !0 | ||
| yarn: ["add"] | ||
| }, t = { | ||
| }, e = { | ||
| dev: { | ||
@@ -127,12 +127,12 @@ bun: ["--dev"], | ||
| ...a[this.#a], | ||
| ...t[this.#e][this.#a], | ||
| this.#t | ||
| ...e[this.#t][this.#a], | ||
| this.#e | ||
| ]; | ||
| } | ||
| #r(a, t) { | ||
| #r(a, e) { | ||
| return { | ||
| error: t, | ||
| name: this.#t, | ||
| error: e, | ||
| name: this.#e, | ||
| packageManager: this.#a, | ||
| scope: this.#e, | ||
| scope: this.#t, | ||
| success: a | ||
@@ -142,11 +142,11 @@ }; | ||
| async #n() { | ||
| return this.#a || await this.detectPackageManager(), await e( | ||
| `? Install ${this.#t} with ${this.#a}? [y/N]: ` | ||
| return this.#a || await this.detectPackageManager(), await r( | ||
| `? Install ${this.#e} with ${this.#a}? [y/N]: ` | ||
| ); | ||
| } | ||
| } | ||
| const m = new l(); | ||
| const g = new i(); | ||
| export { | ||
| l as InstallBuilder, | ||
| m as installer | ||
| i as InstallBuilder, | ||
| g as installer | ||
| }; |
@@ -1,2 +0,2 @@ | ||
| const e = "@dephub/package-install", a = "1.0.1", s = "Install packages with flexible scope support using your preferred package manager", n = { | ||
| const e = "@dephub/package-install", a = "1.0.2", s = "Install packages with flexible scope support using your preferred package manager", n = { | ||
| name: e, | ||
@@ -3,0 +3,0 @@ version: a, |
+16
-6
| { | ||
| "name": "@dephub/package-install", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Install packages with flexible scope support using your preferred package manager", | ||
@@ -40,10 +40,9 @@ "type": "module", | ||
| "license": "MIT", | ||
| "homepage": "https://github.com/dephubjs/package-install#readme", | ||
| "homepage": "https://github.com/estarlincito/dephub-package-install#readme", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/dephubjs/package-install.git", | ||
| "directory": "packages/package-install" | ||
| "url": "https://github.com/estarlincito/dephub-package-install.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/dephubjs/package-install/issues" | ||
| "url": "https://github.com/estarlincito/dephub-package-install/issues" | ||
| }, | ||
@@ -56,6 +55,17 @@ "publishConfig": { | ||
| "@dephub/cli": "^1.0.0", | ||
| "@dephub/log": "^1.0.0", | ||
| "@dephub/logger": "^1.1.0", | ||
| "@dephub/package-manager": "^1.0.0", | ||
| "@dephub/spawn": "^1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@dephub/glob": "^1.0.0", | ||
| "@dephub/lint": "^1.0.0", | ||
| "@dephub/lint-ts": "^1.0.0", | ||
| "@dephub/path": "^1.0.0", | ||
| "@types/node": "^24.3.1", | ||
| "eslint": "^9.37.0", | ||
| "typescript": "^5.9.2", | ||
| "vite": "^7.1.4", | ||
| "vite-plugin-dts": "^4.5.4" | ||
| }, | ||
| "scripts": { | ||
@@ -62,0 +72,0 @@ "release": "pnpm publish", |
+0
-1
@@ -7,3 +7,2 @@ # @dephub/package-install | ||
| [](https://nodejs.org/) | ||
| [](https://nodejs.org/) | ||
@@ -10,0 +9,0 @@ ## Features ✨ |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
21244
0.81%0
-100%0
-100%9
Infinity%310
-0.32%+ Added
- Removed
- Removed