Skip to content

Commit

Permalink
Patch: Enforce npm 8 for Lockfile Version 2+ (#10761)
Browse files Browse the repository at this point in the history
* set npm 8 as default and lockfileVersion 2+
  • Loading branch information
kbukum1 authored Oct 9, 2024
1 parent 3178303 commit 025db54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module Helpers
/^.*(?<error>The "yarn-path" option has been set \(in [^)]+\), but the specified location doesn't exist)/

# NPM Version Constants
NPM_V9 = 9
NPM_V8 = 8
NPM_V6 = 6
NPM_DEFAULT_VERSION = NPM_V8
Expand Down Expand Up @@ -77,7 +76,9 @@ def self.npm_version_numeric_npm8_or_higher(lockfile)

lockfile_version = lockfile_version_str.to_i

return NPM_V9 if lockfile_version == 3
# Using npm 8 as the default for lockfile_version > 2.
# Update needed to support npm 9+ based on lockfile version.
return NPM_V8 if lockfile_version >= 2

NPM_DEFAULT_VERSION
rescue JSON::ParserError
Expand Down

0 comments on commit 025db54

Please sign in to comment.