-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use package-lock.json to install packages if there is one available. #246
Conversation
return new BbPromise((resolve, reject) => { | ||
// (1.a.2) Copy package-lock.json if it exists, to prevent unwanted upgrades | ||
const packageLockPath = path.join(path.dirname(packageJsonPath), 'package-lock.json'); | ||
return BbPromise.fromCallback(cb => fse.pathExists(packageLockPath, cb)) |
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.
Why not use the sync versions if you're using it in a synchronous way?
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.
Because it will stall the Node event loop (even if something else might be running in the background - outside of the function) - we still run in the Serverless context and should not affect our host in any way ;-) This makes sure that we have a "thread/task" switch.
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.
Tell that to the Serverless guys using synchronous functions whenever humanly possible 🤣
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.
Haha... In the meantime they even turned some of the stuff asynchronously, like file copy.
splitModule[0] = '@' + splitModule[0]; | ||
} | ||
const moduleVersion = _.join(_.tail(splitModule), '@'); | ||
_.set(compositePackage, `dependencies.${_.first(splitModule)}`, moduleVersion); |
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.
@silver2k This is the issue. The assembly of the dependency name breaks here if the dependency includes a .
.
It is handled as if it was a nested property. I will provide a fix asap and release 3.1.2.
What did you implement:
Closes #245
How did you implement it:
If a
package-lock.json
is found besides thepackage.json
of the project, it is copied to the packaged dependencies folder, so that the plugin now installs the locked versions (for components that are present in the lock file).The
package.json
used for packaging is now pre-assembled because only an unqualifiednpm install
uses an existing lock file.How can we verify it:
Use a project with locked dependencies, package and check the created zip file.
Todos:
Is this ready for review?: YES
Is it a breaking change?: NO