mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
* npm - fix updating version specific modules
if a version specific module is used, the comparison will be used with the version and not only by name
* Update plugins/modules/packaging/language/npm.py
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
* Update changelogs/fragments/2830-npm-version-update.yml
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
* Update changelogs/fragments/2830-npm-version-update.yml
Co-authored-by: Amin Vakil <info@aminvakil.com>
* Update changelogs/fragments/2830-npm-version-update.yml
Co-authored-by: Amin Vakil <info@aminvakil.com>
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
Co-authored-by: Amin Vakil <info@aminvakil.com>
(cherry picked from commit 1ed4394c5e
)
Co-authored-by: Shahar Mor <shaharmor1@gmail.com>
This commit is contained in:
parent
2b435a591d
commit
0296c200c7
3 changed files with 114 additions and 6 deletions
|
@ -181,7 +181,7 @@ class Npm(object):
|
|||
cmd.append('--ignore-scripts')
|
||||
if self.unsafe_perm:
|
||||
cmd.append('--unsafe-perm')
|
||||
if self.name and add_package_name:
|
||||
if self.name_version and add_package_name:
|
||||
cmd.append(self.name_version)
|
||||
if self.registry:
|
||||
cmd.append('--registry')
|
||||
|
@ -215,14 +215,17 @@ class Npm(object):
|
|||
except (getattr(json, 'JSONDecodeError', ValueError)) as e:
|
||||
self.module.fail_json(msg="Failed to parse NPM output with error %s" % to_native(e))
|
||||
if 'dependencies' in data:
|
||||
for dep in data['dependencies']:
|
||||
if 'missing' in data['dependencies'][dep] and data['dependencies'][dep]['missing']:
|
||||
for dep, props in data['dependencies'].items():
|
||||
dep_version = dep + '@' + str(props['version'])
|
||||
|
||||
if 'missing' in props and props['missing']:
|
||||
missing.append(dep)
|
||||
elif 'invalid' in data['dependencies'][dep] and data['dependencies'][dep]['invalid']:
|
||||
elif 'invalid' in props and props['invalid']:
|
||||
missing.append(dep)
|
||||
else:
|
||||
installed.append(dep)
|
||||
if self.name and self.name not in installed:
|
||||
installed.append(dep_version)
|
||||
if self.name_version and self.name_version not in installed:
|
||||
missing.append(self.name)
|
||||
# Named dependency not installed
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue