@ioffice/tc-builder
Advanced tools
Comparing version 1.3.0-beta.1806221818 to 1.3.0-beta.1806230053
{ | ||
"name": "@ioffice/tc-builder", | ||
"version": "1.3.0-beta.1806221818", | ||
"version": "1.3.0-beta.1806230053", | ||
"description": "iOFFICE TeamCity Builder", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,3 +35,3 @@ import { Environment } from './Environment'; | ||
escapeTC(msg: string): string; | ||
loadMessages(): IBuilderMessages; | ||
loadMessages(): IBuilderMessages | null; | ||
/** | ||
@@ -38,0 +38,0 @@ * To be called before the process finishes so that all the error and warning messages may be |
@@ -103,4 +103,4 @@ "use strict"; | ||
var data = { | ||
errors: IO.errors, | ||
warnings: IO.warnings, | ||
errors: IO.errors.slice(), | ||
warnings: IO.warnings.slice(), | ||
}; | ||
@@ -107,0 +107,0 @@ var current = this.loadMessages(); |
@@ -1,2 +0,1 @@ | ||
import { IBuilderMessages } from '../services'; | ||
interface IField { | ||
@@ -45,3 +44,3 @@ title: string; | ||
readonly io: import("src/main/services/IO").IO; | ||
readonly messages: IBuilderMessages; | ||
readonly messages: import("src/main/services/IO").IBuilderMessages | null; | ||
abstract getTitle(): string; | ||
@@ -54,5 +53,5 @@ abstract getTitleLink(): string; | ||
getStatusMessage(status: 'good' | 'warning' | 'danger'): string; | ||
getFields(messages: IBuilderMessages): IField[]; | ||
getFields(): IField[]; | ||
getActions(): IAction[]; | ||
protected createAttachment(messages: IBuilderMessages): Partial<IAttachment>; | ||
protected createAttachment(): Partial<IAttachment>; | ||
private createMessage; | ||
@@ -59,0 +58,0 @@ private sendMessage; |
@@ -31,3 +31,3 @@ "use strict"; | ||
_a.trys.push([1, 3, , 4]); | ||
attachment = this.createAttachment(this.messages); | ||
attachment = this.createAttachment(); | ||
message = this.createMessage(attachment); | ||
@@ -47,2 +47,4 @@ return [4 /*yield*/, this.sendMessage(message)]; | ||
AbstractSlack.prototype.getStatus = function () { | ||
if (!this.messages) | ||
return 'good'; | ||
if (this.messages.errors.length > 0) | ||
@@ -71,25 +73,27 @@ return 'danger'; | ||
}; | ||
AbstractSlack.prototype.getFields = function (messages) { | ||
AbstractSlack.prototype.getFields = function () { | ||
var fields = []; | ||
var listMessages = function (item) { | ||
item.sort(function (a, b) { return a[1] - b[1]; }); | ||
return item.map(function (_a) { | ||
var msg = _a[0]; | ||
return "\u2022 " + msg; | ||
}).join('\n'); | ||
}; | ||
if (messages.errors.length > 0) { | ||
fields.push({ | ||
title: 'Problems', | ||
value: listMessages(messages.errors), | ||
short: false, | ||
}); | ||
if (this.messages) { | ||
var listMessages = function (item) { | ||
item.sort(function (a, b) { return a[1] - b[1]; }); | ||
return item.map(function (_a) { | ||
var msg = _a[0]; | ||
return "\u2022 " + msg; | ||
}).join('\n'); | ||
}; | ||
if (this.messages.errors.length > 0) { | ||
fields.push({ | ||
title: 'Problems', | ||
value: listMessages(this.messages.errors), | ||
short: false, | ||
}); | ||
} | ||
if (this.messages.warnings.length > 0) { | ||
fields.push({ | ||
title: 'Warnings', | ||
value: listMessages(this.messages.warnings), | ||
short: false, | ||
}); | ||
} | ||
} | ||
if (messages.warnings.length > 0) { | ||
fields.push({ | ||
title: 'Warnings', | ||
value: listMessages(messages.warnings), | ||
short: false, | ||
}); | ||
} | ||
return fields; | ||
@@ -109,3 +113,3 @@ }; | ||
}; | ||
AbstractSlack.prototype.createAttachment = function (messages) { | ||
AbstractSlack.prototype.createAttachment = function () { | ||
var status = this.getStatus(); | ||
@@ -121,3 +125,3 @@ var statusMessage = this.getStatusMessage(status); | ||
text: "The _" + buildType + "_ build for `" + buildBranch + "` branch " + statusMessage, | ||
fields: this.getFields(messages), | ||
fields: this.getFields(), | ||
actions: this.getActions(), | ||
@@ -124,0 +128,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108057
2566