bibliothecary 7.3.1 → 7.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0663db5989fda63b06b68549a29bcd58976f96b7f7fd35b4063738fac6fbf8ff
4
- data.tar.gz: 16e3caf672f0d34b19e2cbd80acfec45b7b65f559cf152d3d23003b4282a7933
3
+ metadata.gz: 5dece4dd0ba501561d36353606c81211a31727e01168effc7bbfdf0dc9ceec19
4
+ data.tar.gz: 4aa63636cf6e4697e9c35c2965f7cfe16bbe82f408d28f37c10fed678a1e893f
5
5
  SHA512:
6
- metadata.gz: d3041468f12d9080d2d06cad3a5a3e2a316727207e0bc6d1ec263a6dd5f7da25be3ce5901fed3f9b0e362cdf02892c1e9e6bcf93f133264e8de42ccad08a1f81
7
- data.tar.gz: '08d43bb3e8a35463162ee0379ca0c5563a81a2665c236f256c4613e1d825e25cf16899c690ffff9f4fa8fc55ef09fe9d8a9acdcb5b5f8f51bc0df76a49b38be4'
6
+ metadata.gz: 0e3aa9619424e7ddc658a61779463d92a21ce7c80b364c61da52c4e05ae82f00aa3e792385f3552dbf5be0a240a4ae5cdee1b413b6b5412ffc2c038cd69a82c9
7
+ data.tar.gz: df88033afb288b0dcff8babb62eccda691aebc74aa1f19f209c6407c6cdddab4caf39420b23d012c51540988f7f7ffc9a81aa562724cf0dfe5eb6465e3801524
@@ -97,6 +97,18 @@ module Bibliothecary
97
97
  transform_tree_to_array(manifest.fetch('dependencies', {}))
98
98
  end
99
99
 
100
+ def self.lockfile_preference_order(file_infos)
101
+ files = file_infos.each_with_object({}) do |file_info, obj|
102
+ obj[File.basename(file_info.full_path)] = file_info
103
+ end
104
+
105
+ if files["npm-shrinkwrap.json"]
106
+ [files["npm-shrinkwrap.json"]] + files.values.reject { |fi| File.basename(fi.full_path) == "npm-shrinkwrap.json" }
107
+ else
108
+ files.values
109
+ end
110
+ end
111
+
100
112
  private_class_method def self.transform_tree_to_array(deps_by_name)
101
113
  deps_by_name.map do |name, metadata|
102
114
  [
@@ -19,6 +19,9 @@ module Bibliothecary
19
19
 
20
20
  def initialize(file_infos)
21
21
  package_manager = file_infos.first.package_manager
22
+ if package_manager.respond_to?(:lockfile_preference_order)
23
+ file_infos = package_manager.lockfile_preference_order(file_infos)
24
+ end
22
25
  @platform = package_manager.platform_name
23
26
  @path = Pathname.new(File.dirname(file_infos.first.relative_path)).cleanpath.to_path
24
27
  # `package_manager.determine_kind_from_info(info)` can be an Array, so use include? which also works for string
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "7.3.1"
2
+ VERSION = "7.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibliothecary
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.1
4
+ version: 7.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb