Skip to content

Commit

Permalink
refactor: Configure main progress titles through command schema
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Sep 20, 2021
1 parent fd68f9e commit 9e308bd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions lib/cli/commands-schema/aws-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ commands.set('deploy', {
'deploy',
'finalize',
],
mainProgressTitles: new Map([
['before:package:cleanup', 'Packaging'],
['before:aws:deploy:deploy:createStack', 'Retrieving CloudFormation stack info'],
['before:aws:deploy:deploy:checkForChanges', 'Retrieving CloudFormation stack info'],
['before:aws:deploy:deploy:uploadArtifacts', 'Uploading'],
['before:aws:deploy:deploy:validateTemplate', 'Updating CloudFormation stack'],
['before:aws:info:validate', 'Retrieving CloudFormation stack info'],
['after:deploy:deploy', 'Updating'],
]),
});

commands.set('deploy function', {
Expand Down
1 change: 1 addition & 0 deletions lib/cli/commands-schema/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ commands.set('package', {
'compileEvents',
'finalize',
],
mainProgressTitles: new Map([['before:package:cleanup', 'Packaging']]),
});

commands.set('plugin install', {
Expand Down
3 changes: 1 addition & 2 deletions lib/plugins/aws/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const validateTemplate = require('./lib/validateTemplate');
const updateStack = require('../lib/updateStack');
const existsDeploymentBucket = require('./lib/existsDeploymentBucket');
const path = require('path');
const { style, log, progress, writeText } = require('@serverless/utils/log');
const { style, log, writeText } = require('@serverless/utils/log');
const memoize = require('memoizee');

class AwsDeploy {
Expand Down Expand Up @@ -124,7 +124,6 @@ class AwsDeploy {
// Deploy finalize inner lifecycle
'aws:deploy:finalize:cleanup': async () => {
if (this.serverless.service.provider.shouldNotDeploy) return;
progress.get('main').notice('Updating');
log.info('Updating');
await this.cleanupS3Bucket();
if (this.options.package || this.serverless.service.package.path) {
Expand Down
1 change: 0 additions & 1 deletion lib/plugins/aws/lib/updateStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ module.exports = {
const templateUrl = `https://${s3Endpoint}/${this.bucketName}/${this.serverless.service.package.artifactDirectoryName}/${compiledTemplateFileName}`;

legacy.log('Updating Stack...');
progress.get('main').notice('Updating CloudFormation stack');
log.info('Updating CloudFormation stack');
const stackName = this.provider.naming.getStackName();
let stackTags = { STAGE: this.provider.getStage() };
Expand Down
3 changes: 1 addition & 2 deletions lib/plugins/package/lib/packageService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const _ = require('lodash');
const micromatch = require('micromatch');
const ServerlessError = require('../../../serverless-error');
const parseS3URI = require('../../aws/utils/parse-s3-uri');
const { legacy, progress, log } = require('@serverless/utils/log');
const { legacy, log } = require('@serverless/utils/log');

module.exports = {
defaultExcludes: [
Expand Down Expand Up @@ -68,7 +68,6 @@ module.exports = {

async packageService() {
legacy.log('Packaging service...');
progress.get('main').notice('Packaging');
log.info();
log.info('Packaging');
let shouldPackageService = false;
Expand Down

0 comments on commit 9e308bd

Please sign in to comment.