Skip to content
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

Vendor option supports common code inclusion when packaging individually #643

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions lib/pip.js
Original file line number Diff line number Diff line change
@@ -544,6 +544,17 @@ function installRequirementsIfNeeded(
options
);

// Copy vendor libraries to requirements folder
// Do this before checking for cached libraries to support multiple packaged individually
// lambdas that need need to include common code. This source would change frequently and
// would not benefit from the caching.
if (options.vendor) {
copyVendors(options.vendor, workingReqsFolder, serverless);
}
if (funcOptions.vendor) {
copyVendors(funcOptions.vendor, workingReqsFolder, serverless);
}

// Check if our static cache is present and is valid
if (fse.existsSync(workingReqsFolder)) {
if (
@@ -575,14 +586,6 @@ function installRequirementsIfNeeded(
// Then install our requirements from this folder
installRequirements(workingReqsFolder, serverless, options);

// Copy vendor libraries to requirements folder
if (options.vendor) {
copyVendors(options.vendor, workingReqsFolder, serverless);
}
if (funcOptions.vendor) {
copyVendors(funcOptions.vendor, workingReqsFolder, serverless);
}

// Then touch our ".completed_requirements" file so we know we can use this for static cache
if (options.useStaticCache) {
fse.closeSync(