-
Notifications
You must be signed in to change notification settings - Fork 101
fix(upgrade): use nypm in upgrade and info commands #618
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
Conversation
Unfortunately, nypm doesn't return which lock file is in use for bun so we still have to search for that ourselves.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #618 +/- ##
======================================
Coverage ? 1.37%
======================================
Files ? 44
Lines ? 2908
Branches ? 44
======================================
Hits ? 40
Misses ? 2827
Partials ? 41 β View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
src/commands/upgrade.ts:205
- [nitpick] The function name 'normaliseLockFile' should be renamed to 'normalizeLockFile' to follow American English spelling.
function normaliseLockFile(cwd: string, lockFiles: string | Array<string> | undefined) {
src/commands/info.ts:22
- The non-null assertion operator (!) is unnecessary here. The value of 'name' is already checked to be truthy.
const npmName = name!.split('/').splice(0, 2).join('/')
src/commands/info.ts:9
- The variables 'dependencies' and 'devDependencies' should be checked for nullish values to avoid potential issues.
getDepVersion = (name: string) => getPkg(name, cwd)?.version || dependencies[name] || devDependencies[name]
|
|
||
| if (lockFile === undefined) { | ||
| consola.error(`Unable to find any lock files in ${cwd}`) | ||
| return undefined |
Copilot
AI
Dec 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning 'undefined' here can lead to unintended behavior when 'undefined' is added to the 'toRemove' array. Consider handling this case more gracefully.
| return undefined | |
| return '' |
Further testing revealed that `utimes` throws an error if the file doesn't exist, this seemingly wasn't caught because package managers create the lockfile upon the install command
danielroe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! β€οΈ
π Linked issue
resolves #617
β Type of change
π Description
This PR replaces old code with nymp's apis of
detectPackageManagerandaddDependency.As a bonus, we're now also supporting deno for free since nypm does