fix: correct package name in package-lock.json#275
Conversation
The branch name leaked into the lockfile when npm audit fix was run from a feature branch directory. Reset to the correct project name.
There was a problem hiding this comment.
Code Review
This pull request updates the package name in package-lock.json from "fix-timetracker-audit" to "timetracker". The review feedback indicates that while this change is correct, the root cause is the absence of name and version fields in package.json, which are required by npm and should be added to ensure consistency.
| @@ -1,10 +1,10 @@ | |||
| { | |||
| "name": "fix-timetracker-audit", | |||
| "name": "timetracker", | |||
There was a problem hiding this comment.
While this change correctly sets the package name in package-lock.json, it addresses a symptom rather than the root cause. The underlying issue is that package.json is missing the name and version fields. These are considered required fields by npm (see docs). When they are missing, npm infers the package name from the directory name, which can lead to inconsistencies like the one this PR is fixing.
To fix this permanently, please add the name and version fields to package.json. This will provide a single source of truth for your project's identity.
For example, you could add the following to the top of your package.json:
{
"name": "timetracker",
"version": "1.0.0",
...
}After updating package.json, running npm install will regenerate package-lock.json correctly based on this information.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #275 +/- ##
=========================================
Coverage 81.49% 81.49%
Complexity 2579 2579
=========================================
Files 172 172
Lines 7107 7107
=========================================
Hits 5792 5792
Misses 1315 1315
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
package-lock.jsonname fromfix-timetracker-audit(branch name) totimetrackernpm audit fixusing the working directory name as package nameTest plan