From ab2b67e5d5640a87d9727490eb78c480e3205dc4 Mon Sep 17 00:00:00 2001 From: Austen Collins Date: Fri, 29 Jan 2016 17:55:58 -0800 Subject: [PATCH] FunctionDeploy: Create distribution directory in path so that package in project's package.json can be used for build operations --- lib/actions/CodePackageLambda.js | 6 +++--- lib/actions/FunctionDeploy.js | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/actions/CodePackageLambda.js b/lib/actions/CodePackageLambda.js index 869c6d4b5..9e0ff1df8 100644 --- a/lib/actions/CodePackageLambda.js +++ b/lib/actions/CodePackageLambda.js @@ -138,9 +138,9 @@ module.exports = function(SPlugin, serverlessPath) { let _this = this; - // Create dist folder + // Set Dist Dir let d = new Date(); - _this.pathDist = path.join(os.tmpdir(), _this.function.name + '@' + d.getTime()); + _this.pathDist = path.join(_this.S.config.projectPath, '_meta', '_tmp', _this.function.name + '@' + d.getTime()); // Status SUtils.sDebug(`"${_this.evt.options.stage} - ${_this.evt.options.region} - ${_this.function.name}": Copying in dist dir ${_this.pathDist}`); @@ -153,7 +153,7 @@ module.exports = function(SPlugin, serverlessPath) { _this.pathDist, { exclude: function(name, prefix) { - console.log(name); + if (!excludePatterns.length) { return false; } diff --git a/lib/actions/FunctionDeploy.js b/lib/actions/FunctionDeploy.js index 4a911cef2..d5fd0e2e2 100644 --- a/lib/actions/FunctionDeploy.js +++ b/lib/actions/FunctionDeploy.js @@ -208,6 +208,11 @@ module.exports = function(SPlugin, serverlessPath) { _this.evt.options.paths = _this.S.state.getFunctions({ returnPaths: true }); } + // Ensure tmp folder exists in _meta + if (!SUtils.dirExistsSync(path.join(_this.S.config.projectPath, '_meta', '_tmp'))) { + fs.mkdirSync(path.join(_this.S.config.projectPath, '_meta', '_tmp')); + } + return BbPromise.resolve(); }