Contents tagged with Yeoman
A long overdue update of the Microsoft Teams Apps Yeoman generator – we’re now up to version 2.5.0! It’s a fairly substantial update both in the generator and in the generated code – this update will make future updates a lot smoother and will allow for enabling more features going forward. Thanks to all who provided feedback and input and has tested the generator over the last few months.
You can get the latest generator by running
npm install generator-teams@latest –global
The actual Yeoman generator has been refactored and changed so that it used TypeScript AST (abstract syntax tree) to dynamically generate some of the TypeScript files. This will open up for adding new artifacts to existing projects without having to do weird string and text file parsing. We’ve also refactored some generated files out to separate npm packages, so that those files and controls can be updated without you having to manually update files or generate new solutions – more about this below.
In order to improve the generated app we have moved some of the generated files, controls and base classes into separate npm packages. This allows you to get the latest and greatest in these packages with just a simple npm command – and not having to manually copy and paste.
The generated solution is hosted in a node.js Express server and the new generated solutions will dynamically discover what components and extensions you have in your solution and automatically register the different routes. All this is done by using TypeScript decorators and Express routes that are defined in the express-msteams-host npm package. Previous versions of the generator had a quite complex server implementation and since it was scaffolded by the generator it was close to impossible to update with new features or fixes. Now all you have to do is decorate your bots, connectors and outgoing webhooks with these decorators and their routes will automatically be picked up and registered. For more information, see the documentation.
A similar approach has been taken to the clients side of the generated solution. A few releases ago the UX was moved to leverage the Microsoft Teams React controls, and with this version we’ve moved the base page class (previously generated by the generator) into a separate npm package called msteams-react-base-component. Similar story here, this will make it way easier for everyone to consume updates to this component without running the generator again.
Of course there are plenty of more stuff that has been fixed or refactored such as; the build pipeline that has been upgraded to Gulp 4 and Webpack 4 and improved logging in the generated solution using the debug module – and you can read about the other changes in the change log.
It’s exciting times in Microsoft Teams Apps land! We now have a corporate store for Teams Apps, we’ve seen that the SharePoint and Microsoft Teams product groups are having secret meetings to improve the integration between (my favorite) two services. I’m of course looking into this and will share some exciting updates when we close in on more public reveals of features – Microsoft Ignite mayhaps. Oh, if you’re at Microsoft Ignite, try to find me somewhere in a Theater session or lurking in the SharePoint and Microsoft Teams booths if you want to discuss the generator.
A couple of months back I started creating a Yeoman generator to make it easier for me to scaffold, build and deploy the Microsoft Teams extensions (now apps). I’ve received very good feedback on it and had some very nice contributions to the project, which was hosted on my public Github account.
To really make this available for everyone to use I’ve been discussing this project with the Microsoft Teams team about having it “officially backed” by the real team and nut just me as an individual. After some interesting discussions the Microsoft Teams generator now have a new home.
I think this is great and it will allow more organizations to actually use the generator. We’ve switched to MIT licensing and we added some contribution guidelines to be able to do this move. The rest is intact. All the old links to the repo will now redirect to the new one and you still use npm to install it in the same way.
We have some nice updates coming shortly to it, of which some you can see in the preview branch, that uses all the latest and greatest features of Microsoft Teams Apps.
A big thank you to Bill Bliss who set things in motion and did all the heavy lifting, and of course to all the contributors to the generator and to the great Microsoft Teams team!
A couple of weeks back I published a Yeoman generator to build Tabs for Microsoft Teams. Since then I've continued to add stuff to it as the Teams team has continued to add features to their extensibility story. So, this generator is not only for creating Tabs, but now also for adding Bots and Custom Bots to Microsoft Teams. With that I decided to rename the generator to yo teams (generator name is generator-teams).
I'm very thankful to the over 600 downloads within less of a month, and all the positive feedback, the issues and PR created. Keep it coming.
The two big new features of the generator is the ability to add either a reference to an existing bot that you want to use (your own, or any bot in the Bot Framework directory) or to create a bot from scratch, using the Bot Framework. You can also add a custom bot, which is a Microsoft Teams specific webhook that acts like a bot, which can be used by specific Teams only and you don't have to add it to the Bot Framework - perfect for those internal smart bots you want to build.
The source code has also gone through some heavy refactoring with sub-generators and all. There's more to come…
If you have any issues, or feedback, or problem or just feeling chatty, then use the Issues list on Github.
What do I need to do?
If you already used the old generator, uninstall it with npm uninstall generator-teams-tab --global and then install the new generator with npm install generator-teams --global. All your current solutions will work, but I recommend you to, if you feel like it, to "move" all your code over to a newly created project.
The old npm package is deprecated and you will get a warning if you try to install it.
The Github repository has been renamed, but the old one will still redirect you to the correct location. You can find it here: https://github.com/wictorwilen/generator-teams
With the Teams Tab generator you can in an easy manner scaffold out the project and get a build and deployment pipeline, and be up and running in a few minutes.
The project that will be created is a TypeScript based project with a set of Gulp tasks to build the project and package the manifest, and optionally a built-in Express server to host the web sites and configuration so that you can with a simple command deploy your project to an Azure Web App.
How to get it
The generator is published as an npm package and you use npm to install it. The following command will install it as a global package for you to scaffold your Teams tabs.
npm install generator-teams-tab --global
How to use it
To create a new Teams Tab all you need to do is open up a command prompt and use Yeoman to create the project. The generator will ask you a set of questions and your project will configured based on those.
How to use the project
The project contains all source code you need to build and deploy tabs. Use Visual Studio Code or whatever text editor you prefer. The source code is divided into two areas. The first one being the actual tabs (pages and scripts), located in ./src/app You will find one folder called web which contains the web pages required for a tab; such as the actual tab page, the configure page and remove page. In the scripts folder you will have the TypeScripts file in which you build the logic for your tabs. For instance the actual main tab page, tab.html, has a corresponding tab.ts TypeScript file. You'll get it…
In the ./src/app folder there is also a TypeScript file called server.ts. Note, this file only exists if you answers yes to the question on using Express to host the Tab. This file is the server side node.js web server. If you need to modify the paths or want it to do fancier stuff than just client-side scripting this is where you start hacking.
There's also a folder calle ./src/manifest which contains the Tab manifest. A json file you might want to configure. And that folder also contains the two images you need to have for a Tab.
How to build it
Once you've built it you can follow the instructions in the README.md file to deploy it to an Azure Web App.
The manifest for the tab is created by using another Gulp task:
This task will create a zip file that you use to upload to your Teams team and it references the specified web site hosting the tabs. The file being created is located at ./package/tab.zip
This is great, but I want to…
I know, you want to have more stuff in the generator. It's all available on Github for you to grab and hopefully come back with suggestions. Go git it here: https://github.com/wictorwilen/generator-teams-tab