package-manager-manager
Advanced tools
Comparing version 0.1.2-5a72851 to 0.1.2-7e6d0b9
@@ -19,4 +19,4 @@ import type { PackageManager } from '../packageManager'; | ||
}; | ||
export type GetRunScript = (script: string, options?: Partial<GetRunScriptOptions>) => string | null; | ||
export type GetRunScriptStruct = (script: string, options?: Partial<GetRunScriptOptions>) => CommandScriptStruct | null; | ||
export type GetRunScript = (script: string, options?: Partial<GetRunScriptOptions>) => Promise<string | null>; | ||
export type GetRunScriptStruct = (script: string, options?: Partial<GetRunScriptOptions>) => Promise<CommandScriptStruct | null>; | ||
export declare function getRunScriptFunctions(packageManager: Pick<PackageManager, 'name' | 'cliCommandKeywords'>): { | ||
@@ -23,0 +23,0 @@ getRunScript: GetRunScript; |
@@ -1,18 +0,18 @@ | ||
var g = (s, t, e) => { | ||
if (!t.has(s)) | ||
throw TypeError("Cannot " + e); | ||
var g = (e, t, s) => { | ||
if (!t.has(e)) | ||
throw TypeError("Cannot " + s); | ||
}; | ||
var l = (s, t, e) => { | ||
if (t.has(s)) | ||
var l = (e, t, s) => { | ||
if (t.has(e)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
t instanceof WeakSet ? t.add(s) : t.set(s, e); | ||
t instanceof WeakSet ? t.add(e) : t.set(e, s); | ||
}; | ||
var m = (s, t, e) => (g(s, t, "access private method"), e); | ||
var m = (e, t, s) => (g(e, t, "access private method"), s); | ||
var u, c; | ||
const h = class { | ||
constructor(t, e, r) { | ||
constructor(t, s, r) { | ||
var d; | ||
this.script = e, this.pmCmd = void 0, this.targetArgs = (r == null ? void 0 : r.args) ?? []; | ||
this.script = s, this.pmCmd = void 0, this.targetArgs = (r == null ? void 0 : r.args) ?? []; | ||
const i = (r == null ? void 0 : r.format) ?? "short"; | ||
this.cmd = t.name, m(d = h, u, c).call(d, t, e, i) && (this.pmCmd = "run"), this.argsNeedDoubleDashes = ["npm", "bun"].includes(t.name); | ||
this.cmd = t.name, m(d = h, u, c).call(d, t, s, i) && (this.pmCmd = "run"), this.argsNeedDoubleDashes = ["npm", "bun"].includes(t.name); | ||
} | ||
@@ -32,10 +32,10 @@ get cmdArgs() { | ||
let n = h; | ||
u = new WeakSet(), c = function(t, e, r) { | ||
return r === "full" ? !0 : e === "start" ? !1 : !!(t.name === "npm" || t.cliCommandKeywords.has(e)); | ||
u = new WeakSet(), c = function(t, s, r) { | ||
return r === "full" ? !0 : s === "start" ? !1 : !!(t.name === "npm" || t.cliCommandKeywords.has(s)); | ||
}, l(n, u); | ||
function C(s) { | ||
const t = (r, i) => r ? new n(s, r, i) : null; | ||
return { getRunScript: (...r) => { | ||
function C(e) { | ||
const t = async (r, i) => r ? new n(e, r, i) : null; | ||
return { getRunScript: async (...r) => { | ||
var i; | ||
return ((i = t(...r)) == null ? void 0 : i.toString()) ?? null; | ||
return ((i = await t(...r)) == null ? void 0 : i.toString()) ?? null; | ||
}, getRunScriptStruct: t }; | ||
@@ -42,0 +42,0 @@ } |
{ | ||
"name": "package-manager-manager", | ||
"version": "0.1.2-5a72851", | ||
"version": "0.1.2-7e6d0b9", | ||
"description": "Utilities for managing package managers.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,3 +7,3 @@ import p from "shellac"; | ||
import { lockFiles as c } from "./utils/locks.js"; | ||
import { getPmCliCommandKeywords as k } from "./utils/cliCommands.js"; | ||
import { getPmCliCommandKeywords as y } from "./utils/cliCommands.js"; | ||
import "node:fs/promises"; | ||
@@ -17,3 +17,3 @@ import "node:path"; | ||
import "./package/yarn.js"; | ||
async function y(n) { | ||
async function k(n) { | ||
const { stdout: o } = await p`$ ${n} --version`; | ||
@@ -30,3 +30,3 @@ return o; | ||
if (o.includes(c[e])) { | ||
const a = e, r = await y(e), t = { | ||
const a = e, r = await k(e), t = { | ||
name: e, | ||
@@ -37,8 +37,8 @@ version: r, | ||
getPackageInfo: async () => null, | ||
getRunScript: () => null, | ||
getRunScriptStruct: () => null, | ||
getRunScript: async () => null, | ||
getRunScriptStruct: async () => null, | ||
getRunExec: async () => null, | ||
getRunExecStruct: async () => null | ||
}; | ||
t.cliCommandKeywords = k(t), t.getPackageInfo = R({ name: a, version: r }); | ||
t.cliCommandKeywords = y(t), t.getPackageInfo = R({ name: a, version: r }); | ||
const { getRunScript: u, getRunScriptStruct: g } = l(t), { getRunExec: m, getRunExecStruct: s } = f(t); | ||
@@ -45,0 +45,0 @@ return t.getRunScript = u, t.getRunScriptStruct = g, t.getRunExec = m, t.getRunExecStruct = s, t; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
124889