-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ def package_manager_version | |
|
||
package_managers["npm"] = Helpers.npm_version_numeric(package_lock.content) if package_lock | ||
package_managers["yarn"] = yarn_version if yarn_version | ||
package_managers["pnpm"] = pnpm_version if pnpm_version | ||
package_managers["shrinkwrap"] = 1 if shrinkwrap | ||
package_managers["unknown"] = 1 if package_managers.empty? | ||
|
||
|
@@ -169,6 +170,18 @@ def guess_yarn_version | |
Helpers.yarn_version_numeric(yarn_lock) | ||
end | ||
|
||
def pnpm_version | ||
return @pnpm_version if defined?(@pnpm_version) | ||
|
||
@pnpm_version = package_manager.locked_version("pnpm") || guess_pnpm_version | ||
end | ||
|
||
def guess_pnpm_version | ||
return unless pnpm_lock | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
deivid-rodriguez
Author
Contributor
|
||
|
||
Helpers.pnpm_major_version | ||
end | ||
|
||
def package_manager | ||
@package_manager ||= PackageManager.new(parsed_package_json) | ||
end | ||
|
🤔 If there is no
pnpm_lock
, I assume this returnsnil
all the way back up the stack... Will this cause problems?IIRC, the only way we even know to use
pnpm
is due to the presence of thepnpm_lock
file, so today we should never hit this case.But if we later change things so that users tell us explicitly: "use
pnpm
" rather than "usenpm_and_yarn
" to usepnpm
, then this could start happening where we getnil
rather than a version.In that case, will the absence of a lockfile mean that the
pnpm
version simply doesn't matter? Will it still updatepackage.json
, just usingpnpm
instead ofnpm
??To be clear, this isn't a big deal today, just trying to think ahead defensively... wondering if we should always default guessing to returning the
pnpm
major version, regardless of presence of the lockfile... 🤷♂️