Skip to content

Commit

Permalink
Updated to v2 ask-cli.
Browse files Browse the repository at this point in the history
  • Loading branch information
javichur committed Jun 2, 2020
1 parent c4da655 commit 8bab5f0
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .ask/ask-states.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"askcliStatesVersion": "2020-03-31",
"profiles": {
"default": {
"skillInfrastructure": {
"@ask-cli/lambda-deployer": {
"deployState": {}
}
}
}
}
}
9 changes: 0 additions & 9 deletions .ask/config

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ test_output/
bst-debug.log
lambda/custom/.scannerwork/
node_modules/
package-lock.json
.DS_Store
55 changes: 44 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# alexa-skill-clean-code-template

(Updated to v2 ask-cli)

<https://github.com/javichur/alexa-skill-clean-code-template>

Alexa Skill Template with clean code (eslint, sonar), testing (unit tests, e2e), multi-language, Alexa Presentation Language (APL), In-Skill Purchases support (ISP) and more.
Expand All @@ -25,11 +27,17 @@ Available on the [AWS Serverless Application Repository].

1. Install ASK CLI (`npm install -g ask-cli`)

2. Install Visual Code (<https://code.visualstudio.com/)>
2. For Windows users, please fix Powershell problem once (more info <https://github.com/alexa/ask-cli/blob/develop/docs/FAQ.md#q-for-windows-users-if-your-skill-return-empty-response-and-log-shows-module-not-found-genericerrormapper-or-cannot-find-module-dispatchererrormappergenericerrormapper-how-to-resolve>):

```shell
Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force -Scope CurrentUser
```

3. Install Visual Code (<https://code.visualstudio.com/)>

3. Install Alexa Skill Kit (ASK) Toolkit for vscode (<https://marketplace.visualstudio.com/items?itemName=ask-toolkit.alexa-skills-kit-toolkit>)
4. Install Alexa Skill Kit (ASK) Toolkit for vscode (<https://marketplace.visualstudio.com/items?itemName=ask-toolkit.alexa-skills-kit-toolkit>)

4. You must edit ~/.aws/credentials file to add a valid AWS profile (aws_access_key_id, aws_secret_access_key) with the following policy. You must create a IAM user with this policy (<https://console.aws.amazon.com/iam/>):
5. You must edit ~/.aws/credentials file to add a valid AWS profile (aws_access_key_id, aws_secret_access_key) with the following policy. You must create a IAM user with this policy (<https://console.aws.amazon.com/iam/>):

```json
{
Expand Down Expand Up @@ -66,16 +74,20 @@ More info:
1. Configure ASK CLI with AWS profile (credentials):

```shell
ask init
ask configure
```

*(The old `ask init` command has been removed in ask-cli v2).*

2. Create a new skill from this template (<https://github.com/javichur/alexa-skill-clean-code-template>):

```shell
ask new --url https://github.com/javichur/alexa-skill-clean-code-template.git
ask new --template-url https://github.com/javichur/alexa-skill-clean-code-template.git
? Please type in your new skill name, alphanumeric only: my-new-skill
```

*(The old command `ask new --url` has been removed in ask-cli v2).*

3. Install dependencies:

```shell
Expand Down Expand Up @@ -130,7 +142,7 @@ Or use `npm run unit-test`
1. Configure ASK CLI with AWS profile (credentials):

```shell
ask init
ask configure
```

You must edit ~/.aws/credentials file to add a valid AWS profile (aws_access_key_id, aws_secret_access_key, region). More info: <https://docs.aws.amazon.com/es_es/cli/latest/userguide/cli-chap-configure.html>
Expand Down Expand Up @@ -195,7 +207,7 @@ The `ask deploy` command invokes hooks in order to install dependencies.
5. Test interaction model using `Utterance Profiler` (<https://developer.amazon.com/alexa/console/ask>)
6. Test your skill using **interactive** `ask dialog` (beta)
6. Test your skill using **interactive** `ask dialog`
```shell
ask dialog --locale "en-US"
Expand All @@ -209,10 +221,10 @@ Alexa > Hello World!
7. Test your skill using simulator (<https://developer.amazon.com/alexa/console/ask>)
8. Test JSON request/response using `ask simulate`
8. (Removed in ASK-CLI V2) Test JSON request/response using `ask simulate`
```shell
ask simulate --locale "en-US" --text "start hello world"
(Removed) ask simulate --locale "en-US" --text "start hello world"
```
9. Automating Unit Tests using Bespoken Tools. `.vscode/launch.json` edited.
Expand Down Expand Up @@ -372,8 +384,29 @@ $> unrestricted
## Useful commands
1. Download a skill. it allows you to download a complete skill (including skill.json) created in your Alexa developer account.
ASK CLI v1 to v2 Migration Guide:
<https://developer.amazon.com/es-ES/docs/alexa/smapi/ask-cli-v1-to-v2-migration-guide.html>
Check ask-cli version:
```shell
ask -v
```
Add testers to a beta test for the given Alexa skill:
```shell
ask smapi add-testers-to-beta-test -s <skill-id> --testers-emails <testers-emails-separated-by-commas>
```
Test your alexa skill:
```shell
ask dialog -l en-US
```
For Windows users, please fix the PowerShell problem once if your skill return empty response, and log shows "Module not found: GenericErrorMapper" or "Cannot find module './dispatcher/error/mapper/GenericErrorMapper'" (more info <https://github.com/alexa/ask-cli/blob/develop/docs/FAQ.md#q-for-windows-users-if-your-skill-return-empty-response-and-log-shows-module-not-found-genericerrormapper-or-cannot-find-module-dispatchererrormappergenericerrormapper-how-to-resolve>):
```shell
ask clone --skill-id xxxxxxxxxxxxxxx
Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force -Scope CurrentUser
```
23 changes: 23 additions & 0 deletions ask-resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"askcliResourcesVersion": "2020-03-31",
"profiles": {
"default": {
"skillMetadata": {
"src": "./skill-package"
},
"code": {
"default": {
"src": "./lambda/custom"
}
},
"skillInfrastructure": {
"userConfig": {
"runtime": "nodejs10.x",
"handler": "index.handler",
"awsRegion": "eu-west-1"
},
"type": "@ask-cli/lambda-deployer"
}
}
}
}
2 changes: 1 addition & 1 deletion lambda/custom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alexa-skill-clean-code-template",
"version": "1.2.5",
"version": "2.0.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8bab5f0

Please sign in to comment.