Merge pull request #1 from ojferro/master

Thank you Oswaldo!
This commit is contained in:
Liang Zhu 2018-04-27 19:46:15 -07:00 коммит произвёл GitHub
Родитель 617358427a 92239d4ab3
Коммит 352a2ee941
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
13 изменённых файлов: 1386 добавлений и 298 удалений

295
.gitignore поставляемый
Просмотреть файл

@ -1,288 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
node_modules/*
output/*
processPayload.json
process/*.json
src/*.js
src/*.js.map
build/*

2
.npmrc Normal file
Просмотреть файл

@ -0,0 +1,2 @@
registry=https://witiq.pkgs.visualstudio.com/_packaging/processimportexport/npm/registry/
always-auth=true

12
.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch process import ",
"program": "${workspaceFolder}/build/ImportExportProcess.js",
"sourceMaps": true
}
]
}

18
.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,18 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

Просмотреть файл

@ -1,14 +1,30 @@
# Introduction
# Contributing
The Process Import/Export (PIE) feature provides users with a way to automate the [Process](https://docs.microsoft.com/en-us/vsts/work/customize/process/manage-process?view=vsts) replication across accounts through a Node.js command line interface.
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
The tool gives user option to export a Process from an account, and save it locally, and/or to do an online re-import into another account.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
# Getting Started
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
**1. Prerequisite**
- Install [npm](https://www.npmjs.com/get-npm)
- From repository root, run `npm install`
**2. Build**
- In root directory of repository, run `npm run build`
**3. Run**
- Set up `configuration.json`
- Configure account url and credentials. Source account is required; target account credentials required only if doing online re-import.
- `"sourceProcessName"` name of the Process on the source account to export.
- `"targetProcessName"` optional new name to give to Process in the target account.
- `"writeToFile"` serialize exported Process to file (not mutually exclusive with onlineReImport)
- `"onlineReImport"` whether exported Process should be imported into specified target account.
- `"overwritePicklist"` property that specifies which to keep if there is a conflict (by refName) between the picklists on source and target.
- Launch application `node ./build/ImportExportProcess.js` on root directory of repository.

14
configuration.json Normal file
Просмотреть файл

@ -0,0 +1,14 @@
{
"sourceAccountUrl": "<Source account url>",
"sourceAccountToken": "<Source account PAT>",
"targetAccountUrl": "<Target account url>",
"targetAccountToken": "<Target account PAT>",
"options" : {
"sourceProcessName": "<SourceProcessName>",
"targetProcessName": "<Optional, set as empty string to use source process name>",
"writeToFile": true,
"onlineReImport": true,
"overwritePicklist": true,
"__cleanupTargetAccount": true
}
}

62
package-lock.json сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,62 @@
{
"name": "dev",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "9.6.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.2.tgz",
"integrity": "sha512-UWkRY9X7RQHp5OhhRIIka58/gVVycL1zHZu0OTsT5LI86ABaMOSbUjAl+b0FeDhQcxclrkyft3kW5QWdMRs8wQ==",
"dev": true
},
"node": {
"version": "10.0.0",
"resolved": "https://witiq.pkgs.visualstudio.com/_packaging/processimportexport/npm/registry/node/-/node-10.0.0.tgz",
"integrity": "sha512-Ps0lFNyTDEzH8yqCZ3hBXARs+H28dn1cmJt2oxWgqIdMvt0+SByZuiA12mEV+akVjXxkSuuaBH8I92C0SrnFkQ==",
"requires": {
"node-bin-setup": "1.0.6"
}
},
"node-bin-setup": {
"version": "1.0.6",
"resolved": "https://witiq.pkgs.visualstudio.com/_packaging/processimportexport/npm/registry/node-bin-setup/-/node-bin-setup-1.0.6.tgz",
"integrity": "sha512-uPIxXNis1CRbv1DwqAxkgBk5NFV3s7cMN/Gf556jSw6jBvV7ca4F9lRL/8cALcZecRibeqU+5dFYqFFmzv5a0Q=="
},
"tunnel": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz",
"integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM="
},
"typed-rest-client": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-0.12.0.tgz",
"integrity": "sha1-Y3b1Un9CfaEh3K/f1+QeEyHgcgw=",
"requires": {
"tunnel": "0.0.4",
"underscore": "1.8.3"
}
},
"typescript": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.1.tgz",
"integrity": "sha512-Ao/f6d/4EPLq0YwzsQz8iXflezpTkQzqAyenTiw4kCUGr1uPiFLC3+fZ+gMZz6eeI/qdRUqvC+HxIJzUAzEFdg==",
"dev": true
},
"underscore": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
},
"vso-node-api": {
"version": "99.99.99",
"resolved": "https://witiq.pkgs.visualstudio.com/_packaging/processimportexport/npm/registry/vso-node-api/-/vso-node-api-99.99.99.tgz",
"integrity": "sha1-6lOYjiSfQZ00K1MdlxR1X8w9LmI=",
"requires": {
"tunnel": "0.0.4",
"typed-rest-client": "0.12.0",
"underscore": "1.8.3"
}
}
}
}

20
package.json Normal file
Просмотреть файл

@ -0,0 +1,20 @@
{
"name": "dev",
"version": "1.0.0",
"description": "Proces import export node.js application",
"main": "",
"scripts": {
"build": "tsc -p tsconfig.json"
},
"keywords": [],
"author": "",
"license": "",
"devDependencies": {
"@types/node": "^9.6.2",
"typescript": "^2.8.1"
},
"dependencies": {
"node": "^10.0.0",
"vso-node-api": "^99.99.99"
}
}

15
src/Constants.ts Normal file
Просмотреть файл

@ -0,0 +1,15 @@
export const PICKLIST_NO_ACTION = "PICKLIST_NO_ACTION";
export const configurationFilename = "configuration.json";
export const defaultEncoding = "utf-8";
export const defaultLogFileName = "process_import_export.log";
export const defaultConfiguration = {
"sourceAccountUrl": "<Source account url - eg: https://fabrikamSource.visualstudio.com>",
"sourceAccountToken": "<Personal access token for source account>",
"targetAccountUrl": "<Target account url - eg: https://fabrikamTarget.visualstudio.com>",
"targetAccountToken": "<Personal access token for target account, may be same as source>",
"options" : {
"sourceProcessName": "<Process to import/export - eg: MyAgile>",
"writeToFile": true,
"onlineReImport": true
}
};

24
src/Errors.ts Normal file
Просмотреть файл

@ -0,0 +1,24 @@
export class CancellationError extends Error {
constructor() {
super("Process Import/Export cancelled. See log file for details");
}
}
export class ValidationError extends Error {
constructor(message: string) {
super(`Process Import/Export does not meet the requiements for import. ${message}`);
}
}
export class ImportError extends Error {
constructor(message: string) {
super(`Import failed. See log file for details. ${message}`);
//TODO implement log file of all the artifacts that have been created in the target acccount.
}
}
export class ExportError extends Error {
constructor(message: string) {
super(`Export failed. ${message}`);
}
}

1068
src/ImportExportProcess.ts Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

97
src/Interfaces.ts Normal file
Просмотреть файл

@ -0,0 +1,97 @@
import * as WITProcessDefinitionsInterfaces from "vso-node-api/interfaces/WorkItemTrackingProcessDefinitionsInterfaces";
import * as WITProcessInterfaces from "vso-node-api/interfaces/WorkItemTrackingProcessInterfaces";
import * as WITInterfaces from "vso-node-api/interfaces/WorkItemTrackingInterfaces";
export enum LogLevel {
Error,
Warning,
Information,
Verbose
}
export interface IExportOptions {
processID: string;
writeToFile: boolean;
}
export interface IUserConfigurationOptions {
sourceProcessName: string;
targetProcessName?: string;
outputPath?: string;
logfileName?: string;
writeToFile?: boolean;
onlineReImport?: boolean;
overwritePicklist?: boolean;
logLevel?: LogLevel;
__cleanupTargetAccount?: boolean; // TODO: For dev purpose
__cleanupTargetEverything?: boolean; // TODO: For dev purpose
}
export interface IProcessPayload {
process: WITProcessInterfaces.ProcessModel;
workItemTypes: WITProcessDefinitionsInterfaces.WorkItemTypeModel[];
fields: WITProcessInterfaces.FieldModel[];
workItemTypeFields: IWITypeFields[];
witFieldPicklists: IWITFieldPicklist[];
layouts: IWITLayout[];
behaviors: WITProcessDefinitionsInterfaces.BehaviorModel[];
workItemTypeBehaviors: IWITBehaviors[];
states: IWITStates[];
rules: IWITRules[];
// Only populated during import
targetAccountInformation?: ITargetInformation
}
/**
* For information populated from target account during import
*/
export interface ITargetInformation {
collectionFields?: WITInterfaces.WorkItemField[];
fieldRefNameToPicklistId?: IDictionaryStringTo<string>;
}
export interface IWITypeFields {
workItemTypeRefName: string;
fields: WITProcessDefinitionsInterfaces.WorkItemTypeFieldModel[];
}
export interface IWITLayout {
workItemTypeRefName: string;
layout: WITProcessDefinitionsInterfaces.FormLayout;
}
export interface IWITStates {
workItemTypeRefName: string;
states: WITProcessDefinitionsInterfaces.WorkItemStateResultModel[];
}
export interface IWITRules {
workItemTypeRefName: string;
rules: WITProcessInterfaces.FieldRuleModel[];
}
export interface IWITBehaviors {
workItemType: IWITBehaviorsInfo;
behaviors: WITProcessDefinitionsInterfaces.WorkItemTypeBehavior[];
}
export interface IWITBehaviorsInfo {
refName: string;
workItemTypeClass: WITProcessDefinitionsInterfaces.WorkItemTypeClass;
}
export interface IValidationStatus {
status: boolean;
message: string;
}
export interface IWITFieldPicklist {
workitemtypeRefName: string;
fieldRefName: string;
picklist: WITProcessDefinitionsInterfaces.PickListModel;
}
export interface IDictionaryStringTo<T> {
[key: string]: T;
}

21
tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,21 @@
{
"compilerOptions": {
"noImplicitAny": true,
"outDir": "./build/",
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true,
"target": "ES5",
"lib": [
"es2015"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"typings/browser.d.ts",
"typings/browser"
]
}