Skip to content
/ tfs Public

NodeJS wrapper for TFS command line tool.

License

Notifications You must be signed in to change notification settings

Acupera/tfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tfs

NodeJS wrapper for TFS command line tool.

Build Status npm version Dependency Status devDependency Status


Getting Started

If you're a NodeJS developer whishing to use it as a dependency, there is a module exposing all commands and described in the NodeJS API.

Installation

npm install -g tfs

Usage

Usage: tfs <cmd>

Commands

add [itemspec] [options]       Adds files and folders to version control.
checkin [itemspec] [options]   Commits pending changes in the current workspace.
checkout [itemspec] [options]  Makes the local file writable, and changes its status to "edit".
get [itemspec] [options]       Get the latest version of files and folders.
history [itemspec] [options]   Displays the revision history for one or more files, folders or both.
info [itemspec] [options]      Displays information about items under version control.
status [itemspec] [options]    Displays information about pending changes.
undo <itemspec> [options]      Removes pending changes from a workspace.
help [cmd]                     Displays help for [cmd].

Get more information about each command

Since tfs is a wrapper, it only check and execute commands via TF.exe command line tool. So to know how to use each command, just check the Tf Command-Line Utility Commands official documentation.

Also don't hesitate to use the help command, i.e. :

tfs [cmd] -h, --help

Or :

tfs help [cmd]

Options:

  -h, --help  output usage information

Good to know

For [itemspec] commands :

  • If you omit [itemspec], it will apply on the current directory.
  • You can use a relative, an absolute or a TFS path.
  • You can give multiple files/directories separated by a space.

NodeJS API

You can install tfs as a dependency for your NodeJS projects :

npm install tfs --save

Usage example

Some commands, like status, have extra-properties in their response.
To get real-life examples of common commands, check this Github directory.

To recursively get the status (pending changes) of files within D:\MyBranch\MyProject, admitting that this project is source-versionned via TFS, you could write the following code :

var tfs = require('tfs');

var callback = function(responseError, response) {
  if (responseError) {
    console.error(responseError.error);
    return;
  }

  console.log(response.message);
  console.log(response.status);
}

tfs('status', 'D:/MyProject/MyBranch', {
  recursive: true
}, callback);

tfs description

tfs(command, [items, [options, [callback]]]);

command

{String} TFS command to execute.

items

{Array} File(s) or changeset number.
        Can be null/undefined to use the current path.

options

{Object} TFS command options. Can be null/undefined.

callback

{Function} Function to call back once command executed.
           Will be called back with 2 arguments: error, response.

           error: {
             error:   {String},
             isError: true
           }

           response: {
             message: {String},
             isError: false
           }

About

NodeJS wrapper for TFS command line tool.

Resources

License

Stars

Watchers

Forks

Packages

No packages published