From 20c0b3b983c80f2ae6eb0332848943c3e444776c Mon Sep 17 00:00:00 2001 From: erezrokah Date: Thu, 24 Sep 2020 10:33:54 +0200 Subject: [PATCH] fix(deploy): don't hang when there are no files to deploy --- src/deploy/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/deploy/index.js b/src/deploy/index.js index 87bd5b5..83778cd 100644 --- a/src/deploy/index.js +++ b/src/deploy/index.js @@ -52,14 +52,19 @@ module.exports = async (api, siteId, dir, opts) => { hashFns(fnDir, opts) ]) + const filesCount = Object.keys(files).length + const functionsCount = Object.keys(functions).length + statusCb({ type: 'hashing', - msg: - `Finished hashing ${Object.keys(files).length} files` + - (fnDir ? ` and ${Object.keys(functions).length} functions` : ''), + msg: `Finished hashing ${filesCount} files` + (fnDir ? ` and ${functionsCount} functions` : ''), phase: 'stop' }) + if (filesCount === 0 && functionsCount === 0) { + throw new Error('No files or functions to deploy') + } + statusCb({ type: 'create-deploy', msg: 'CDN diffing files...',