dependabot-npm_and_yarn 0.232.0 → 0.234.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/package-lock.json +2144 -1998
- data/helpers/package.json +4 -4
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +1 -1
- data/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb +18 -6
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb +11 -0
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +3 -3
- data/lib/dependabot/npm_and_yarn/update_checker/dependency_files_builder.rb +3 -3
- data/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb +1 -1
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +1 -1
- data/lib/dependabot/npm_and_yarn/update_checker.rb +1 -1
- data/lib/dependabot/npm_and_yarn/version.rb +17 -5
- metadata +19 -19
data/helpers/package.json
CHANGED
@@ -11,9 +11,9 @@
|
|
11
11
|
},
|
12
12
|
"dependencies": {
|
13
13
|
"@dependabot/yarn-lib": "^1.22.19",
|
14
|
-
"@npmcli/arborist": "^
|
14
|
+
"@npmcli/arborist": "^7.1.0",
|
15
15
|
"detect-indent": "^6.1.0",
|
16
|
-
"nock": "^13.3.
|
16
|
+
"nock": "^13.3.3",
|
17
17
|
"npm": "6.14.18",
|
18
18
|
"@pnpm/lockfile-file": "^8.1.2",
|
19
19
|
"@pnpm/dependency-path": "^2.1.1",
|
@@ -21,9 +21,9 @@
|
|
21
21
|
"patch-package": "^8.0.0"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"eslint": "^8.
|
24
|
+
"eslint": "^8.51.0",
|
25
25
|
"eslint-config-prettier": "^9.0.0",
|
26
|
-
"jest": "^29.
|
26
|
+
"jest": "^29.7.0",
|
27
27
|
"prettier": "^3.0.3"
|
28
28
|
}
|
29
29
|
}
|
@@ -247,7 +247,7 @@ module Dependabot
|
|
247
247
|
# Loop through parent directories looking for an yarnrc
|
248
248
|
(1..directory.split("/").count).each do |i|
|
249
249
|
@yarnrc = fetch_file_from_host(("../" * i) + ".yarnrc")
|
250
|
-
|
250
|
+
&.tap { |f| f.support_file = true }
|
251
251
|
break if @yarnrc
|
252
252
|
rescue Dependabot::DependencyFileNotFound
|
253
253
|
# Ignore errors (.yarnrc may not be present)
|
@@ -17,9 +17,10 @@ module Dependabot
|
|
17
17
|
|
18
18
|
SCOPED_REGISTRY = /^\s*@(?<scope>\S+):registry\s*=\s*(?<registry>\S+)/
|
19
19
|
|
20
|
-
def initialize(dependency_files:, credentials:)
|
20
|
+
def initialize(dependency_files:, credentials:, dependencies: [])
|
21
21
|
@dependency_files = dependency_files
|
22
22
|
@credentials = credentials
|
23
|
+
@dependencies = dependencies
|
23
24
|
end
|
24
25
|
|
25
26
|
# PROXY WORK
|
@@ -52,7 +53,7 @@ module Dependabot
|
|
52
53
|
|
53
54
|
private
|
54
55
|
|
55
|
-
attr_reader :dependency_files, :credentials
|
56
|
+
attr_reader :dependency_files, :credentials, :dependencies
|
56
57
|
|
57
58
|
def build_npmrc_content_from_lockfile
|
58
59
|
return unless yarn_lock || package_lock
|
@@ -134,6 +135,17 @@ module Dependabot
|
|
134
135
|
return @dependency_urls if defined?(@dependency_urls)
|
135
136
|
|
136
137
|
@dependency_urls = []
|
138
|
+
|
139
|
+
if dependencies.any?
|
140
|
+
@dependency_urls = dependencies.map do |dependency|
|
141
|
+
UpdateChecker::RegistryFinder.new(
|
142
|
+
dependency: dependency,
|
143
|
+
credentials: credentials
|
144
|
+
).dependency_url
|
145
|
+
end
|
146
|
+
return @dependency_urls
|
147
|
+
end
|
148
|
+
|
137
149
|
if package_lock
|
138
150
|
@dependency_urls +=
|
139
151
|
package_lock.content.scan(/"resolved"\s*:\s*"(.*)"/)
|
@@ -185,8 +197,8 @@ module Dependabot
|
|
185
197
|
yarnrc_global_registry =
|
186
198
|
yarnrc_file.content
|
187
199
|
.lines.find { |line| line.match?(/^\s*registry\s/) }
|
188
|
-
|
189
|
-
|
200
|
+
&.match(NpmAndYarn::UpdateChecker::RegistryFinder::YARN_GLOBAL_REGISTRY_REGEX)
|
201
|
+
&.named_captures&.fetch("registry")
|
190
202
|
|
191
203
|
return "registry = #{yarnrc_global_registry}\n" if yarnrc_global_registry
|
192
204
|
|
@@ -197,8 +209,8 @@ module Dependabot
|
|
197
209
|
yarnrc_global_registry =
|
198
210
|
yarnrc_file.content
|
199
211
|
.lines.find { |line| line.match?(/^\s*registry\s/) }
|
200
|
-
|
201
|
-
|
212
|
+
&.match(/^\s*registry\s+"(?<registry>[^"]+)"/)
|
213
|
+
&.named_captures&.fetch("registry")
|
202
214
|
|
203
215
|
return "registry \"#{yarnrc_global_registry}\"\n" if yarnrc_global_registry
|
204
216
|
|
@@ -9,6 +9,7 @@ module Dependabot
|
|
9
9
|
module NpmAndYarn
|
10
10
|
class FileUpdater
|
11
11
|
class PnpmLockfileUpdater
|
12
|
+
require_relative "npmrc_builder"
|
12
13
|
require_relative "package_json_updater"
|
13
14
|
|
14
15
|
def initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:)
|
@@ -38,6 +39,8 @@ module Dependabot
|
|
38
39
|
|
39
40
|
def run_pnpm_update(pnpm_lock:)
|
40
41
|
SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do
|
42
|
+
File.write(".npmrc", npmrc_content(pnpm_lock))
|
43
|
+
|
41
44
|
SharedHelpers.with_git_configured(credentials: credentials) do
|
42
45
|
run_pnpm_updater
|
43
46
|
|
@@ -120,6 +123,14 @@ module Dependabot
|
|
120
123
|
end
|
121
124
|
end
|
122
125
|
|
126
|
+
def npmrc_content(pnpm_lock)
|
127
|
+
NpmrcBuilder.new(
|
128
|
+
credentials: credentials,
|
129
|
+
dependency_files: dependency_files,
|
130
|
+
dependencies: lockfile_dependencies(pnpm_lock)
|
131
|
+
).npmrc_content
|
132
|
+
end
|
133
|
+
|
123
134
|
def updated_package_json_content(file)
|
124
135
|
@updated_package_json_content ||= {}
|
125
136
|
@updated_package_json_content[file.name] ||=
|
@@ -511,9 +511,9 @@ module Dependabot
|
|
511
511
|
yarnrc_global_registry =
|
512
512
|
yarnrc_file.content
|
513
513
|
.lines.find { |line| line.match?(regex) }
|
514
|
-
|
515
|
-
|
516
|
-
|
514
|
+
&.match(regex)
|
515
|
+
&.named_captures
|
516
|
+
&.fetch("registry")
|
517
517
|
|
518
518
|
return false unless yarnrc_global_registry
|
519
519
|
|
@@ -105,9 +105,9 @@ module Dependabot
|
|
105
105
|
yarnrc_global_registry =
|
106
106
|
yarnrc_file.content
|
107
107
|
.lines.find { |line| line.match?(regex) }
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
&.match(regex)
|
109
|
+
&.named_captures
|
110
|
+
&.fetch("registry")
|
111
111
|
|
112
112
|
return false unless yarnrc_global_registry
|
113
113
|
|
@@ -204,7 +204,7 @@ module Dependabot
|
|
204
204
|
# resulting in a bunch of package duplication which is pretty confusing.
|
205
205
|
def bundled_dependency?
|
206
206
|
dependency.subdependency_metadata
|
207
|
-
|
207
|
+
&.any? { |h| h.fetch(:npm_bundled, false) } ||
|
208
208
|
false
|
209
209
|
end
|
210
210
|
end
|
@@ -356,7 +356,7 @@ module Dependabot
|
|
356
356
|
semver_req =
|
357
357
|
dependency.requirements
|
358
358
|
.find { |req| req.dig(:source, :type) == "git" }
|
359
|
-
|
359
|
+
&.fetch(:requirement)
|
360
360
|
|
361
361
|
# If there was a semver requirement provided or the dependency was
|
362
362
|
# pinned to a version, look for the latest tag
|
@@ -13,11 +13,15 @@ require "dependabot/utils"
|
|
13
13
|
module Dependabot
|
14
14
|
module NpmAndYarn
|
15
15
|
class Version < Dependabot::Version
|
16
|
+
extend T::Sig
|
17
|
+
|
18
|
+
sig { returns(String) }
|
16
19
|
attr_reader :build_info
|
17
20
|
|
18
|
-
VERSION_PATTERN = Gem::Version::VERSION_PATTERN + '(\+[0-9a-zA-Z\-.]+)?'
|
21
|
+
VERSION_PATTERN = T.let(Gem::Version::VERSION_PATTERN + '(\+[0-9a-zA-Z\-.]+)?', String)
|
19
22
|
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/
|
20
23
|
|
24
|
+
sig { override.params(version: T.nilable(T.any(String, Gem::Version))).returns(T::Boolean) }
|
21
25
|
def self.correct?(version)
|
22
26
|
version = version.gsub(/^v/, "") if version.is_a?(String)
|
23
27
|
|
@@ -26,6 +30,7 @@ module Dependabot
|
|
26
30
|
version.to_s.match?(ANCHORED_VERSION_PATTERN)
|
27
31
|
end
|
28
32
|
|
33
|
+
sig { params(version: T.nilable(T.any(String, Gem::Version))).returns(T.nilable(T.any(String, Gem::Version))) }
|
29
34
|
def self.semver_for(version)
|
30
35
|
# The next two lines are to guard against improperly formatted
|
31
36
|
# versions in a lockfile, such as an empty string or additional
|
@@ -37,8 +42,9 @@ module Dependabot
|
|
37
42
|
version
|
38
43
|
end
|
39
44
|
|
45
|
+
sig { override.params(version: T.any(String, Gem::Version)).void }
|
40
46
|
def initialize(version)
|
41
|
-
@version_string = version.to_s
|
47
|
+
@version_string = T.let(version.to_s, String)
|
42
48
|
version = version.gsub(/^v/, "") if version.is_a?(String)
|
43
49
|
|
44
50
|
version, @build_info = version.to_s.split("+") if version.to_s.include?("+")
|
@@ -46,18 +52,22 @@ module Dependabot
|
|
46
52
|
super
|
47
53
|
end
|
48
54
|
|
55
|
+
sig { returns(Integer) }
|
49
56
|
def major
|
50
|
-
@major ||= segments[0] || 0
|
57
|
+
@major ||= T.let(segments[0] || 0, T.nilable(Integer))
|
51
58
|
end
|
52
59
|
|
60
|
+
sig { returns(Integer) }
|
53
61
|
def minor
|
54
|
-
@minor ||= segments[1] || 0
|
62
|
+
@minor ||= T.let(segments[1] || 0, T.nilable(Integer))
|
55
63
|
end
|
56
64
|
|
65
|
+
sig { returns(Integer) }
|
57
66
|
def patch
|
58
|
-
@patch ||= segments[2] || 0
|
67
|
+
@patch ||= T.let(segments[2] || 0, T.nilable(Integer))
|
59
68
|
end
|
60
69
|
|
70
|
+
sig { params(other: Dependabot::NpmAndYarn::Version).returns(T::Boolean) }
|
61
71
|
def backwards_compatible_with?(other)
|
62
72
|
case major
|
63
73
|
when 0
|
@@ -67,10 +77,12 @@ module Dependabot
|
|
67
77
|
end
|
68
78
|
end
|
69
79
|
|
80
|
+
sig { override.returns(String) }
|
70
81
|
def to_s
|
71
82
|
@version_string
|
72
83
|
end
|
73
84
|
|
85
|
+
sig { override.returns(String) }
|
74
86
|
def inspect
|
75
87
|
"#<#{self.class} #{@version_string}>"
|
76
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-npm_and_yarn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.234.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.234.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.234.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: parallel_tests
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.2.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 4.2.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +150,20 @@ dependencies:
|
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: 0.2.16
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: turbo_tests
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.2.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.2.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: vcr
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,7 +295,7 @@ licenses:
|
|
295
295
|
- Nonstandard
|
296
296
|
metadata:
|
297
297
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
298
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
298
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.234.0
|
299
299
|
post_install_message:
|
300
300
|
rdoc_options: []
|
301
301
|
require_paths:
|