-
Notifications
You must be signed in to change notification settings - Fork 8
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
delete lock file when package is updated #179
Conversation
// of the modules and therefore remove the package-lock.json file to permit modules | ||
// to be updated to the versions specified in package.json | ||
if (existsSync(this.files.packageLockJSON)) { | ||
await fs.rm(this.files.packageLockJSON) |
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.
Wouldn't an npm install
already handle this?
Or are you wanting to run npm upgrade
to upgrade the package lock versions specifically to the latest matching the semver? (e.g. 1.2.3 -> 1.2.5 for a ^1.2.0)
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.
Pez, was discussed in slack
Steve
When switching snapshots with different versions of Node-RED specified, "Installing Packages" is ran but Node-RED version remains old.
npm install --production (as the launcher and agent execute) ignore package.json and respect the lock file instead
Should we be inspecting the package or indiscriminately deleting the lock file in the agent device project dir when "Updating configuration files"-> writePackage() is called?
2 repliesnick
My instinct is to delete the package lock file whenever we update the package fileSteve
same - but wanted to check
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.
To me, this could lead to unexpected upgrades outside of the package changes, but so would running an explicit npm upgrade, so unblocking until we find a better solution for now.
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.
On second thought, this still doesn't fully grok for me actually, an npm install
always updates the package-lock based on the latest package.json as part of the install. Testing locally.
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.
Result of my tests in #178 (comment)
@@ -54,6 +55,17 @@ class Launcher { | |||
await fs.writeFile(this.files.packageJSON, JSON.stringify(packageData, ' ', 2)) | |||
await fs.rm(path.join(this.projectDir, '.config.nodes.json'), { force: true }) | |||
await fs.rm(path.join(this.projectDir, '.config.nodes.json.backup'), { force: true }) | |||
|
|||
// as the package.json file has been re-written, we will "assume" different versions | |||
// of the modules and therefore remove the package-lock.json file to permit modules |
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.
It may be worth noting that this is only because of the --production
flag, a normal npm install
would update the package-lock.
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.
I don't think this gets to the bottom of why the packages aren't updating, see comment on the original issue: #178 (comment)
Good news: I cannot recreate this from staging to device. On windows or Linux. I can only assume some other mis-op (by me) I will park (close) this PR (but not delete the branch for now) |
Description
Deletes package lock when the package is updated.
This permits the internal call to
npm install --production
to get specified versions instead of the lock versions.TODO:
Related Issue(s)
#178
Checklist
flowforge.yml
?flowforge/helm
to update ConfigMap Templateflowforge/CloudProject
to update values for Staging/ProductionLabels
backport
labelarea:migration
label