yo Team

I might have created the shortest lived NPM package ever with generator-tfs. After creating yo VSTS I was asked to create yo TFS.  Just a week after releasing yo TFS I am now releasing yo Team that combines the two offerings.  As with many projects when you do something for the second time you can learn from your first attempt.  yo TFS was so much better architected than yo VSTS I decided to apply the same architecture to yo VSTS as well.  In doing so I realized just how similar the two were.  Then I decided instead of maintaining two very similar code bases I would find a way to combine them and yo team was born. yo Team is able to adjust its REST APIs and behavior based on the format of your first answer.  To access Visual Studio Team Services (VSTS) simply provide your Team Services account name. For example I happen to own MyDemos.VisualStudio.com.  So to target VSTS I simply enter mydemos.


From this point forward yo Team will take advantage of the fact that VSTS has features unique to VSTS.  For example creating an Azure Service Endpoint is much easier in VSTS and requires less information to create than with TFS today.  I have to say today because every 3 months features from VSTS are packaged up and pushed as an update to TFS. It is just a matter of time before these features make it to TFS.  If you want to target TFS provide your full TFS URL including collection and the rest is the same.

Some features that make yo Team better than yo VSTS and yo TFS alone are a result of me learning the true power of Yeoman.

Better validation

If you were in a hurry with yo VSTS you might press enter too quickly and end up an empty entry.  Now properly using validation yo Team protects the excited users.


Improved Data Entry

With yo Team we are able to query TFS and VSTS for data so you do not have to type in values and instead you can now select them from a list. This will reduce user error as a result of typos. For example instead of having to remember and type in the name of the agent queue you want to use yo Team presents you a list of all your queues queried from TFS or VSTS (your list will be different from the one in the image below).


Sub Generators

yo Team allows you to use a much or as little as you want.  With yo VSTS if you decided after running it you would like to add Docker support you had to run the entire generator over again.  Now with yo Team you can simply run yo Team:Pipeline and simply add the CI/CD for Docker.  This also allows you to add pipelines to projects that were not created with yo Team. The main generator is Team with the following sub generators:

  • asp - scaffolds a .NET Core application using Razor and Bootstrap
  • azure - creates an Azure Service Endpoint
  • build - creates a CI build
  • docker - creates a Docker Service Endpoint
  • git - clones the Git repo and adds & commits the initial files
  • java - scaffolds a Java application using Tiles and Bootstrap
  • node - scaffolds a Node.js application using Pug and Bootstrap
  • pipeline - creates a CI build and CD release
  • project - creates the team project
  • registry - creates Docker Registry Service Endpoint
  • release - creates a release

You can get a list of all the sub generators by using the follow command

yo -help


To use the main generator simply enter

yo team

If you want to use any of the sub generators individually simply add a : and the name of the desired sub generator.  For example to create a project type

yo team:project 

Each generator will prompt you for the required information for that sub generator. If you prefer not to be prompted for values you can pass them all on the command line.  To learn which arguments each generator takes type --help after the generator name

yo team:project --help
  yo team:project [options] [<applicationname>] [<tfs>] [<pat>]

  -h,   --help          # Print the generator's options and usage
        --skip-cache    # Do not remember prompt answers             Default: false
        --skip-install  # Do not automatically install dependencies  Default: false

  applicationName  # name of the application                                          Type: String  Required: false
  tfs              # full tfs URL including collection or Team Services account name  Type: String  Required: false
  pat              # Personal Access Token to TFS/VSTS                                Type: String  Required: false

Any values you do not provide on the command line will be prompted for before the generator is run.

OK ladies and gentlemen let the Pull Request commence!

