mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
don't error if only dependencies or devDependencies are present (#10594)
This commit is contained in:
parent
8f563846e8
commit
2a0f7e411f
|
@ -77,7 +77,7 @@ function __npm_installed_local_packages
|
|||
|
||||
if set -l python (__fish_anypython)
|
||||
$python -S -c 'import json, sys; data = json.load(sys.stdin);
|
||||
print("\n".join(data["dependencies"])); print("\n".join(data["devDependencies"]))' <$package_json 2>/dev/null
|
||||
print("\n".join(data.get("dependencies", []))); print("\n".join(data.get("devDependencies", [])))' <$package_json 2>/dev/null
|
||||
else if type -q jq
|
||||
jq -r '.dependencies as $a1 | .devDependencies as $a2 | ($a1 + $a2) | to_entries[] | .key' $package_json
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user