Pnpm suppport (#6)

* fix: resolves issues #3 and #4

* feat: add pnpm support & introduce pkg manager wrap for npm
This commit is contained in:
Sahil Bansal
2025-04-30 14:26:38 +05:30
committed by GitHub
parent ec010c7d6b
commit 1aa4b06f41
9 changed files with 320 additions and 165 deletions
+20
View File
@@ -33,3 +33,23 @@ func ParsePackageInfo(input string) (packageName, version string, err error) {
return "", "", fmt.Errorf("invalid format: expected 'package' OR 'package@version', got '%s'", input)
}
func IsInstallCommand(pkgManager, cmd string) bool {
validActions := map[string]map[string]bool{
"npm": {
"install": true,
"i": true,
"add": true,
},
"pnpm": {
"add": true,
"install": true,
"i": true,
},
}
if actions, exists := validActions[pkgManager]; exists {
return actions[cmd]
}
return false
}