diff --git a/lib/plugins/install/index.js b/lib/plugins/install/index.js index 03aaa9296..949a47f6f 100644 --- a/lib/plugins/install/index.js +++ b/lib/plugins/install/index.js @@ -38,10 +38,10 @@ class Install { const repo = { owner: parts[1], repo: parts[2], - branch: 'master' + branch: 'master', }; - //TODO: Support github tree URLS (branch) + // TODO: Support github tree URLS (branch) if (~repo.repo.indexOf('#')) { repo.repo = url[2].split('#')[0]; repo.branch = url[2].split('#')[1]; @@ -53,19 +53,18 @@ class Install { 'https://github.com/serverless/serverless'); } - const downloadUrl = 'https://github.com/' + repo.owner + '/' + repo.repo - + '/archive/' + repo.branch + '.zip'; + const downloadUrl = `https://github.com/${repo.owner}/${repo.repo}/archive/${repo.branch}.zip`; const servicePath = path.join(process.cwd(), repo.repo); // Throw error if service path already exists if (this.serverless.utils.dirExistsSync(servicePath)) { - throw new this.serverless.classes.Error('A folder named \'' + repo.repo + '\' already exists' + - ' within the current working directory.'); + throw new this.serverless.classes.Error(`A folder named \'${repo.repo}\' already exists ` + + `within the current working directory.`); } // Inform this.serverless.cli.log(`Downloading and installing \'${repo.repo}\'...`); - let _this = this; + const self = this; // Download service return download( @@ -77,9 +76,9 @@ class Install { strip: 1, mode: '755', }) - .then(function() { - _this.serverless.cli.log(`Successfully installed \'${repo.repo}\'!`); - }) + .then(() => { + self.serverless.cli.log(`Successfully installed \'${repo.repo}\'!`); + }); } }