-
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #1639 from jovotech/v4/dev
🔖 Prepare latest release
- Loading branch information
Showing
21 changed files
with
487 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
platforms/platform-alexa/src/cli/commands/CertifyCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { JovoCliError, MAGNIFYING_GLASS, PluginCommand, Task, flags } from '@jovotech/cli-core'; | ||
import * as smapi from '../smapi'; | ||
import { AlexaCli } from '..'; | ||
import { PublicationMethodLike, PublicationMethod } from '../interfaces'; | ||
|
||
export class CertifyCommand extends PluginCommand { | ||
$plugin!: AlexaCli; | ||
static id = 'certify:alexa'; | ||
static description = 'This submits an alexa skill to certification'; | ||
static examples: string[] = ['jovo certify:alexa']; | ||
static flags = { | ||
...PluginCommand.flags, | ||
'skill-id': flags.string({ char: 's', description: 'Alexa Skill ID' }), | ||
'ask-profile': flags.string({ | ||
description: 'Name of used ASK profile', | ||
}), | ||
'publication-method': flags.string({ | ||
options: Object.values(PublicationMethod), | ||
default: PublicationMethod.MANUAL_PUBLISHING, | ||
}), | ||
}; | ||
static args = []; | ||
|
||
async run(): Promise<void> { | ||
const { flags } = this.parse(CertifyCommand); | ||
const skillId = flags['skill-id'] || this.$plugin.config.skillId; | ||
const askProfile = flags['ask-profile'] || this.$plugin.config.askProfile || 'default'; | ||
const publicationMethod: PublicationMethodLike = flags['publication-method']; | ||
|
||
const certifyTask: Task = new Task( | ||
`${MAGNIFYING_GLASS} Submitting Alexa Skill ${skillId} to Certification`, | ||
async () => { | ||
if (!skillId) | ||
throw new JovoCliError({ | ||
message: 'Cannot submit Skill to Certification without skillId', | ||
hint: 'Either add a skillId to the stage in the project configuration or add the --skill-id flag', | ||
}); | ||
|
||
return smapi.submitSkillForCertification(skillId, publicationMethod, askProfile); | ||
}, | ||
); | ||
await certifyTask.run(); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
platforms/platform-alexa/src/cli/commands/ValidateCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
JovoCliError, | ||
Log, | ||
MAGNIFYING_GLASS, | ||
PluginCommand, | ||
Task, | ||
flags, | ||
} from '@jovotech/cli-core'; | ||
import * as smapi from '../smapi'; | ||
import { AlexaCli } from '..'; | ||
|
||
export class ValidateCommand extends PluginCommand { | ||
$plugin!: AlexaCli; | ||
static id = 'validate:alexa'; | ||
static description = 'This submits a skill validation'; | ||
static examples: string[] = ['jovo validate:alexa']; | ||
static flags = { | ||
'skill-stage': flags.string({ | ||
description: 'Alexa Skill Stage', | ||
options: ['development', 'live', 'certification'], | ||
default: 'development', | ||
}), | ||
'skill-id': flags.string({ char: 's', description: 'Alexa Skill ID' }), | ||
'ask-profile': flags.string({ | ||
description: 'Name of used ASK profile', | ||
}), | ||
'locales': flags.string({ multiple: true, char: 'l' }), | ||
...PluginCommand.flags, | ||
}; | ||
static args = []; | ||
|
||
async run(): Promise<void> { | ||
const { flags } = this.parse(ValidateCommand); | ||
const skillId = flags['skill-id'] || this.$plugin.config.skillId; | ||
const askProfile = flags['ask-profile'] || this.$plugin.config.askProfile || 'default'; | ||
const locales = | ||
flags.locales || | ||
Object.values(this.$plugin.config.locales || {}).reduce( | ||
(prev, curr) => [...prev, ...curr], | ||
[], | ||
); | ||
|
||
const validateTask: Task = new Task( | ||
`${MAGNIFYING_GLASS} Submitting Alexa Skill ${skillId} to Validation`, | ||
async () => { | ||
if (!skillId) | ||
throw new JovoCliError({ | ||
message: 'Cannot submit Skill Validation without skillId', | ||
hint: 'Either add a skillId to the stage in the project configuration or add the --skill-id flag', | ||
}); | ||
|
||
const validationResponse = await smapi.submitSkillValidation( | ||
skillId, | ||
locales, | ||
flags['skill-stage'], | ||
askProfile, | ||
); | ||
return `Started Validation with id ${validationResponse.id}`; | ||
}, | ||
); | ||
await validateTask.run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.