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

fix: allow extension to register multiple publish targets #4424

Merged
merged 9 commits into from
Oct 19, 2020

Conversation

a-b-r-o-w-n
Copy link
Contributor

@a-b-r-o-w-n a-b-r-o-w-n commented Oct 19, 2020

Description

Requires name and description for publish targets.

Task Item

fixes #4394

Screenshots

image

@coveralls
Copy link

coveralls commented Oct 19, 2020

Coverage Status

Coverage decreased (-0.04%) to 55.694% when pulling 6845241 on abrown/fix-publish-plugin into ed02171 on main.

Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Comment on lines +22 to +23
registration.addPublishMethod(plugin1);
registration.addPublishMethod(plugin2);
Copy link
Contributor

Choose a reason for hiding this comment

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

sweet!

@@ -25,6 +24,7 @@
},
"dependencies": {
"@botframework-composer/types": "*",
"@types/passport": "^1.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a dev dep right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This actually needs to be in the dependencies because we reference it in an exported type.

log('registering publish method', this.name);
this.context.extensions.publish[plugin.customName || this.name] = {
if (this.context.extensions.publish[plugin.name]) {
throw new Error(`Duplicate publish method. Cannot register publish method with name ${plugin.name}.`);
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 this is surfaced to the UI, maybe use formatMessage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couple of things:

  • It doesn't get to the UI. It will end up in the terminal if this is thrown.
  • Our server is not yet set up to handle i18n.

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I've seen, messages that get thrown out to the console (like those inside exceptions) don't need to be localized. Only strings that get displayed to a normal user do.

@@ -6,8 +6,8 @@ import path from 'path';
import { v4 as uuid } from 'uuid';
Copy link
Contributor

Choose a reason for hiding this comment

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

I highly recommend avoid using arrow functions for class methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted. I just did minimal updates to this file, so feel free to open a PR with that change.

class LocalPublisher {
class LocalPublisher implements PublishPlugin<PublishConfig> {
public name = 'localPublisher';
public description = 'Publish bot to local runtime';
static runningBots: { [key: string]: RunningBot } = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Record<string, RunningBot>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I always forget about Record. However, since this PR is scoped to the publishing name and description, I am going to leave as is.

@a-b-r-o-w-n a-b-r-o-w-n merged commit 20efe39 into main Oct 19, 2020
@a-b-r-o-w-n a-b-r-o-w-n deleted the abrown/fix-publish-plugin branch October 19, 2020 17:59
@cwhitten cwhitten mentioned this pull request Nov 13, 2020
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
…4424)

* build extension bundle when building client

* enable re-use of plugin host

* require name and description for publish plugins

* update publish plugins

* add multiple publish plugins in sample-ui-plugin

* update azure publish description

* wrap file path in quote for windows compat

* fix tests
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.

"Publish bot to Azure" choice has no text
5 participants