mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
Pnpm suppport (#6)
* fix: resolves issues #3 and #4 * feat: add pnpm support & introduce pkg manager wrap for npm
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user