Comparing version 0.23.0 to 0.23.1
import { Buffer } from 'node:buffer'; | ||
type Agent = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'pnpm@6' | 'bun'; | ||
type AgentName = 'npm' | 'yarn' | 'pnpm' | 'bun'; | ||
type Agent = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'pnpm@6' | 'bun' | 'deno'; | ||
type AgentName = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'deno'; | ||
type AgentCommandValue = (string | number)[] | ((args?: string[]) => string[]) | null; | ||
@@ -16,2 +16,3 @@ interface AgentCommands { | ||
'execute': AgentCommandValue; | ||
'execute-local': AgentCommandValue; | ||
'uninstall': AgentCommandValue; | ||
@@ -32,6 +33,2 @@ 'global_uninstall': AgentCommandValue; | ||
declare const AGENTS: Agent[]; | ||
declare const LOCKS: Record<string, AgentName>; | ||
declare const INSTALL_PAGE: Record<Agent, string>; | ||
declare const COMMANDS: { | ||
@@ -44,6 +41,32 @@ npm: AgentCommands; | ||
bun: AgentCommands; | ||
deno: AgentCommands; | ||
}; | ||
/** | ||
* Resolve the command for the agent merging the command arguments with the provided arguments. | ||
* | ||
* For example, to show how to install `@antfu/ni` globally using `pnpm`: | ||
* ```js | ||
* import { resolveCommand } from 'package-manager-detector/commands' | ||
* const { command, args } = resolveCommand('pnpm', 'global', ['@antfu/ni']) | ||
* console.log(`${command} ${args.join(' ')}`) // 'pnpm add -g @antfu/ni' | ||
* ``` | ||
* | ||
* @param agent The agent to use. | ||
* @param command the command to resolve. | ||
* @param args The arguments to pass to the command. | ||
* @returns {ResolvedCommand} The resolved command or `null` if the agent command is not found. | ||
*/ | ||
declare function resolveCommand(agent: Agent, command: Command, args: string[]): ResolvedCommand | null; | ||
/** | ||
* Construct the command from the agent command merging the command arguments with the provided arguments. | ||
* @param value {AgentCommandValue} The agent command to use. | ||
* @param args The arguments to pass to the command. | ||
* @returns {ResolvedCommand} The resolved command or `null` if the command is `null`. | ||
*/ | ||
declare function constructCommand(value: AgentCommandValue, args: string[]): ResolvedCommand | null; | ||
declare const AGENTS: Agent[]; | ||
declare const LOCKS: Record<string, AgentName>; | ||
declare const INSTALL_PAGE: Record<Agent, string>; | ||
interface Config { | ||
@@ -50,0 +73,0 @@ defaultAgent: Agent | 'prompt'; |
{ | ||
"name": "@antfu/ni", | ||
"type": "module", | ||
"version": "0.23.0", | ||
"packageManager": "pnpm@9.9.0", | ||
"version": "0.23.1", | ||
"packageManager": "pnpm@9.13.2", | ||
"description": "Use the right package manager", | ||
@@ -52,26 +52,26 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.27.3", | ||
"@antfu/eslint-config": "^3.9.1", | ||
"@posva/prompts": "^2.4.4", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/ini": "^4.1.1", | ||
"@types/node": "^22.5.0", | ||
"@types/node": "^22.9.0", | ||
"@types/which": "^3.0.4", | ||
"bumpp": "^9.5.2", | ||
"eslint": "^9.9.1", | ||
"bumpp": "^9.8.1", | ||
"eslint": "^9.15.0", | ||
"fs-extra": "^11.2.0", | ||
"fzf": "^0.5.2", | ||
"ini": "^4.1.3", | ||
"lint-staged": "^15.2.9", | ||
"package-manager-detector": "^0.2.0", | ||
"picocolors": "^1.0.1", | ||
"ini": "^5.0.0", | ||
"lint-staged": "^15.2.10", | ||
"package-manager-detector": "^0.2.4", | ||
"picocolors": "^1.1.1", | ||
"simple-git-hooks": "^2.11.1", | ||
"taze": "^0.16.6", | ||
"taze": "^0.18.0", | ||
"terminal-link": "^3.0.0", | ||
"tinyexec": "^0.3.0", | ||
"tinyglobby": "^0.2.5", | ||
"tsx": "^4.18.0", | ||
"typescript": "^5.5.4", | ||
"tinyexec": "^0.3.1", | ||
"tinyglobby": "^0.2.10", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.6.3", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^2.0.5", | ||
"which": "^4.0.0" | ||
"vitest": "^2.1.5", | ||
"which": "^5.0.0" | ||
}, | ||
@@ -78,0 +78,0 @@ "simple-git-hooks": { |
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
376270
11654
70