-
Notifications
You must be signed in to change notification settings - Fork 71
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
fix(upgrade): use nypm in upgrade and info commands #618
base: main
Are you sure you want to change the base?
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.31%
======================================
Files ? 44
Lines ? 2887
Branches ? 44
======================================
Hits ? 38
Misses ? 2808
Partials ? 41 β View full report in Codecov by Sentry. |
Copilot
AI
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.
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 |
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 '' |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
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
π Linked issue
resolves #617
β Type of change
π Description
This PR replaces old code with nymp's apis of
detectPackageManager
andaddDependency
.As a bonus, we're now also supporting deno for free since nypm does