From 212ec7dacf3fb40607ffe71588be5f066d6b4500 Mon Sep 17 00:00:00 2001 From: Rommel Berrios Date: Tue, 4 Jun 2019 17:38:35 -0600 Subject: [PATCH] Fix issue on path option and undefined platforms --- CHANGELOG.md | 2 ++ package.json | 2 +- src/InteractionBuilder.ts | 5 +++-- src/commands/interaction.ts | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0395070..ea1553c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Now alexa spec is splitted into smaller units testing specific functionality - Fixed @sys. slots on dialogflow were converted into a different type +- Fixed issue on path option on the interaction command +- Fixed issue with platforms undefined ## [2.1.2] - 2019-05-08 diff --git a/package.json b/package.json index e9dfe31..623f2d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "voxa-cli", - "version": "2.2.0-alpha1", + "version": "2.2.0-alpha2", "description": "The Voxa CLI tools", "bin": { "voxa": "./bin/voxa.js" diff --git a/src/InteractionBuilder.ts b/src/InteractionBuilder.ts index f177b47..9e26e57 100644 --- a/src/InteractionBuilder.ts +++ b/src/InteractionBuilder.ts @@ -113,7 +113,7 @@ function defaultOptions(interactionOptions: IInteractionOptions): IDefinedIntera (acc: string[], next: any[]) => { const key = next[0]; const value = next[1]; - if (!_.isEmpty(value)) { + if (value) { acc.push(key); } return acc; @@ -121,6 +121,7 @@ function defaultOptions(interactionOptions: IInteractionOptions): IDefinedIntera [] as ISupportedPlatforms[] ) .concat(platforms) + .filter() .uniq() .value() as ISupportedPlatforms[]; @@ -128,7 +129,7 @@ function defaultOptions(interactionOptions: IInteractionOptions): IDefinedIntera throw Error("Spreadsheet were not specified in the right format"); } - platforms = platforms || DEFAULT_INTERACTION_OPTIONS.platforms; + platforms = _.isEmpty(platforms) ? DEFAULT_INTERACTION_OPTIONS.platforms : platforms; return { rootPath, diff --git a/src/commands/interaction.ts b/src/commands/interaction.ts index feac0e1..cbf530c 100644 --- a/src/commands/interaction.ts +++ b/src/commands/interaction.ts @@ -41,7 +41,7 @@ export async function action(cmd: any) { let interaction = {} as any; let auth = {} as any; try { - interaction = require(interationPath); + interaction = await fs.readJSON(interationPath); } catch (e) { const sampleInteraction = { spreadsheets: ["INTENT SPREADSHEET", "PUBLISHING SPREADSHEET"]