@ioffice/tc-builder
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,2 +0,3 @@ | ||
import { Environment, IO, Git, Github } from '../services'; | ||
import { Environment, Git, Github, IO } from '../services'; | ||
import { IReleaseInfo } from '../types'; | ||
/** | ||
@@ -21,2 +22,7 @@ * ### AbstractBuilder | ||
/** | ||
* Gets called whenever we want to create a release. The implementation should define the | ||
* operations that need to be done to help the user create a release of the library. | ||
*/ | ||
abstract releaseSetup(param: IReleaseInfo): Promise<void>; | ||
/** | ||
* Gets called right before the `publish` method. This is the place where we | ||
@@ -77,2 +83,16 @@ * can rearrange the files in the appropriate directories. | ||
protected createPreRelease(): Promise<string>; | ||
/** | ||
* Setup the release process. It calls the `releaseSetup` method specified in the derived | ||
* builders. An `IReleaseInfo` object will be passed into the method so that we may be able | ||
* to modify files related to the release. For NPM builds for instance we care about modifying: | ||
* | ||
* - package.json changes the version | ||
* - README.md needs to be replaced all occurrences of the old version for the new one. | ||
* - CHANGELOG.md needs to set up the links | ||
* | ||
* After this is done we will be in the `release` branch. It is our responsibility to make | ||
* sure that the setup was done correctly and finish writing any remaining information to | ||
* continue with the release process. | ||
*/ | ||
protected runReleaseSetup(): Promise<string>; | ||
private runBuilder; | ||
@@ -79,0 +99,0 @@ protected handleMasterBranch(): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
/** | ||
* This module provides the `AbstractBuilder` class. It provides a flow to handle merges to | ||
* the master branch as well a pull requests. | ||
*/ /** */ | ||
var semver = require("semver"); | ||
var services_1 = require("../services"); | ||
var Util_1 = require("../Util"); | ||
var services_1 = require("../services"); | ||
/** | ||
@@ -35,3 +32,3 @@ * ### AbstractBuilder | ||
case 0: | ||
_a.trys.push([0, 5, , 6]); | ||
_a.trys.push([0, 7, , 8]); | ||
if (!this.env.isPreRelease) return [3 /*break*/, 2]; | ||
@@ -41,12 +38,18 @@ return [4 /*yield*/, this.runStep('preRelease', 'creating pre-release', this.createPreRelease)]; | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, this.runStep('TC-Builder', 'running tc-builder', this.runBuilder)]; | ||
return [3 /*break*/, 6]; | ||
case 2: | ||
if (!this.env.isReleaseSetup) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.runStep('releaseSetup', 'running release-setup', this.runReleaseSetup)]; | ||
case 3: | ||
_a.sent(); | ||
_a.label = 4; | ||
case 4: return [3 /*break*/, 6]; | ||
return [3 /*break*/, 6]; | ||
case 4: return [4 /*yield*/, this.runStep('TC-Builder', 'running tc-builder', this.runBuilder)]; | ||
case 5: | ||
_a.sent(); | ||
_a.label = 6; | ||
case 6: return [3 /*break*/, 8]; | ||
case 7: | ||
err_1 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_1)]; | ||
case 6: return [2 /*return*/, 0]; | ||
case 8: return [2 /*return*/, 0]; | ||
} | ||
@@ -136,5 +139,94 @@ }); | ||
}; | ||
/** | ||
* Setup the release process. It calls the `releaseSetup` method specified in the derived | ||
* builders. An `IReleaseInfo` object will be passed into the method so that we may be able | ||
* to modify files related to the release. For NPM builds for instance we care about modifying: | ||
* | ||
* - package.json changes the version | ||
* - README.md needs to be replaced all occurrences of the old version for the new one. | ||
* - CHANGELOG.md needs to set up the links | ||
* | ||
* After this is done we will be in the `release` branch. It is our responsibility to make | ||
* sure that the setup was done correctly and finish writing any remaining information to | ||
* continue with the release process. | ||
*/ | ||
AbstractBuilder.prototype.runReleaseSetup = function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var currentBranch, err_6, files, err_7, currentVersion, newVersion, err_8, failure, err_9; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.git.getBranch()]; | ||
case 1: | ||
currentBranch = _a.sent(); | ||
if (currentBranch !== 'master') { | ||
return [2 /*return*/, this.io.failure('releaseSetup may only run on the master branch')]; | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
err_6 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_6)]; | ||
case 3: | ||
_a.trys.push([3, 5, , 6]); | ||
return [4 /*yield*/, Util_1.util.getModifiedFiles()]; | ||
case 4: | ||
files = _a.sent(); | ||
if (files.length > 0) { | ||
return [2 /*return*/, this.io.failure("releaseSetup requires everything to be committed and pushed")]; | ||
} | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
err_7 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Unable to obtain modified files: " + err_7)]; | ||
case 6: | ||
currentVersion = this.env.packageVersion; | ||
newVersion = ''; | ||
if (!currentVersion) { | ||
return [2 /*return*/, this.io.failure("Unable to obtain the current package version")]; | ||
} | ||
if (!semver.parse(currentVersion)) { | ||
return [2 /*return*/, this.io.failure("Current version is not parsable: " + currentVersion)]; | ||
} | ||
_a.label = 7; | ||
case 7: | ||
_a.trys.push([7, 10, , 11]); | ||
return [4 /*yield*/, this.io.promptForNewVersion(currentVersion)]; | ||
case 8: | ||
newVersion = _a.sent(); | ||
return [4 /*yield*/, this.git.switchBranch('release', true)]; | ||
case 9: | ||
_a.sent(); | ||
return [3 /*break*/, 11]; | ||
case 10: | ||
err_8 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_8)]; | ||
case 11: | ||
failure = ''; | ||
_a.label = 12; | ||
case 12: | ||
_a.trys.push([12, 14, , 15]); | ||
return [4 /*yield*/, this.runStep('releaseSetup', 'running releaseSetup', this.releaseSetup, { | ||
currentVersion: currentVersion, | ||
newVersion: newVersion, | ||
})]; | ||
case 13: | ||
_a.sent(); | ||
return [3 /*break*/, 15]; | ||
case 14: | ||
err_9 = _a.sent(); | ||
failure = err_9; | ||
return [3 /*break*/, 15]; | ||
case 15: | ||
if (failure) { | ||
return [2 /*return*/, this.io.failure(failure)]; | ||
} | ||
return [2 /*return*/, this.io.success(newVersion, newVersion ? "setup for version " + newVersion + " complete" : '')]; | ||
} | ||
}); | ||
}); | ||
}; | ||
AbstractBuilder.prototype.runBuilder = function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var target, err_6; | ||
var target, err_10; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -168,4 +260,4 @@ switch (_a.label) { | ||
case 7: | ||
err_6 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_6)]; | ||
err_10 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_10)]; | ||
case 8: return [2 /*return*/]; | ||
@@ -178,3 +270,3 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var version, err_7, err_8, msg; | ||
var version, err_11, err_12, msg; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -198,4 +290,4 @@ switch (_a.label) { | ||
case 4: | ||
err_7 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_7)]; | ||
err_11 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_11)]; | ||
case 5: | ||
@@ -208,4 +300,4 @@ _a.trys.push([5, 7, , 8]); | ||
case 7: | ||
err_8 = _a.sent(); | ||
this.io.warn(err_8); | ||
err_12 = _a.sent(); | ||
this.io.warn(err_12); | ||
return [3 /*break*/, 8]; | ||
@@ -224,3 +316,3 @@ case 8: return [3 /*break*/, 10]; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var err_9, err_10; | ||
var err_13, err_14; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -247,4 +339,4 @@ switch (_a.label) { | ||
case 7: | ||
err_9 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_9)]; | ||
err_13 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_13)]; | ||
case 8: | ||
@@ -257,4 +349,4 @@ _a.trys.push([8, 10, , 11]); | ||
case 10: | ||
err_10 = _a.sent(); | ||
this.io.warn(err_10); | ||
err_14 = _a.sent(); | ||
this.io.warn(err_14); | ||
return [3 /*break*/, 11]; | ||
@@ -266,5 +358,5 @@ case 11: return [2 /*return*/, Promise.resolve()]; | ||
}; | ||
AbstractBuilder.prototype.runStep = function (name, desc, fn) { | ||
AbstractBuilder.prototype.runStep = function (name, desc, fn, arg) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var result, err_11; | ||
var result, err_15; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -278,3 +370,3 @@ switch (_a.label) { | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, fn.call(this)]; | ||
return [4 /*yield*/, fn.call(this, arg)]; | ||
case 2: | ||
@@ -285,5 +377,5 @@ result = _a.sent(); | ||
case 3: | ||
err_11 = _a.sent(); | ||
err_15 = _a.sent(); | ||
this.io.closeBlock(this.step); | ||
return [2 /*return*/, Promise.reject(err_11)]; | ||
throw err_15; | ||
case 4: return [2 /*return*/]; | ||
@@ -290,0 +382,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { IReleaseInfo } from '../types'; | ||
import { AbstractBuilder } from './AbstractBuilder'; | ||
@@ -19,3 +20,34 @@ declare class NPMBuilder extends AbstractBuilder { | ||
private verifyChangeLog; | ||
/** | ||
* The release setup requires 3 things to happen: | ||
* | ||
* - update package.json | ||
* - update README.md | ||
* - update CHANGELOG.md | ||
*/ | ||
releaseSetup({ currentVersion, newVersion }: IReleaseInfo): Promise<void>; | ||
/** | ||
* Obtain a link to the comparison between two tags/hashes. | ||
*/ | ||
private githubCompareLink; | ||
/** | ||
* The CHANGELOG setup is a bit more complicated. We need to make sure that every version has | ||
* an entry and that each entry is a link to the comparison of the repo. | ||
* | ||
* @param content The content of the CHANGELOG.md file. | ||
* @param newVersion The new version we are releasing. | ||
* @param firstCommit The very first commit hash of the repo. | ||
*/ | ||
private updateChangeLog; | ||
/** | ||
* Currently the README files in iOffice project contain links to the documentation and these | ||
* links point to specific versions. For this reason we must update the links so that any instance | ||
* that points to the current version will now point to the new one. | ||
* | ||
* @param content The content of the README file. | ||
* @param currentVersion The current version of the package. | ||
* @param newVersion The new version we are releasing. | ||
*/ | ||
private updateREADME; | ||
} | ||
export { NPMBuilder, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var fs = require("fs"); | ||
var Mocha = require("mocha"); | ||
var fs = require("fs"); | ||
var moment = require("moment"); | ||
var semver = require("semver"); | ||
var services_1 = require("../services"); | ||
var Util_1 = require("../Util"); | ||
var services_1 = require("../services"); | ||
var AbstractBuilder_1 = require("./AbstractBuilder"); | ||
@@ -191,4 +191,104 @@ var NPMBuilder = /** @class */ (function (_super) { | ||
}; | ||
/** | ||
* The release setup requires 3 things to happen: | ||
* | ||
* - update package.json | ||
* - update README.md | ||
* - update CHANGELOG.md | ||
*/ | ||
NPMBuilder.prototype.releaseSetup = function (_a) { | ||
var currentVersion = _a.currentVersion, newVersion = _a.newVersion; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var changelogFile, firstCommit, changeLogData, newData, err_5, readmeFile, readmeData, newData, unreleased; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
// package.json | ||
Util_1.util.changePackageVersion(newVersion); | ||
changelogFile = './CHANGELOG.md'; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.git.getFirstCommit()]; | ||
case 2: | ||
firstCommit = _b.sent(); | ||
changeLogData = fs.readFileSync(changelogFile); | ||
newData = this.updateChangeLog(changeLogData.toString(), newVersion, firstCommit); | ||
fs.writeFileSync(changelogFile, newData); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_5 = _b.sent(); | ||
this.io.warn("Unable to update '" + changelogFile + "': " + err_5.toString()); | ||
return [2 /*return*/]; | ||
case 4: | ||
readmeFile = './README.md'; | ||
try { | ||
readmeData = fs.readFileSync(readmeFile); | ||
newData = this.updateREADME(readmeData.toString(), currentVersion, newVersion); | ||
fs.writeFileSync(readmeFile, newData); | ||
} | ||
catch (err) { | ||
this.io.warn("Unable to update '" + readmeFile + "': " + err.toString()); | ||
return [2 /*return*/]; | ||
} | ||
unreleased = this.githubCompareLink(currentVersion, 'HEAD'); | ||
this.io.log("See " + unreleased + " to create the CHANGELOG summary."); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Obtain a link to the comparison between two tags/hashes. | ||
*/ | ||
NPMBuilder.prototype.githubCompareLink = function (prev, next) { | ||
var owner = this.env.owner; | ||
var repo = this.env.repo; | ||
return "https://github.com/" + owner + "/" + repo + "/compare/" + prev + "..." + next; | ||
}; | ||
/** | ||
* The CHANGELOG setup is a bit more complicated. We need to make sure that every version has | ||
* an entry and that each entry is a link to the comparison of the repo. | ||
* | ||
* @param content The content of the CHANGELOG.md file. | ||
* @param newVersion The new version we are releasing. | ||
* @param firstCommit The very first commit hash of the repo. | ||
*/ | ||
NPMBuilder.prototype.updateChangeLog = function (content, newVersion, firstCommit) { | ||
var _a = content.split('## [Unreleased]'), header = _a[0], main = _a[1]; | ||
var entries = main.split('[Unreleased]:')[0]; | ||
var lines = entries.split('\n'); | ||
var versions = lines | ||
.filter(function (x) { return x.startsWith('## ['); }) | ||
.map(function (line) { return (line.match(/## \[(.*)]/) || [])[1]; }) | ||
.filter(function (x) { return x; }); | ||
versions.unshift(newVersion); | ||
versions.push(firstCommit); | ||
var links = ["[Unreleased]: " + this.githubCompareLink(newVersion, 'HEAD')]; | ||
for (var i = 0; i < versions.length - 1; i++) { | ||
links.push("[" + versions[i] + "]: " + this.githubCompareLink(versions[i + 1], versions[i])); | ||
} | ||
return [ | ||
header, | ||
'## [Unreleased]\n\n', | ||
"## [" + newVersion + "] - " + moment().format('LL') + "\n\n", | ||
entries, | ||
links.join('\n'), | ||
'\n', | ||
].join(''); | ||
}; | ||
/** | ||
* Currently the README files in iOffice project contain links to the documentation and these | ||
* links point to specific versions. For this reason we must update the links so that any instance | ||
* that points to the current version will now point to the new one. | ||
* | ||
* @param content The content of the README file. | ||
* @param currentVersion The current version of the package. | ||
* @param newVersion The new version we are releasing. | ||
*/ | ||
NPMBuilder.prototype.updateREADME = function (content, currentVersion, newVersion) { | ||
return content.split(currentVersion).join(newVersion); | ||
}; | ||
return NPMBuilder; | ||
}(AbstractBuilder_1.AbstractBuilder)); | ||
exports.NPMBuilder = NPMBuilder; |
@@ -1,3 +0,3 @@ | ||
import { TypedObject, ExitCode, IProjectResults, IProjectStatus, IFileMessages } from './Interfaces'; | ||
import * as ts from 'typescript'; | ||
import { ExitCode, IFileMessages, IProjectResults, IProjectStatus, TypedObject } from './Interfaces'; | ||
declare function compile(program: ts.Program, tsOptions: ts.CompilerOptions, tsLintConfigPath?: string, verbose?: boolean): TypedObject<IFileMessages>; | ||
@@ -4,0 +4,0 @@ declare function compileProject(tsConfigPath: string, tsLintConfigPath?: string, verbose?: boolean): IProjectResults; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Interfaces_1 = require("./Interfaces"); | ||
var fs = require("fs"); | ||
var ts = require("typescript"); | ||
var Lint = require("tslint"); | ||
var pth = require("path"); | ||
var ProgressBar = require("progress"); | ||
var Lint = require("tslint"); | ||
var ts = require("typescript"); | ||
var services_1 = require("../services"); | ||
var Formatter_1 = require("./Formatter"); | ||
var Interfaces_1 = require("./Interfaces"); | ||
function cout(msg, verbose) { | ||
@@ -12,0 +12,0 @@ if (verbose) { |
@@ -1,2 +0,2 @@ | ||
import { TypedObject, IFileMessages, IProjectStatus, IProjectResults } from './Interfaces'; | ||
import { IFileMessages, IProjectResults, IProjectStatus, TypedObject } from './Interfaces'; | ||
declare function formatResults(results: TypedObject<IFileMessages>): string; | ||
@@ -3,0 +3,0 @@ declare function formatProjectResults(projectStatus: IProjectStatus, projectResults: IProjectResults, ci?: boolean, ciLimit?: number): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var colors = require("colors"); | ||
var Interfaces_1 = require("./Interfaces"); | ||
var colors = require("colors"); | ||
function align(msg, alignment, size) { | ||
@@ -6,0 +6,0 @@ var repeatNumber = Math.max(size - msg.length, 0); |
@@ -1,4 +0,3 @@ | ||
import { MessageCategory, TypedObject, ExitCode, ITSMessage, IFileInfo, IFileMessages, IMessageInfo, IMessageReference, IProjectResults, IProjectStatus } from './Interfaces'; | ||
import { compile, compileProject, compileCLI, getProjectStatus } from './Compiler'; | ||
import { formatResults, formatProjectResults, formatFailureMessage } from './Formatter'; | ||
export { MessageCategory, TypedObject, ExitCode, ITSMessage, IFileInfo, IFileMessages, IMessageInfo, IMessageReference, IProjectResults, IProjectStatus, compile, compileProject, compileCLI, getProjectStatus, formatResults, formatProjectResults, formatFailureMessage, }; | ||
export * from './Compiler'; | ||
export * from './Formatter'; | ||
export * from './Interfaces'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Interfaces_1 = require("./Interfaces"); | ||
exports.ExitCode = Interfaces_1.ExitCode; | ||
var Compiler_1 = require("./Compiler"); | ||
exports.compile = Compiler_1.compile; | ||
exports.compileProject = Compiler_1.compileProject; | ||
exports.compileCLI = Compiler_1.compileCLI; | ||
exports.getProjectStatus = Compiler_1.getProjectStatus; | ||
var Formatter_1 = require("./Formatter"); | ||
exports.formatResults = Formatter_1.formatResults; | ||
exports.formatProjectResults = Formatter_1.formatProjectResults; | ||
exports.formatFailureMessage = Formatter_1.formatFailureMessage; | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./Compiler"), exports); | ||
tslib_1.__exportStar(require("./Formatter"), exports); | ||
tslib_1.__exportStar(require("./Interfaces"), exports); |
@@ -1,6 +0,6 @@ | ||
import { MessageCategory, TypedObject, ExitCode, ITSMessage, IFileInfo, IFileMessages, IMessageInfo, IMessageReference, IProjectResults, IProjectStatus, compile, compileProject, compileCLI, getProjectStatus, formatResults, formatProjectResults, formatFailureMessage } from './compiler'; | ||
import { AbstractBuilder, IBuilder, NPMBuilder, runBuilder } from './builders'; | ||
import { IField, IAction, IAttachment, AbstractSlack, ISlacker, TravisSlack, runSlacker } from './slack'; | ||
import { CI, Environment, IBuilderMessages, IO, Git, Github, Provider } from './services'; | ||
import { util, Util } from './Util'; | ||
import { ExitCode, IFileInfo, IFileMessages, IMessageInfo, IMessageReference, IProjectResults, IProjectStatus, ITSMessage, MessageCategory, TypedObject, compile, compileCLI, compileProject, formatFailureMessage, formatProjectResults, formatResults, getProjectStatus } from './compiler'; | ||
import { CI, Environment, Git, Github, IBuilderMessages, IO, Provider } from './services'; | ||
import { AbstractSlack, IAction, IAttachment, IField, ISlacker, TravisSlack, runSlacker } from './slack'; | ||
import { Util, util } from './Util'; | ||
export { MessageCategory, TypedObject, ExitCode, ITSMessage, IFileInfo, IFileMessages, IMessageInfo, IMessageReference, IProjectResults, IProjectStatus, compile, compileProject, compileCLI, getProjectStatus, formatResults, formatProjectResults, formatFailureMessage, AbstractBuilder, IBuilder, NPMBuilder, runBuilder, IField, IAction, IAttachment, AbstractSlack, ISlacker, TravisSlack, runSlacker, CI, Environment, IBuilderMessages, IO, Git, Github, Provider, util, Util, }; |
28
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var builders_1 = require("./builders"); | ||
exports.AbstractBuilder = builders_1.AbstractBuilder; | ||
exports.NPMBuilder = builders_1.NPMBuilder; | ||
exports.runBuilder = builders_1.runBuilder; | ||
var compiler_1 = require("./compiler"); | ||
exports.ExitCode = compiler_1.ExitCode; | ||
exports.compile = compiler_1.compile; | ||
exports.compileCLI = compiler_1.compileCLI; | ||
exports.compileProject = compiler_1.compileProject; | ||
exports.compileCLI = compiler_1.compileCLI; | ||
exports.formatFailureMessage = compiler_1.formatFailureMessage; | ||
exports.formatProjectResults = compiler_1.formatProjectResults; | ||
exports.formatResults = compiler_1.formatResults; | ||
exports.getProjectStatus = compiler_1.getProjectStatus; | ||
exports.formatResults = compiler_1.formatResults; | ||
exports.formatProjectResults = compiler_1.formatProjectResults; | ||
exports.formatFailureMessage = compiler_1.formatFailureMessage; | ||
var builders_1 = require("./builders"); | ||
exports.AbstractBuilder = builders_1.AbstractBuilder; | ||
exports.NPMBuilder = builders_1.NPMBuilder; | ||
exports.runBuilder = builders_1.runBuilder; | ||
var slack_1 = require("./slack"); | ||
exports.AbstractSlack = slack_1.AbstractSlack; | ||
exports.TravisSlack = slack_1.TravisSlack; | ||
exports.runSlacker = slack_1.runSlacker; | ||
var services_1 = require("./services"); | ||
exports.CI = services_1.CI; | ||
exports.Environment = services_1.Environment; | ||
exports.IO = services_1.IO; | ||
exports.Git = services_1.Git; | ||
exports.Github = services_1.Github; | ||
exports.IO = services_1.IO; | ||
exports.Provider = services_1.Provider; | ||
var slack_1 = require("./slack"); | ||
exports.AbstractSlack = slack_1.AbstractSlack; | ||
exports.TravisSlack = slack_1.TravisSlack; | ||
exports.runSlacker = slack_1.runSlacker; | ||
var Util_1 = require("./Util"); | ||
exports.Util = Util_1.Util; | ||
exports.util = Util_1.util; | ||
exports.Util = Util_1.Util; |
{ | ||
"name": "@ioffice/tc-builder", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "iOFFICE TeamCity Builder", | ||
@@ -21,4 +21,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@ioffice/tslint-config-ioffice": "0.4.1", | ||
"@ioffice/tslint-config-ioffice": "0.6.1", | ||
"@types/chai": "4.1.4", | ||
"@types/inquirer": "0.0.43", | ||
"@types/mocha": "5.2.3", | ||
@@ -31,2 +32,3 @@ "@types/progress": "2.0.1", | ||
"colors": "1.3.0", | ||
"inquirer": "6.2.2", | ||
"mocha": "5.2.0", | ||
@@ -40,6 +42,6 @@ "moment": "2.22.2", | ||
"sinon": "6.0.1", | ||
"tslint": "5.10.0", | ||
"tslint": "5.12.1", | ||
"tslint-eslint-rules": "5.3.1", | ||
"typedoc": "0.11.1", | ||
"typescript": "2.9.2" | ||
"typescript": "3.3.3333" | ||
}, | ||
@@ -46,0 +48,0 @@ "publishConfig": { |
@@ -22,2 +22,3 @@ declare enum CI { | ||
readonly slackChannels: string[]; | ||
readonly isReleaseSetup: boolean; | ||
readonly isPreRelease: boolean; | ||
@@ -24,0 +25,0 @@ readonly isRelease: boolean; |
@@ -30,2 +30,3 @@ "use strict"; | ||
this.slackChannels = this.getSlackChannels(); | ||
this.isReleaseSetup = !!pEnv['RELEASE_SETUP']; | ||
this.isPreRelease = !!pEnv['PRERELEASE']; | ||
@@ -32,0 +33,0 @@ this.isRelease = !!this.commitMessage.match(this.releaseRegEx); |
@@ -10,2 +10,6 @@ import { IO } from './IO'; | ||
/** | ||
* Obtain the very first commit for the repo. | ||
*/ | ||
getFirstCommit(): Promise<string>; | ||
/** | ||
* Switch the git branch. | ||
@@ -12,0 +16,0 @@ */ |
@@ -32,2 +32,24 @@ "use strict"; | ||
/** | ||
* Obtain the very first commit for the repo. | ||
*/ | ||
Git.prototype.getFirstCommit = function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var commit, err_2; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, Util_1.util.exec('git rev-list --max-parents=0 HEAD')]; | ||
case 1: | ||
commit = _a.sent(); | ||
return [2 /*return*/, this.io.success(commit, "First commit: " + commit)]; | ||
case 2: | ||
err_2 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.getFirstCommit failure: " + err_2)]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Switch the git branch. | ||
@@ -38,3 +60,3 @@ */ | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var newFlag, output, err_2; | ||
var newFlag, output, err_3; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -52,4 +74,4 @@ switch (_a.label) { | ||
case 3: | ||
err_2 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.switchBranch(" + branch + ", " + isNew + ") failure: " + err_2)]; | ||
err_3 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.switchBranch(" + branch + ", " + isNew + ") failure: " + err_3)]; | ||
case 4: return [2 /*return*/]; | ||
@@ -65,3 +87,3 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var output, err_3; | ||
var output, err_4; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -76,4 +98,4 @@ switch (_a.label) { | ||
case 2: | ||
err_3 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.discardBranchChanges failure: " + err_3)]; | ||
err_4 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.discardBranchChanges failure: " + err_4)]; | ||
case 3: return [2 /*return*/]; | ||
@@ -89,3 +111,3 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var output, err_4; | ||
var output, err_5; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -100,4 +122,4 @@ switch (_a.label) { | ||
case 2: | ||
err_4 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.deleteBranch('" + branch + "') failure: " + err_4)]; | ||
err_5 = _a.sent(); | ||
return [2 /*return*/, this.io.failure("Git.deleteBranch('" + branch + "') failure: " + err_5)]; | ||
case 3: return [2 /*return*/]; | ||
@@ -115,3 +137,3 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var err_5; | ||
var err_6; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -132,4 +154,4 @@ switch (_a.label) { | ||
case 4: | ||
err_5 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_5)]; | ||
err_6 = _a.sent(); | ||
return [2 /*return*/, this.io.failure(err_6)]; | ||
case 5: return [2 /*return*/]; | ||
@@ -136,0 +158,0 @@ } |
@@ -0,4 +1,4 @@ | ||
import { RequestPromise } from 'request-promise'; | ||
import { Environment } from './Environment'; | ||
import { IO } from './IO'; | ||
import { RequestPromise } from 'request-promise'; | ||
declare class Github { | ||
@@ -5,0 +5,0 @@ env: Environment; |
import { CI, Environment } from './Environment'; | ||
import { IBuilderMessages, IO } from './IO'; | ||
import { Git } from './Git'; | ||
import { Github } from './Github'; | ||
import { IBuilderMessages, IO } from './IO'; | ||
declare class Provider { | ||
@@ -6,0 +6,0 @@ private static instance; |
@@ -6,4 +6,2 @@ "use strict"; | ||
exports.Environment = Environment_1.Environment; | ||
var IO_1 = require("./IO"); | ||
exports.IO = IO_1.IO; | ||
var Git_1 = require("./Git"); | ||
@@ -13,2 +11,4 @@ exports.Git = Git_1.Git; | ||
exports.Github = Github_1.Github; | ||
var IO_1 = require("./IO"); | ||
exports.IO = IO_1.IO; | ||
var Provider = /** @class */ (function () { | ||
@@ -15,0 +15,0 @@ function Provider() { |
@@ -41,3 +41,10 @@ import { Environment } from './Environment'; | ||
dumpMessages(): void; | ||
/** | ||
* Prompts the user for the next version provided by the `currentVersion`. The current version is | ||
* assumed to be parsable by `semver`. | ||
* | ||
* @param currentVersion The current version of the package. | ||
*/ | ||
promptForNewVersion(currentVersion: string): Promise<string>; | ||
} | ||
export { IBuilderMessages, IO, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var colors = require("colors"); | ||
var inquirer = require("inquirer"); | ||
var semver = require("semver"); | ||
var Util_1 = require("../Util"); | ||
var Environment_1 = require("./Environment"); | ||
var Util_1 = require("../Util"); | ||
var colors = require("colors"); | ||
var IO = /** @class */ (function () { | ||
@@ -122,2 +124,23 @@ function IO(env) { | ||
}; | ||
/** | ||
* Prompts the user for the next version provided by the `currentVersion`. The current version is | ||
* assumed to be parsable by `semver`. | ||
* | ||
* @param currentVersion The current version of the package. | ||
*/ | ||
IO.prototype.promptForNewVersion = function (currentVersion) { | ||
var newPatch = semver.parse(currentVersion).inc('patch').version; | ||
var newMinor = semver.parse(currentVersion).inc('minor').version; | ||
var newMajor = semver.parse(currentVersion).inc('major').version; | ||
return new Promise(function (resolve, reject) { | ||
inquirer.prompt([ | ||
{ | ||
type: 'list', | ||
name: 'version', | ||
message: "Current version is " + currentVersion + ". Choose the next version:", | ||
choices: [newPatch, newMinor, newMajor], | ||
}, | ||
]).then(function (answers) { return resolve(answers['version']); }, reject); | ||
}); | ||
}; | ||
IO.warnings = []; | ||
@@ -124,0 +147,0 @@ IO.errors = []; |
@@ -5,4 +5,4 @@ "use strict"; | ||
var path = require("path"); | ||
var services_1 = require("../services"); | ||
var Util_1 = require("../Util"); | ||
var services_1 = require("../services"); | ||
var rel = function (x) { return path.resolve(__dirname, x); }; | ||
@@ -9,0 +9,0 @@ var log = function (msg) { return process.stdout.write(msg + "\n"); }; |
@@ -40,5 +40,5 @@ interface IField { | ||
declare abstract class AbstractSlack { | ||
readonly env: import("src/main/services/Environment").Environment; | ||
readonly io: import("src/main/services/IO").IO; | ||
readonly messages: import("src/main/services/IO").IBuilderMessages | null; | ||
readonly env: import("../services/Environment").Environment; | ||
readonly io: import("../services/IO").IO; | ||
readonly messages: import("../services/IO").IBuilderMessages | null; | ||
abstract getTitle(): string; | ||
@@ -45,0 +45,0 @@ abstract getTitleLink(): string; |
@@ -1,2 +0,2 @@ | ||
import { IField, IAction, IAttachment, AbstractSlack, ISlacker } from './AbstractSlack'; | ||
import { AbstractSlack, IAction, IAttachment, IField, ISlacker } from './AbstractSlack'; | ||
import { TravisSlack } from './TravisSlack'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -5,7 +5,7 @@ #!/usr/bin/env node | ||
var tslib_1 = require("tslib"); | ||
var Util_1 = require("./Util"); | ||
var builders_1 = require("./builders"); | ||
var compiler_1 = require("./compiler"); | ||
var Setup_1 = require("./setup/Setup"); | ||
var compiler_1 = require("./compiler"); | ||
var builders_1 = require("./builders"); | ||
var slack_1 = require("./slack"); | ||
var Util_1 = require("./Util"); | ||
var commands = [ | ||
@@ -12,0 +12,0 @@ 'setup', |
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Install_1 = require("./setup/Install"); | ||
var Util_1 = require("./Util"); | ||
var Install_1 = require("./setup/Install"); | ||
var tcBuilderPkg = Util_1.util.readJSON('./package.json', __dirname) || {}; | ||
@@ -7,0 +7,0 @@ var usage = "usage: tc-install [--options]\n\nOptions:\n\n --help, -h: Print this message.\n --update: Update the set of dependencies to the latest version.\n --prod: Install/Update only the non devDependencies.\n --exact: Do not add the caret character to the start of the version.\n --match: A regex string must follow this option so that we only install/update certain files.\n\ntc-install@" + tcBuilderPkg['version'] + "\n"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var child_process_1 = require("child_process"); | ||
var fs_1 = require("fs"); | ||
var pth = require("path"); | ||
var child_process_1 = require("child_process"); | ||
var Util = /** @class */ (function () { | ||
@@ -7,0 +7,0 @@ function Util() { |
135343
64
3120
23