Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event commands #260

Merged
merged 18 commits into from
Jun 15, 2020
Merged

Event commands #260

merged 18 commits into from
Jun 15, 2020

Conversation

sandeep-paliwal
Copy link
Contributor

Added support to add/delete event actions using generators.
aio app:add:event
aio app:delete:event
aio app:delete:event <action-name>

Description

Related Issue

Motivation and Context

How Has This Been Tested?

manual and unit tests

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x ] I have signed the Adobe Open Source CLA.
  • [x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • [x ] All new and existing tests passed.


const BaseCommand = require('../../../BaseCommand')
const yeoman = require('yeoman-environment')
const debug = require('debug')('aio-cli-plugin-app:init')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should use debug anymore..
could you switch to aioLogger.debug ?
I would change the label too with the @adobe prefix..
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:add:event', { provider: 'debug' })

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do this everywhere :)


debug(`adding component ${args.component} to the project, using flags: `, flags)

const services = (config.get('services') || []).map(s => s.code).join(',')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the services argument, it's not used by the add-events generator..

}
}

AddEventCommand.description = `Add a new event action
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe let's rename this to Add a new Adobe I/O Events action

this.error('<action-name> must also be provided when using --yes=')
}

// todo should undeploy specific action ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the todo comment

async run () {
const { args, flags } = this.parse(AddEventCommand)

debug(`adding component ${args.component} to the project, using flags: `, flags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is args.component? there is no args right?
just say adding a new events action to the project using flags: '${flags}'

async run () {
const { args, flags } = this.parse(DeleteEventCommand)

debug('deleting an action from the project, with args', args, 'and flags:', flags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here when you will switch to aioLogger be careful as I don't think it supports multi args like debug() does

also deleting an events action..

name: 'action-name',
description: 'Action name to delete, if not specified you will choose from a list of actions',
default: '',
required: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed let's make this required and remove the if (flags.yes && !args['action-name']) {
also let's rename action-name to event-action-name

Updated tests based on these changes
Copy link
Member

@moritzraho moritzraho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm we should merge this once there is a new release of generator aio app + we do a v bump

generator plugin updated to use version 1.1.1
@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #260 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #260   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        23    +2     
  Lines          775       808   +33     
  Branches       106       106           
=========================================
+ Hits           775       808   +33     
Impacted Files Coverage Δ
src/commands/app/add/event.js 100.00% <100.00%> (ø)
src/commands/app/delete/event.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a7731a...a6ef706. Read the comment docs.

@sandeep-paliwal sandeep-paliwal merged commit e2ae85b into adobe:master Jun 15, 2020
@sandeep-paliwal sandeep-paliwal deleted the event_commands branch February 5, 2021 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants