From 87805aeb0e3fa976c093251db0a5eec95f96544b Mon Sep 17 00:00:00 2001 From: Hang Ruan Date: Tue, 12 Jul 2016 15:03:30 +0200 Subject: [PATCH 1/2] If present, replace magic string with env var statements --- lib/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index 872ce9f1..8e1899d5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -287,8 +287,11 @@ Lambda.prototype._setEnvironmentVars = function (program, codeDirectory) { } prefix += '////////////////////////////////////\n\n'; + if (contentStr.trim().indexOf('/// node-lambda: env') !== -1) { + contentStr = contentStr.replace(/(\/\/\/\s?node-lambda: env\s*?\n)/, prefix); + } // If the first line of the file is 'use strict', append after - if (contentStr.trim().indexOf('use strict') === 1) { + else if (contentStr.trim().indexOf('use strict') === 1) { contentStr = contentStr.replace(/([`'"]use strict[`'"][;]?)/, '$1\n' + prefix); } else { contentStr = prefix + contentStr; From 05ea4cc87d5d55daaa88a5ca7da34e6c37763ffc Mon Sep 17 00:00:00 2001 From: Hang Ruan Date: Fri, 15 Jul 2016 16:44:00 +0200 Subject: [PATCH 2/2] Make package follow symlinks --- lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index 8e1899d5..f95f36a1 100644 --- a/lib/main.js +++ b/lib/main.js @@ -154,7 +154,7 @@ Lambda.prototype._rsync = function (program, src, dest, callback) { // we need the extra / after src to make sure we are copying the content // of the directory, not the directory itself. - exec('rsync -r ' + excludeArgs + ' ' + src.trim() + '/ ' + dest, function (err) { + exec('rsync -rL ' + excludeArgs + ' ' + src.trim() + '/ ' + dest, function (err) { if (err) { return callback(err); }