cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: enable SPFx package for deployment in Teams

Open waldekmastykarz opened this issue 3 years ago • 13 comments

Usage

spfx package teams enable

Description

Checks if the SPFx package is enabled for deployment in Teams. Optionally, changes the package to enable it for deployment in Teams

Options

Option Description
-f, --filePath <filePath> Absolute or relative path to the .sppkg file to analyze
--fix Specify, to update all web parts in the package to be exposed in Teams

Additional Information

The idea of this command is to help admins analyze if the particular SPFx package can be deployed in Teams and enable it if needed without having to manually change the package.

The command has the following steps:

  • unzips the specified .sppkg file
  • discovers all web parts
  • for each web part checks its manifest and verifies if Teams is listed in supported hosts
  • the command prints in console all discovered web parts and whether they're enabled for deployment in Teams or not
  • when you use the --fix option, the command will unzip the .sppkg file, update all web part manifests so that all web parts are enabled in Teams, increase the package minor version number and create a new zip

This command could also be used in a script that downloads all .sppkg files from the app catalog, analyzes them and provides report or downloads all .sppkg files from the app catalog and updates all .sppkg files to be deployable in Teams.

waldekmastykarz avatar Apr 17 '21 18:04 waldekmastykarz

Hey @pnp/cli-for-microsoft-365-maintainers, what do you think?

waldekmastykarz avatar Apr 17 '21 18:04 waldekmastykarz

Sounds like a great addition, two remarks:

  • Do we want to allow for exclusion of certain WebParts? I can imagine that there are scenario's where you do not want all webparts but just a subset?
  • Do we want to provide the option to switch between Personal and Teams Tab? We could add a flag with an option to update the package for Both, or either of those scenario's (something like a --tabType)

appieschot avatar Apr 22 '21 19:04 appieschot

Do we want to allow for exclusion of certain WebParts? I can imagine that there are scenario's where you do not want all webparts but just a subset?

I'm on the fence if this wouldn't complicate the command too much. For this to work, we'd need to offer a way for you to see which web parts are in the solution so that you can select them by their alias. So either the command would need to be interactive, or we'd need to introduce another command that you can use to list web parts in the package.

Do we want to provide the option to switch between Personal and Teams Tab?

If we offered this option, wouldn't it be necessary for you to be able to specify this per web part, which would again complicate this command's usage? Considering the usage (easily enable SPFx web parts for teams) and the target audience (admins) of this command, is there something against a quick default to expose web parts both as personal and configurable tabs?

waldekmastykarz avatar Apr 24 '21 12:04 waldekmastykarz

Agree Let's start with the command version that adds it to both personal for all webparts in package. We can always iterate on that if usage indicates it's worth it.

appieschot avatar Apr 24 '21 13:04 appieschot

Could give this a go!

MathijsVerbeeck avatar Apr 26 '23 15:04 MathijsVerbeeck

Awesome, all yours @MathijsVerbeeck !

milanholemans avatar Apr 26 '23 15:04 milanholemans

@waldekmastykarz @appieschot Just a minor question, as I'm able to define which webparts are defined as a Teams app or which ones aren't (see screenshot below): image

However, I currently check whether the webpart is either

  • TeamsPersonalApp
  • TeamsMeetingApp
  • TeamsTab

If we would use --fix, how would we define which value that we should add to the supportedHosts value? Would we prompt the user to define which ones he would like to add?

MathijsVerbeeck avatar May 06 '23 08:05 MathijsVerbeeck

I suggest we go with Personal and configurable tab. Meeting apps are typically more specific and exposing existing web parts as meetings apps without any changes might not be as valuable.

waldekmastykarz avatar May 07 '23 17:05 waldekmastykarz

Happy to skip the teamsmeetingapp but I also see some value in the TeamsTab option. We could add add an extra parameter (--suportedHost) where we ask the user to specify what they want when using --fix right? We could have a default value for TeamsPersonalApp

appieschot avatar May 10 '23 08:05 appieschot

Happy to skip the teamsmeetingapp but I also see some value in the TeamsTab option. We could add add an extra parameter (--suportedHost) where we ask the user to specify what they want when using --fix right? We could have a default value for TeamsPersonalApp

Nice idea, we can certainly expose the --supportedHost option. I suggest that its default value is personal and configurable tab, and optionally, folks can override by specifying their comma-separated values.

waldekmastykarz avatar May 10 '23 17:05 waldekmastykarz

@pnp/cli-for-microsoft-365-maintainers so coming back from a small discussion that started when reviewing the PR I was wondering if this is the best place for this option supportedHosts. I mean the first comment is the way we have the command now is that it will not allow to change the supportedHosts if the app on which we are running the command is already enabled to Teams. This seems to be ok but I thing it would be more helpful to add more freedom to it and even if an app is already exposed to teams we could overwrite the supportedHosts when they are specified and fix option is passed as well. Hat do you think? That way we could give the user the possibility to adjust the hosts even on an enabled app 🤔. Other idea I have (maybe also a stupid one 😅) is to create a separate dedicated command which would allow the user to modify the SPFx project supported hosts, and I mean all of them, so not only teams but also SharePoint and office.com and outlook.com.

What do you think? Is this a good idea or a stupid one 😉?

Adam-it avatar Jun 18 '23 12:06 Adam-it

I think there's place for both commands: an easy (this) one that just enables web parts for use in Teams, and another, that gives you more granular control and which is more of an API projection.

waldekmastykarz avatar Jun 18 '23 12:06 waldekmastykarz

Reopening due to lack of activity.

Adam-it avatar Feb 03 '24 01:02 Adam-it