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.

image

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.

image

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.

image

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

image

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
Usage:
  yo team:project [options] [<applicationname>] [<tfs>] [<pat>]

Options:
  -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

Arguments:
  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 (11) -

  • Hi,
    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.

    Cheers,
    Dave
  • 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...


    undefined:1
    <!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)
    • Check your PAT.
      • 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.
        • 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.
          • Somehow PAT always fails on our on-prem. If there was a way to provide login-password, that would be awesome! TIA
            • 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.
              • 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.
  • Engineering is the name of your collection?  I will do some testing tonight.
  • 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?

    Tx!
    • 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.

Pingbacks and trackbacks (2)+

Add comment

Loading