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

chore: interaction model generator can now also write to standard output #2

Closed

Conversation

germanviscuso
Copy link

@germanviscuso germanviscuso commented Sep 9, 2020

Description

If no filename parameter is passed to function buildAndWrite in InteractionModelGenerator.ts then the built model is sent to standard output

Motivation and Context

This change allows to make build time scripts that regenerate and fully overwrite the model even more concise. Going for example from this:

"prepublish": "node build_interaction_model.js && mv en-US-generated.json ../skill-package/interactionModels/custom/en-US.json"

to this:

"prepublish": "node build_interaction_model.js > ../skill-package/interactionModels/custom/en-US.json"

Testing

When through the standard build and test procedure in the project including husky, commitlint and passing all the battery of included tests

Screenshots (if appropriate)

Screenshot 2020-09-09 at 23 39 46

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs(Add new document content)
  • Translate Docs(Translate document content)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • My commit message follows Conventional Commit Guideline

License

  • I confirm that this pull request can be released under the Apache 2 license

const interactionModelJson: string = JSON.stringify(this.build(), null, 2);
const path: string = join(process.cwd(), filename);
fs.writeFileSync(path, interactionModelJson);
if (filename == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if (filename === null)

@Shreyas-vgr
Copy link
Contributor

Shreyas-vgr commented Oct 21, 2020

Added this change as part of this PR #24 to be checked in.
Closing this PR, thanks for the changes.

mikelid-zz pushed a commit that referenced this pull request Feb 4, 2021
- ControlManager.handleInternalError can produce a complete response,
  including setting the shouldEndSession flag.

- ControlHandler has three modes for handling exceptions that occur
  during initialization and/or canHandle.
   - Default - ControlManager.handleInternalError produces response
   - Alternative #1 - silently return canHandle=false
   - Alternative #2 - rethrow exception to topLevel

BREAKING CHANGE:
 - the default behavior for an exception thrown during canHandle is
   changed. Revert to the old behavior by setting
   ControlHandler.canHandleThrowBehavior = 'Rethrow'
mikelid-zz pushed a commit that referenced this pull request Feb 4, 2021
- ControlManager.handleInternalError can produce a complete response,
  including setting the shouldEndSession flag.

- ControlHandler has three modes for handling exceptions that occur
  during initialization and/or canHandle.
   - Default - ControlManager.handleInternalError produces response
   - Alternative #1 - silently return canHandle=false
   - Alternative #2 - rethrow exception to topLevel

BREAKING CHANGE:
 - the default behavior for an exception thrown during canHandle is
   changed. Revert to the old behavior by setting
   ControlHandler.canHandleThrowBehavior = 'Rethrow'
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