From 997152347d7f589b00f1e02b261b2216475c12dd Mon Sep 17 00:00:00 2001 From: Jake Coffman Date: Fri, 13 Dec 2024 14:17:10 -0600 Subject: [PATCH 1/6] bump corepack to fix freezes --- npm_and_yarn/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm_and_yarn/Dockerfile b/npm_and_yarn/Dockerfile index 41a16f11f3..ecffafa80c 100644 --- a/npm_and_yarn/Dockerfile +++ b/npm_and_yarn/Dockerfile @@ -1,7 +1,7 @@ FROM ghcr.io/dependabot/dependabot-updater-core # Check for updates at https://github.com/nodejs/corepack/releases -ARG COREPACK_VERSION=0.24.0 +ARG COREPACK_VERSION=0.30.0 # Check for updates at https://github.com/pnpm/pnpm/releases ARG PNPM_VERSION=9.15.0 From 5f35e1c464d390dbd029acb24788830524f95842 Mon Sep 17 00:00:00 2001 From: Kamil Bukum Date: Fri, 20 Dec 2024 11:09:04 -0800 Subject: [PATCH 2/6] clean up the version --- npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb index d144a66ee6..10c05b1df3 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb @@ -62,6 +62,7 @@ def self.semver_for(version) sig { override.params(version: VersionParameter).void } def initialize(version) + version = clean_version(version) @version_string = T.let(version.to_s, String) version = version.gsub(/^v/, "") if version.is_a?(String) @build_info = T.let(nil, T.nilable(String)) @@ -71,6 +72,18 @@ def initialize(version) super(T.must(version)) end + sig { params(version: VersionParameter).returns(VersionParameter) } + def clean_version(version) + # Check if version is a string before attempting to match + # Matches @ followed by x.y.z (digits separated by dots) + if version.is_a?(String) && (match = version.match(/@(\d+\.\d+\.\d+)/)) + return match[1] # Just "4.5.3" + end + + # If version is not a string or no match found, return original version + version + end + sig { override.params(version: VersionParameter).returns(Dependabot::NpmAndYarn::Version) } def self.new(version) T.cast(super, Dependabot::NpmAndYarn::Version) From 64bc0a03a4864e7f3977e372937ab7e3485adfbe Mon Sep 17 00:00:00 2001 From: Kamil Bukum Date: Fri, 20 Dec 2024 12:03:04 -0800 Subject: [PATCH 3/6] move removing `v` into version cleaning --- .../lib/dependabot/npm_and_yarn/version.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb index 10c05b1df3..7973baf2bb 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb @@ -63,8 +63,9 @@ def self.semver_for(version) sig { override.params(version: VersionParameter).void } def initialize(version) version = clean_version(version) + @version_string = T.let(version.to_s, String) - version = version.gsub(/^v/, "") if version.is_a?(String) + @build_info = T.let(nil, T.nilable(String)) version, @build_info = version.to_s.split("+") if version.to_s.include?("+") @@ -74,10 +75,13 @@ def initialize(version) sig { params(version: VersionParameter).returns(VersionParameter) } def clean_version(version) - # Check if version is a string before attempting to match - # Matches @ followed by x.y.z (digits separated by dots) - if version.is_a?(String) && (match = version.match(/@(\d+\.\d+\.\d+)/)) - return match[1] # Just "4.5.3" + if version.is_a?(String) + # Check if version is a string before attempting to match + # Matches @ followed by x.y.z (digits separated by dots) + if (match = version.match(/@(\d+\.\d+\.\d+)/)) + version = match[1] # Just "4.5.3" + end + version = version.gsub(/^v/, "") if version.is_a?(String) end # If version is not a string or no match found, return original version From 767d79b1657d36a477aca203d9891d2090c8ebac Mon Sep 17 00:00:00 2001 From: Kamil Bukum Date: Fri, 20 Dec 2024 12:04:04 -0800 Subject: [PATCH 4/6] remove string check --- npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb index 7973baf2bb..b6c24eecfa 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb @@ -81,7 +81,7 @@ def clean_version(version) if (match = version.match(/@(\d+\.\d+\.\d+)/)) version = match[1] # Just "4.5.3" end - version = version.gsub(/^v/, "") if version.is_a?(String) + version = version&.gsub(/^v/, "") end # If version is not a string or no match found, return original version From 2e7289dbbff3b1f6a40981c93e8cc41334f72363 Mon Sep 17 00:00:00 2001 From: Kamil Bukum Date: Fri, 20 Dec 2024 12:04:56 -0800 Subject: [PATCH 5/6] remove unnecessary comment. --- npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb index b6c24eecfa..53046af9ac 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb @@ -84,7 +84,6 @@ def clean_version(version) version = version&.gsub(/^v/, "") end - # If version is not a string or no match found, return original version version end From 47dd89ef5d8ba67c78cca4ee6f8bc5295b679c69 Mon Sep 17 00:00:00 2001 From: Kamil Bukum Date: Fri, 20 Dec 2024 12:05:43 -0800 Subject: [PATCH 6/6] move comment into right place --- npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb index 53046af9ac..7470120b79 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/version.rb @@ -75,8 +75,8 @@ def initialize(version) sig { params(version: VersionParameter).returns(VersionParameter) } def clean_version(version) + # Check if version is a string before attempting to match if version.is_a?(String) - # Check if version is a string before attempting to match # Matches @ followed by x.y.z (digits separated by dots) if (match = version.match(/@(\d+\.\d+\.\d+)/)) version = match[1] # Just "4.5.3"