Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pnpm@9 for lockfile >= 9.0 #9668

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def self.yarn_version_numeric(yarn_lock)

sig { params(pnpm_lock: DependencyFile).returns(Integer) }
def self.pnpm_version_numeric(pnpm_lock)
if pnpm_lockfile_version(pnpm_lock).to_f >= 6.0
if pnpm_lockfile_version(pnpm_lock).to_f >= 9.0
9
elsif pnpm_lockfile_version(pnpm_lock).to_f >= 6.0
8
elsif pnpm_lockfile_version(pnpm_lock).to_f >= 5.4
7
Copy link

@pboling pboling May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to invert the checks:

pnpm_version = pnpm_lockfile_version(pnpm_lock).to_f;

if pnpm_version < 5.4
  6
elsif pnpm_version < 6
  7
elsif pnpm_version < 9
  8
else
  pnpm_version.to_i
end

Then you'll likely never have to fix it again. ;). Just be done fixing it. @jeffwidman @bdragon @tusbar

It seems quite likely that from now on, for future versions of pnpm, it will be safe to install the same major version as the lockfile indicates (kinda wild to even have to say that 😆 ).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@
expect(dependencies.map(&:name)).to include("@sentry/react")
end
end

context "in v9.0 format" do
let(:dependency_files) { project_dependency_files("pnpm/9_0_format") }

it "parses dependencies properly" do
expect(dependencies.map(&:name)).to include("@sentry/node")
end
end
end

context "for npm lockfiles" do
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading