jovotech / jovo-cli

🛠 Command Line Interface for the Jovo Framework: Makes voice experience deployment a breeze, including features like local development and staging.
https://www.jovo.tech/marketplace/jovo-cli
Apache License 2.0
57 stars 31 forks source link

Feature: build skill.json / agent.json from app.json #19

Closed fgnass closed 6 years ago

fgnass commented 6 years ago

We currently .gitignore the whole /platforms folder and consider /models to be our single source of truth. Unfortunately this approach is currently not really feasible since some files (skill.json, agent.json, .ask/config) must be manually maintained. Our current solution is to copy/create these files as part of our npm run build script. Would you be open to the idea to generate these files from app.json?

jankoenig commented 6 years ago

Hi @fgnass, great suggestion.

One idea: Did you know you can add specific elements of e.g. the skill.json to your app.json? Take a look at our templates for Audioplayer Skills and Skill Events.

Anything else that you need to maintain manually that we should make possible to add to the app.json? I agree that having a "single source of truth" is the best way to work in a team, especially with staging.

fgnass commented 6 years ago

No, I didn't know! That already helps a lot. The only thing left is probably the .ask/config file that contains the skill-ids/endpoints for the different deployment targets. What are your best practices for working with multiple stages and a team of developers?

jankoenig commented 6 years ago

We just launched staging last week 🎉. Unfortunately, we're still in the process of documenting it. Here are the PRs for the framework and CLI.

Here's an example app.json:

{
    "alexaSkill": {
        "nlu": "alexa"
    },
    "src": "src",
    "defaultStage": "dev",
    "stages": {
        "dev": {
            "endpoint": "${JOVO_WEBHOOK_URL}",
            "alexaSkill": {
                "skillId": "amzn1.ask.skill.XXX"
            }
        },
        "test": {
            "endpoint": "arn:aws:lambda:us-east-1:XXX",
            "alexaSkill": {
                "skillId": "amzn1.ask.skill.XXXX",
                "ask-profile": "someprofile"
            },
            "config": {
                "db": {
                    "type": "dynamodb",
                    "tableName": "SomeTableName"
                }
            }
        }
    }
}

Let me know if anything's missing!

fgnass commented 6 years ago

Perfect timing and works like a charm!

In our setup each developer uses their own skill-id. Would you suggest to create a stage for each or would it make sense to add something like ${SKILL_ID} that gets resolved against process.env?

jankoenig commented 6 years ago

Yes, this would make sense. Currently working on our v1.2 update, but hope to get env support out soon after that

aswetlow commented 6 years ago

I'm thinking of something like ${ENV.SKILL_ID}.

jankoenig commented 6 years ago

Thanks @fgnass! This was added to the latest release, take a look at the docs here: https://www.jovo.tech/framework/docs/advanced#staging-example

${process.env.SKILL_ID}