Comments (18) -

  • Dave Shaw

    1/31/2017 10:51:01 PM | Reply

    I'm giving this a go now after hearing about it on Radio TFS. It might be worth making a canonical post with all the install details. I had to dig back through the previous blog posts (after going from here to GitHub and back again) to find out how to install it.

    Finally found: "team Generates an app with CI/CD in Team Foundation Server or Team Services" and have it installed.


  • Alex K

    3/8/2017 4:33:02 PM | Reply

    Hi Donavan, I am trying yo team on our on-prem TFS 2017. However getting this error. Any help is appreciated!
    Thanks, Alex

      (http://tfs:8080/tfs/DefaultCollection)? http://tfs.ig.local:8080/tfs/Engineering
    ? What is your TFS Personal Access Token? ****************************************************
      Getting Agent Queues...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

    SyntaxError: Unexpected token < in JSON at position 0
        at JSON.parse (<anonymous>)
        at Request._callback (C:\Users\ak\AppData\Roaming\npm\node_modules\generator-team\generators\app\utility.js:605:25)
        at Request.self.callback (C:\Users\ak\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:187:22)
        at emitTwo (events.js:106:13)

    • Donovan

      3/10/2017 3:52:54 PM | Reply

      Check your PAT.

      • Alex

        3/10/2017 4:39:50 PM | Reply

        I did generate the PAT and copied it into the generator right on the spot. I am pretty sure it is correct. I suspect that there is something else is going on with the auth. Thanks for looking into it Donavan. I guess I will grab your source and debug it on my end.

        • Donovan

          3/10/2017 4:43:14 PM | Reply

          I was just playing with it and I copied an old PAT and got the same error.  What I need to do is return the HTML being returned. We are getting an error because you get the Auth page which is HTML and not JSON. I try and parse as JSON and we get that error.

          • Alex

            3/13/2017 8:45:01 PM | Reply

            Somehow PAT always fails on our on-prem. If there was a way to provide login-password, that would be awesome! TIA

            • Donovan

              3/13/2017 10:28:32 PM | Reply

              Your TFS is 2017 right? You are actually on the machine when you run it?  I have been using it all weekend that way rehearsing for a conference.

              • Alex

                3/13/2017 10:35:40 PM | Reply

                Yes, it's 2017. I am on a machine in the network under a domain. TFS is on a server on the network as well.

                • Andreas

                  12/8/2017 1:52:03 PM | Reply

                  just saw this and I got the same error working with Build Agents in a Windows container, trying to autheticate via PAT. The error was, that PAT only works with HTTPS in TFS 2017. So you will have to configure your TFS running on HTTPS to get the authentication with PAT running. Then it worked for me (I just created a certificate from our AD CA).

  • Donovan

    3/9/2017 12:38:25 AM | Reply

    Engineering is the name of your collection?  I will do some testing tonight.

  • Bart

    3/14/2017 2:50:01 PM | Reply

    Hi Donovan

    Great tool! I saw your demo on VS2017 Launch.
    I try to use 'yo team' for an angular 2 client app (not dotnet core)
    But i can only select .NET Core, Java or Node.js as back-end

    How should I set it up?


    • Donovan

      3/14/2017 10:03:02 PM | Reply

      I would use the node template. You really don't 'build' a client angular app. You download, resolve dependencies, run JavaScript test, package and deploy. The closest to that would be node. In the future we should just add angular to the list.

  • Mark

    4/2/2017 11:31:31 AM | Reply

    Hi Donovan,

    I get as far as creating the CI build and it fails on me:

    + Cloning repository markarrowsmith.visualstudio.com/_git/yo-vsts-demo
    warning: invalid credential line: [0x7FFECFFB70E3] ANOMALY: use of REX.w is meaningless (default operand size is 64)
    warning: You appear to have cloned an empty repository.
    + Creating Visual Studio Ultimate with MSDN Azure Service Endpoint
    + Creating CI build definition
    <!DOCTYPE html>

    SyntaxError: Unexpected token < in JSON at position 4
        at Object.parse (native)
        at Request._callback (C:\Users\marro\AppData\Roaming\npm\node_modules\generator-team\generators\app\utility.js:615:22)
        at Request.self.callback (C:\Users\marro\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:188:22)
        at emitTwo (events.js:106:13)
        at Request.emit (events.js:191:7)
        at Request.<anonymous> (C:\Users\marro\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:1171:10)
        at emitOne (events.js:96:13)
        at Request.emit (events.js:188:7)
        at IncomingMessage.<anonymous> (C:\Users\marro\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:1091:12)
        at IncomingMessage.g (events.js:286:16)


  • Richard Dalziel

    4/13/2017 7:20:32 AM | Reply

    Just caught this on DNR, great idea!

    I've had a play around a bit and just have a couple of items of feedback.

    Would it be possible to make all the horrible (but required) configuration around PAT, Subscriptions and Principals a one time thing and have subsequent runs not require so much configuration?

    Also, is there a way to configure such that a Team Project will not be created? This will help Single Team Project scenarios which have many repositories.

    Great work Donovan!

  • Rajiv

    5/30/2017 10:27:10 AM | Reply

    Saw this in the Visual Studio launch videos and loved the idea.

    I am trying to run Yo Team and get this: https://ibb.co/e45Lxa

    Also try tried with a .NET Core project and seem to be getting similar errors: https://ibb.co/my3JiF

    Here is the text version of the error:

    + Creating HMHelloCalculator Team Project
    + Cloning repository happiestmindsazuredemo.visualstudio.com/.../HMHelloCalculator
    warning: You appear to have cloned an empty repository.
    + Found Visual Studio Professional with MSDN Azure subscription
    + Creating Visual Studio Professional with MSDN Azure Service Endpoint

    SyntaxError: Unexpected token u in JSON at position 0
        at Object.parse (native)
        at Request._callback (C:\Users\rajiv.popat\AppData\Roaming\npm\node_modules\generator-team\generators\app\utility.js:213:26)
        at self.callback (C:\Users\rajiv.popat\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:188:22)
        at emitOne (events.js:96:13)
        at Request.emit (events.js:188:7)
        at Request.onRequestError (C:\Users\rajiv.popat\AppData\Roaming\npm\node_modules\generator-team\node_modules\request\request.js:884:8)
        at emitOne (events.js:96:13)
        at ClientRequest.emit (events.js:188:7)
        at TLSSocket.socketErrorListener (_http_client.js:310:9)
        at emitOne (events.js:96:13)

    Do you know if this is an issue with the template or am I doing something wrong?

    • Donovan

      5/30/2017 12:26:51 PM | Reply

      I would check your version of node. Use only LTS version. Also check the account name if using VSTS. Only enter the part before visualstudio.com. Finally make sure your PAT is correct.

  • Pascal Wallenius

    9/22/2017 1:26:41 PM | Reply

    The name of the generator when searching for it in the yo CLI menu: generator-team

    • Donovan

      10/2/2017 2:52:22 PM | Reply

      You can search for Team or Generator-Team.  If you just search for team you might have to use arrow keys to scroll results.

Pingbacks and trackbacks (8)+

Add comment