From c9dfd2b5b9ed9440353df7f273cb357acc4f0285 Mon Sep 17 00:00:00 2001
From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com>
Date: Wed, 22 Feb 2017 13:17:11 +0300
Subject: [PATCH] Initial working version
---
BuildServer/.gitignore | 1 +
BuildServer/{app.js => app.ts} | 28 +++++++++----------
...old-reports.js => compress-old-reports.ts} | 0
BuildServer/lib/{builder.js => builder.ts} | 26 ++++++++---------
.../lib/{commenter.js => commenter.ts} | 10 +++----
BuildServer/lib/git/{copy.js => copy.ts} | 14 +++++-----
BuildServer/lib/git/{loader.js => loader.ts} | 8 +++---
BuildServer/lib/mail-sender.js | 3 --
BuildServer/lib/mail-sender.ts | 3 ++
...eport-processor.js => report-processor.ts} | 24 +++++++---------
...tatus-processor.js => status-processor.ts} | 10 +++----
.../{task-processor.js => task-processor.ts} | 10 ++-----
...netbuild.js => cleanupafterdotnetbuild.ts} | 4 +--
.../tasks/{conditional.js => conditional.ts} | 2 +-
BuildServer/lib/tasks/{copy.js => copy.ts} | 6 ++--
.../lib/tasks/{copyglob.js => copyglob.ts} | 4 +--
.../lib/tasks/{cssnano.js => cssnano.ts} | 8 +++---
.../tasks/{cssnanoall.js => cssnanoall.ts} | 4 +--
.../{deletefromcode.js => deletefromcode.ts} | 6 ++--
.../tasks/{dotnetbuild.js => dotnetbuild.ts} | 4 +--
...tbuildandtest.js => dotnetbuildandtest.ts} | 4 +--
...lderwrapper.js => dotnetbuilderwrapper.ts} | 10 +++----
...leanup.js => dotnetbuildwithoutcleanup.ts} | 4 +--
...otnetcheckstyle.js => dotnetcheckstyle.ts} | 10 +++----
.../{dotnetcompile.js => dotnetcompile.ts} | 10 +++----
BuildServer/lib/tasks/dotnetnugetpack.js | 11 --------
BuildServer/lib/tasks/dotnetnugetpack.ts | 11 ++++++++
...tnugetprocess.js => dotnetnugetprocess.ts} | 4 +--
...ernal.js => dotnetnugetprocessinternal.ts} | 6 ++--
BuildServer/lib/tasks/dotnetnugetpush.js | 11 --------
BuildServer/lib/tasks/dotnetnugetpush.ts | 11 ++++++++
...ugetpushonly.js => dotnetnugetpushonly.ts} | 8 +++---
...tnugetrestore.js => dotnetnugetrestore.ts} | 6 ++--
BuildServer/lib/tasks/dotnetnunit.js | 9 ------
BuildServer/lib/tasks/dotnetnunit.ts | 9 ++++++
.../{dotnetnunitall.js => dotnetnunitall.ts} | 4 +--
...otnetpackwebapp.js => dotnetpackwebapp.ts} | 11 ++++----
.../{dotnetrewrite.js => dotnetrewrite.ts} | 12 ++++----
BuildServer/lib/tasks/{echo.js => echo.ts} | 2 +-
.../{eslintbrowser.js => eslintbrowser.ts} | 8 +++---
...slintbrowserall.js => eslintbrowserall.ts} | 4 +--
BuildServer/lib/tasks/{index.js => index.ts} | 10 +++++--
BuildServer/lib/tasks/noop.js | 3 --
BuildServer/lib/tasks/noop.ts | 3 ++
.../lib/tasks/{packform.js => packform.ts} | 4 +--
BuildServer/lib/tasks/parallel.js | 7 -----
BuildServer/lib/tasks/parallel.ts | 7 +++++
BuildServer/lib/tasks/sequential.js | 7 -----
BuildServer/lib/tasks/sequential.ts | 7 +++++
.../lib/tasks/{uglifyjs.js => uglifyjs.ts} | 8 +++---
.../tasks/{uglifyjsall.js => uglifyjsall.ts} | 4 +--
.../lib/tasks/{writefile.js => writefile.ts} | 6 ++--
BuildServer/lib/tasks/{zip.js => zip.ts} | 8 +++---
BuildServer/package.json | 9 +++---
.../routes/{artifact.js => artifact.ts} | 2 +-
BuildServer/routes/index.js | 9 ------
BuildServer/routes/index.ts | 12 ++++++++
BuildServer/routes/{manual.js => manual.ts} | 10 +++----
.../routes/{postreceive.js => postreceive.ts} | 6 ++--
BuildServer/routes/{release.js => release.ts} | 8 +++---
BuildServer/routes/{status.js => status.ts} | 14 +++++-----
...ettings.js.example => settings.ts.example} | 5 +++-
BuildServer/tsconfig.json | 8 ++++++
63 files changed, 253 insertions(+), 244 deletions(-)
rename BuildServer/{app.js => app.ts} (70%)
rename BuildServer/{compress-old-reports.js => compress-old-reports.ts} (100%)
rename BuildServer/lib/{builder.js => builder.ts} (93%)
rename BuildServer/lib/{commenter.js => commenter.ts} (96%)
rename BuildServer/lib/git/{copy.js => copy.ts} (87%)
rename BuildServer/lib/git/{loader.js => loader.ts} (92%)
delete mode 100644 BuildServer/lib/mail-sender.js
create mode 100644 BuildServer/lib/mail-sender.ts
rename BuildServer/lib/{report-processor.js => report-processor.ts} (90%)
rename BuildServer/lib/{status-processor.js => status-processor.ts} (89%)
rename BuildServer/lib/{task-processor.js => task-processor.ts} (94%)
rename BuildServer/lib/tasks/{cleanupafterdotnetbuild.js => cleanupafterdotnetbuild.ts} (90%)
rename BuildServer/lib/tasks/{conditional.js => conditional.ts} (90%)
rename BuildServer/lib/tasks/{copy.js => copy.ts} (84%)
rename BuildServer/lib/tasks/{copyglob.js => copyglob.ts} (90%)
rename BuildServer/lib/tasks/{cssnano.js => cssnano.ts} (89%)
rename BuildServer/lib/tasks/{cssnanoall.js => cssnanoall.ts} (93%)
rename BuildServer/lib/tasks/{deletefromcode.js => deletefromcode.ts} (81%)
rename BuildServer/lib/tasks/{dotnetbuild.js => dotnetbuild.ts} (73%)
rename BuildServer/lib/tasks/{dotnetbuildandtest.js => dotnetbuildandtest.ts} (79%)
rename BuildServer/lib/tasks/{dotnetbuilderwrapper.js => dotnetbuilderwrapper.ts} (91%)
rename BuildServer/lib/tasks/{dotnetbuildwithoutcleanup.js => dotnetbuildwithoutcleanup.ts} (91%)
rename BuildServer/lib/tasks/{dotnetcheckstyle.js => dotnetcheckstyle.ts} (93%)
rename BuildServer/lib/tasks/{dotnetcompile.js => dotnetcompile.ts} (82%)
delete mode 100644 BuildServer/lib/tasks/dotnetnugetpack.js
create mode 100644 BuildServer/lib/tasks/dotnetnugetpack.ts
rename BuildServer/lib/tasks/{dotnetnugetprocess.js => dotnetnugetprocess.ts} (88%)
rename BuildServer/lib/tasks/{dotnetnugetprocessinternal.js => dotnetnugetprocessinternal.ts} (91%)
delete mode 100644 BuildServer/lib/tasks/dotnetnugetpush.js
create mode 100644 BuildServer/lib/tasks/dotnetnugetpush.ts
rename BuildServer/lib/tasks/{dotnetnugetpushonly.js => dotnetnugetpushonly.ts} (50%)
rename BuildServer/lib/tasks/{dotnetnugetrestore.js => dotnetnugetrestore.ts} (73%)
delete mode 100644 BuildServer/lib/tasks/dotnetnunit.js
create mode 100644 BuildServer/lib/tasks/dotnetnunit.ts
rename BuildServer/lib/tasks/{dotnetnunitall.js => dotnetnunitall.ts} (94%)
rename BuildServer/lib/tasks/{dotnetpackwebapp.js => dotnetpackwebapp.ts} (89%)
rename BuildServer/lib/tasks/{dotnetrewrite.js => dotnetrewrite.ts} (91%)
rename BuildServer/lib/tasks/{echo.js => echo.ts} (88%)
rename BuildServer/lib/tasks/{eslintbrowser.js => eslintbrowser.ts} (83%)
rename BuildServer/lib/tasks/{eslintbrowserall.js => eslintbrowserall.ts} (93%)
rename BuildServer/lib/tasks/{index.js => index.ts} (54%)
delete mode 100644 BuildServer/lib/tasks/noop.js
create mode 100644 BuildServer/lib/tasks/noop.ts
rename BuildServer/lib/tasks/{packform.js => packform.ts} (86%)
delete mode 100644 BuildServer/lib/tasks/parallel.js
create mode 100644 BuildServer/lib/tasks/parallel.ts
delete mode 100644 BuildServer/lib/tasks/sequential.js
create mode 100644 BuildServer/lib/tasks/sequential.ts
rename BuildServer/lib/tasks/{uglifyjs.js => uglifyjs.ts} (80%)
rename BuildServer/lib/tasks/{uglifyjsall.js => uglifyjsall.ts} (93%)
rename BuildServer/lib/tasks/{writefile.js => writefile.ts} (82%)
rename BuildServer/lib/tasks/{zip.js => zip.ts} (84%)
rename BuildServer/routes/{artifact.js => artifact.ts} (93%)
delete mode 100644 BuildServer/routes/index.js
create mode 100644 BuildServer/routes/index.ts
rename BuildServer/routes/{manual.js => manual.ts} (70%)
rename BuildServer/routes/{postreceive.js => postreceive.ts} (96%)
rename BuildServer/routes/{release.js => release.ts} (89%)
rename BuildServer/routes/{status.js => status.ts} (88%)
rename BuildServer/{settings.js.example => settings.ts.example} (92%)
create mode 100644 BuildServer/tsconfig.json
diff --git a/BuildServer/.gitignore b/BuildServer/.gitignore
index 51f33d8..285b65b 100644
--- a/BuildServer/.gitignore
+++ b/BuildServer/.gitignore
@@ -17,5 +17,6 @@ node_modules
data
*.crt
settings.js
+settings.ts
iisnode
diff --git a/BuildServer/app.js b/BuildServer/app.ts
similarity index 70%
rename from BuildServer/app.js
rename to BuildServer/app.ts
index cc65956..b6eb90d 100644
--- a/BuildServer/app.js
+++ b/BuildServer/app.ts
@@ -1,26 +1,26 @@
"use strict";
-const realFs = require("fs");
-const fs = require("graceful-fs");
+import realFs = require("fs");
+import fs = require("graceful-fs");
fs.gracefulify(realFs);
-const express = require("express");
-const routes = require("./routes");
-const http = require("http");
-const path = require("path");
-const serveFavicon = require("serve-favicon");
-const morgan = require("morgan");
-const bodyParser = require("body-parser");
-const methodOverride = require("method-override");
-const serveStatic = require("serve-static");
-const errorhandler = require("errorhandler");
+import express = require("express");
+import routes = require("./routes");
+import http = require("http");
+import path = require("path");
+import serveFavicon = require("serve-favicon");
+import morgan = require("morgan");
+import bodyParser = require("body-parser");
+import methodOverride = require("method-override");
+import serveStatic = require("serve-static");
+import errorhandler = require("errorhandler");
-const settings = require("./settings");
+import settings = require("./settings");
const app = express();
-app.set("port", process.env.PORT || settings.port); // eslint-disable-line no-process-env
+app.set("port", settings.port); // eslint-disable-line no-process-env
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "jade");
app.set("gitpath", settings.gitpath);
diff --git a/BuildServer/compress-old-reports.js b/BuildServer/compress-old-reports.ts
similarity index 100%
rename from BuildServer/compress-old-reports.js
rename to BuildServer/compress-old-reports.ts
diff --git a/BuildServer/lib/builder.js b/BuildServer/lib/builder.ts
similarity index 93%
rename from BuildServer/lib/builder.js
rename to BuildServer/lib/builder.ts
index 120bd78..e1cdcf4 100644
--- a/BuildServer/lib/builder.js
+++ b/BuildServer/lib/builder.ts
@@ -1,14 +1,14 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const fse = require("fs-extra");
-const async = require("async");
-const gitLoader = require("./git/loader");
-const processor = require("./task-processor");
-const reportProcessor = require("./report-processor");
-const mailSender = require("./mail-sender");
-const settings = require("../settings");
+import path = require("path");
+import fs = require("fs");
+import fse = require("fs-extra");
+import async = require("async");
+import gitLoader = require("./git/loader");
+import processor = require("./task-processor");
+import reportProcessor = require("./report-processor");
+import mailSender = require("./mail-sender");
+import settings = require("../settings");
const codePostfix = "";
const mailLazinessLevel = 1000;
@@ -62,7 +62,7 @@ const wrapGitLoader = (skipGitLoader) => {
return (gitLoaderOptions, gitLoaderCallback) => process.nextTick(gitLoaderCallback);
};
-const safeParseJson = (data) => {
+const safeParseJson = (data):any => {
try {
return { "parsed": JSON.parse(data) };
} catch (err) {
@@ -70,7 +70,7 @@ const safeParseJson = (data) => {
}
};
-const build = (options, buildCallback) => {
+export const build = (options, buildCallback) => {
const url = options.url;
const owner = options.owner;
const reponame = options.reponame;
@@ -121,7 +121,7 @@ const build = (options, buildCallback) => {
return result.messages.$allMessages.map((msg) => `${msg.prefix}\t${msg.message}`).join("\r\n");
};
- const done = (doneErr, result) => {
+ const done = (doneErr, result?) => {
const allErrors = ((result || {}).errors || {}).$allMessages || [];
const allWarns = ((result || {}).warns || {}).$allMessages || [];
const allInfos = ((result || {}).infos || {}).$allMessages || [];
@@ -215,5 +215,3 @@ const build = (options, buildCallback) => {
});
});
};
-
-exports.build = build;
diff --git a/BuildServer/lib/commenter.js b/BuildServer/lib/commenter.ts
similarity index 96%
rename from BuildServer/lib/commenter.js
rename to BuildServer/lib/commenter.ts
index 90a9483..6b7385a 100644
--- a/BuildServer/lib/commenter.js
+++ b/BuildServer/lib/commenter.ts
@@ -1,8 +1,8 @@
"use strict";
-const _ = require("underscore");
-const reportProcessor = require("./report-processor");
-const settings = require("../settings");
+import _ = require("underscore");
+import reportProcessor = require("./report-processor");
+import settings = require("../settings");
const featureNamePattern = /^feature-(\d+)(?:-[a-zA-Z0-9]+)+$/;
const versionNamePattern = /^v\d+(\.\d+)*$/;
@@ -136,9 +136,9 @@ const checkPullRequest = (options, callback) => {
});
};
-exports.commentOnPullRequest = (originalOptions, callback) => {
+export const commentOnPullRequest = (originalOptions, callback) => {
const optionsGithub = _.extend(originalOptions, { "github": settings.createGithub(originalOptions.baseRepoOptions.owner) });
- const options = _.extend(optionsGithub, { "onTenthAttempt": () => writeComment(optionsGithub, "Waiting for build to finish...") });
+ const options = _.extend(optionsGithub, { "onTenthAttempt": () => writeComment(optionsGithub, "Waiting for build to finish...", () => {}) });
return checkPullRequest(options, () => reportProcessor.getStatusMessageFromRelease(options.app, options.headRepoOptions, (statusMessageErr, statusSuccessMessage) => {
const escapedErr = String(statusMessageErr || "").substring(0, maxCommentLength)
diff --git a/BuildServer/lib/git/copy.js b/BuildServer/lib/git/copy.ts
similarity index 87%
rename from BuildServer/lib/git/copy.js
rename to BuildServer/lib/git/copy.ts
index 27fafe3..fd1d0fa 100644
--- a/BuildServer/lib/git/copy.js
+++ b/BuildServer/lib/git/copy.ts
@@ -1,12 +1,12 @@
"use strict";
-const EventEmitter = require("events").EventEmitter; // eslint-disable-line fp/no-events
-const path = require("path");
-const fs = require("fs");
-const async = require("async");
-const Copier = require("recursive-tree-copy").Copier;
+import { EventEmitter } from "events"; // eslint-disable-line fp/no-events
+import path = require("path");
+import fs = require("fs");
+import async = require("async");
+import { Copier } from "recursive-tree-copy";
-const safeGetEntries = (tree) => {
+const safeGetEntries = (tree):any => {
try {
return { "entries": tree.gitTree.entries() };
} catch (err) {
@@ -86,7 +86,7 @@ const gitToFsCopier = new Copier({
}
});
-exports.gitToFs = (commit, exportDir, callback) => commit.getTree((err, tree) => {
+export const gitToFs = (commit, exportDir, callback) => commit.getTree((err, tree) => {
if (err) {
return callback(err);
}
diff --git a/BuildServer/lib/git/loader.js b/BuildServer/lib/git/loader.ts
similarity index 92%
rename from BuildServer/lib/git/loader.js
rename to BuildServer/lib/git/loader.ts
index 1cdea6a..68dc97a 100644
--- a/BuildServer/lib/git/loader.js
+++ b/BuildServer/lib/git/loader.ts
@@ -1,8 +1,8 @@
"use strict";
-const nodegit = require("nodegit");
-const fse = require("fs-extra");
-const gitToFs = require("./copy").gitToFs;
+import nodegit = require("nodegit");
+import fse = require("fs-extra");
+import { gitToFs } from "./copy";
const mkdirs = (path) => {
fse.mkdirsSync(path); // eslint-disable-line no-sync
@@ -30,7 +30,7 @@ options = {
}
*/
-module.exports = (options, globalCallback) => {
+export = (options, globalCallback) => {
const url = fixUrl(options.remote);
const path = `${options.local}/${options.hash}`;
const exported = options.exported;
diff --git a/BuildServer/lib/mail-sender.js b/BuildServer/lib/mail-sender.js
deleted file mode 100644
index 7b46146..0000000
--- a/BuildServer/lib/mail-sender.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";
-
-exports.send = (message, callback) => process.nextTick(callback);
diff --git a/BuildServer/lib/mail-sender.ts b/BuildServer/lib/mail-sender.ts
new file mode 100644
index 0000000..2249d0d
--- /dev/null
+++ b/BuildServer/lib/mail-sender.ts
@@ -0,0 +1,3 @@
+"use strict";
+
+export const send = (message, callback) => process.nextTick(callback);
diff --git a/BuildServer/lib/report-processor.js b/BuildServer/lib/report-processor.ts
similarity index 90%
rename from BuildServer/lib/report-processor.js
rename to BuildServer/lib/report-processor.ts
index 5152713..07691db 100644
--- a/BuildServer/lib/report-processor.js
+++ b/BuildServer/lib/report-processor.ts
@@ -1,11 +1,11 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const zlib = require("zlib");
-const glob = require("glob");
-const streamBuffers = require("stream-buffers");
-const _ = require("underscore");
+import path = require("path");
+import fs = require("fs");
+import zlib = require("zlib");
+import glob = require("glob");
+import streamBuffers = require("stream-buffers");
+import _ = require("underscore");
const reportFilename = "report.json.gz";
const maxAttemptsNumber = 100;
@@ -23,7 +23,7 @@ const getAllErrors = (report) => ((report.result || {}).errors || {}).$allMessag
const getAllWarns = (report) => ((report.result || {}).warns || {}).$allMessages || [];
const getAllInfos = (report) => ((report.result || {}).infos || {}).$allMessages || [];
-const writeReport = (releaseDir, err, result, callback) => {
+export const writeReport = (releaseDir, err, result, callback) => {
const data = JSON.stringify({
"date": Date.now(),
err,
@@ -48,7 +48,7 @@ const writeReport = (releaseDir, err, result, callback) => {
readable.stop();
};
-const readReport = (releaseDir, callback) => {
+export const readReport = (releaseDir, callback) => {
const readStream = fs.createReadStream(path.join(releaseDir, reportFilename));
const writable = new streamBuffers.WritableStreamBuffer();
@@ -71,11 +71,7 @@ const readReport = (releaseDir, callback) => {
});
};
-exports.readReport = readReport;
-
-exports.writeReport = writeReport;
-
-exports.loadReport = (app, options, callback) => {
+export const loadReport = (app, options, callback) => {
const releaseDir = path.join(app.get("releasepath"), options.owner, options.reponame, options.branch, options.rev);
glob("**", {
@@ -107,7 +103,7 @@ exports.loadReport = (app, options, callback) => {
});
};
-exports.getStatusMessageFromRelease = (app, originalOptions, callback) => {
+export const getStatusMessageFromRelease = (app, originalOptions, callback) => {
const options = _.extend(originalOptions, { "attemptsGetReport": (Number(originalOptions.attemptsGetReport) || Number()) + 1 });
const releaseDir = path.join(app.get("releasepath"), options.owner, options.reponame, options.branch, options.rev);
const reportFile = path.join(releaseDir, reportFilename);
diff --git a/BuildServer/lib/status-processor.js b/BuildServer/lib/status-processor.ts
similarity index 89%
rename from BuildServer/lib/status-processor.js
rename to BuildServer/lib/status-processor.ts
index f9ce9f5..a5f6a9e 100644
--- a/BuildServer/lib/status-processor.js
+++ b/BuildServer/lib/status-processor.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const _ = require("underscore");
-const reportProcessor = require("./report-processor");
+import path = require("path");
+import fs = require("fs");
+import _ = require("underscore");
+import reportProcessor = require("./report-processor");
const addBranchInfo = (app, options, callback) => {
const branchFile = path.join(app.get("releasepath"), options.owner, options.reponame, "$revs", `${options.rev}.branch`);
@@ -76,7 +76,7 @@ const parseOptions = (app, options, callback) => {
}), callback);
};
-exports.getReport = (app, options, callback) => parseOptions(app, options, (err, result) => {
+export const getReport = (app, options, callback) => parseOptions(app, options, (err, result) => {
if (err) {
return callback(err, {});
}
diff --git a/BuildServer/lib/task-processor.js b/BuildServer/lib/task-processor.ts
similarity index 94%
rename from BuildServer/lib/task-processor.js
rename to BuildServer/lib/task-processor.ts
index fd92a9d..97b9a6b 100644
--- a/BuildServer/lib/task-processor.js
+++ b/BuildServer/lib/task-processor.ts
@@ -1,14 +1,10 @@
"use strict";
-const _ = require("underscore");
-const tasks = require("./tasks");
+import _ = require("underscore");
+import tasks from "./tasks";
// TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here.
const TaskProcessor = function (task, outerProcessor, callback) {
- if (!this) {
- return new TaskProcessor(task);
- }
-
const that = this;
const createTaskWorker = () => tasks[task.type](task.params || {}, that);
const errors = [];
@@ -65,7 +61,7 @@ const addFlag = (flags) => (flagName) => {
const containsFlag = (flags) => (flagName) => flags[flagName];
-exports.processTask = (task, context, callback) => {
+export const processTask = (task, context, callback) => {
const errors = {};
const warns = {};
const infos = {};
diff --git a/BuildServer/lib/tasks/cleanupafterdotnetbuild.js b/BuildServer/lib/tasks/cleanupafterdotnetbuild.ts
similarity index 90%
rename from BuildServer/lib/tasks/cleanupafterdotnetbuild.js
rename to BuildServer/lib/tasks/cleanupafterdotnetbuild.ts
index b02f255..56642b8 100644
--- a/BuildServer/lib/tasks/cleanupafterdotnetbuild.js
+++ b/BuildServer/lib/tasks/cleanupafterdotnetbuild.ts
@@ -1,8 +1,8 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => glob("**/obj/{Debug,Release}/*.{dll,pdb,xml}", {
"cwd": processor.context.exported,
"dot": true
diff --git a/BuildServer/lib/tasks/conditional.js b/BuildServer/lib/tasks/conditional.ts
similarity index 90%
rename from BuildServer/lib/tasks/conditional.js
rename to BuildServer/lib/tasks/conditional.ts
index d184581..9905e6f 100644
--- a/BuildServer/lib/tasks/conditional.js
+++ b/BuildServer/lib/tasks/conditional.ts
@@ -1,6 +1,6 @@
"use strict";
-module.exports = (params, processor) => {
+export = (params, processor) => {
const condition = (!params.owner || params.owner === processor.context.owner)
&& (!params.branch || params.branch === processor.context.branch || `refs/heads/${params.branch}` === processor.context.branch);
const task = (condition && params.task) || params.otherwise;
diff --git a/BuildServer/lib/tasks/copy.js b/BuildServer/lib/tasks/copy.ts
similarity index 84%
rename from BuildServer/lib/tasks/copy.js
rename to BuildServer/lib/tasks/copy.ts
index cc0f59c..1783508 100644
--- a/BuildServer/lib/tasks/copy.js
+++ b/BuildServer/lib/tasks/copy.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const fse = require("fs-extra");
+import path = require("path");
+import fse = require("fs-extra");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const sourceFilePath = path.join(processor.context.exported, params.filename);
const targetFilePath = path.join(processor.context.release, params.filename);
diff --git a/BuildServer/lib/tasks/copyglob.js b/BuildServer/lib/tasks/copyglob.ts
similarity index 90%
rename from BuildServer/lib/tasks/copyglob.js
rename to BuildServer/lib/tasks/copyglob.ts
index a1a7aab..63920f5 100644
--- a/BuildServer/lib/tasks/copyglob.js
+++ b/BuildServer/lib/tasks/copyglob.ts
@@ -1,8 +1,8 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => glob(params.mask, {
"cwd": processor.context.exported,
"dot": true
diff --git a/BuildServer/lib/tasks/cssnano.js b/BuildServer/lib/tasks/cssnano.ts
similarity index 89%
rename from BuildServer/lib/tasks/cssnano.js
rename to BuildServer/lib/tasks/cssnano.ts
index cd7fac2..d7cc248 100644
--- a/BuildServer/lib/tasks/cssnano.js
+++ b/BuildServer/lib/tasks/cssnano.ts
@@ -1,10 +1,10 @@
"use strict";
-const fs = require("fs");
-const path = require("path");
-const cssnano = require("cssnano");
+import fs = require("fs");
+import path = require("path");
+import cssnano = require("cssnano");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const filePath = path.join(processor.context.exported, params.filename);
diff --git a/BuildServer/lib/tasks/cssnanoall.js b/BuildServer/lib/tasks/cssnanoall.ts
similarity index 93%
rename from BuildServer/lib/tasks/cssnanoall.js
rename to BuildServer/lib/tasks/cssnanoall.ts
index 92a8437..2e9d4ea 100644
--- a/BuildServer/lib/tasks/cssnanoall.js
+++ b/BuildServer/lib/tasks/cssnanoall.ts
@@ -1,9 +1,9 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
const flagDoneName = "cssnanoallDone";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("cssnanoall task is executed more than once; this is probably a bug in your mbs.json");
diff --git a/BuildServer/lib/tasks/deletefromcode.js b/BuildServer/lib/tasks/deletefromcode.ts
similarity index 81%
rename from BuildServer/lib/tasks/deletefromcode.js
rename to BuildServer/lib/tasks/deletefromcode.ts
index f74e3dd..d710e5e 100644
--- a/BuildServer/lib/tasks/deletefromcode.js
+++ b/BuildServer/lib/tasks/deletefromcode.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const fse = require("fs-extra");
+import path = require("path");
+import fse = require("fs-extra");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const sourceFilePath = path.join(processor.context.exported, params.filename);
diff --git a/BuildServer/lib/tasks/dotnetbuild.js b/BuildServer/lib/tasks/dotnetbuild.ts
similarity index 73%
rename from BuildServer/lib/tasks/dotnetbuild.js
rename to BuildServer/lib/tasks/dotnetbuild.ts
index de55745..d1b5029 100644
--- a/BuildServer/lib/tasks/dotnetbuild.js
+++ b/BuildServer/lib/tasks/dotnetbuild.ts
@@ -1,8 +1,8 @@
"use strict";
-const sequential = require("./sequential");
+import sequential = require("./sequential");
-module.exports = (params, processor) => sequential({
+export = (params, processor) => sequential({
"tasks": [
{
"name": "build",
diff --git a/BuildServer/lib/tasks/dotnetbuildandtest.js b/BuildServer/lib/tasks/dotnetbuildandtest.ts
similarity index 79%
rename from BuildServer/lib/tasks/dotnetbuildandtest.js
rename to BuildServer/lib/tasks/dotnetbuildandtest.ts
index de27456..9ab71ca 100644
--- a/BuildServer/lib/tasks/dotnetbuildandtest.js
+++ b/BuildServer/lib/tasks/dotnetbuildandtest.ts
@@ -1,8 +1,8 @@
"use strict";
-const sequential = require("./sequential");
+import sequential = require("./sequential");
-module.exports = (params, processor) => sequential({
+export = (params, processor) => sequential({
"tasks": [
{
"name": "build",
diff --git a/BuildServer/lib/tasks/dotnetbuilderwrapper.js b/BuildServer/lib/tasks/dotnetbuilderwrapper.ts
similarity index 91%
rename from BuildServer/lib/tasks/dotnetbuilderwrapper.js
rename to BuildServer/lib/tasks/dotnetbuilderwrapper.ts
index cf97e14..f087282 100644
--- a/BuildServer/lib/tasks/dotnetbuilderwrapper.js
+++ b/BuildServer/lib/tasks/dotnetbuilderwrapper.ts
@@ -1,8 +1,8 @@
"use strict";
-const spawn = require("child_process").spawn;
-const streamBuffers = require("stream-buffers");
-const settings = require("../../settings");
+import { spawn } from "child_process";
+import streamBuffers = require("stream-buffers");
+import settings = require("../../settings");
const wrapBuilder = (builder, input, onExit) => {
const resultBuffer = new streamBuffers.WritableStreamBuffer();
@@ -26,7 +26,7 @@ const wrapBuilder = (builder, input, onExit) => {
builder.stdin.end();
};
-const safeParseJson = (data) => {
+const safeParseJson = (data):any => {
try {
return { "parsed": JSON.parse(data) };
} catch (err) {
@@ -34,7 +34,7 @@ const safeParseJson = (data) => {
}
};
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const input = JSON.stringify(params);
const builder = spawn(settings.builderExecutable, [params.command]);
diff --git a/BuildServer/lib/tasks/dotnetbuildwithoutcleanup.js b/BuildServer/lib/tasks/dotnetbuildwithoutcleanup.ts
similarity index 91%
rename from BuildServer/lib/tasks/dotnetbuildwithoutcleanup.js
rename to BuildServer/lib/tasks/dotnetbuildwithoutcleanup.ts
index b5ed97e..efd9d38 100644
--- a/BuildServer/lib/tasks/dotnetbuildwithoutcleanup.js
+++ b/BuildServer/lib/tasks/dotnetbuildwithoutcleanup.ts
@@ -1,6 +1,6 @@
"use strict";
-const sequential = require("./sequential");
+import sequential = require("./sequential");
const createTasks = function *(params) {
if (!params.skipMbsCheckStyle) {
@@ -35,7 +35,7 @@ const createTasks = function *(params) {
};
};
-module.exports = (params, processor) => {
+export = (params, processor) => {
const tasks = Array.from(createTasks(params));
return sequential({ tasks }, processor);
diff --git a/BuildServer/lib/tasks/dotnetcheckstyle.js b/BuildServer/lib/tasks/dotnetcheckstyle.ts
similarity index 93%
rename from BuildServer/lib/tasks/dotnetcheckstyle.js
rename to BuildServer/lib/tasks/dotnetcheckstyle.ts
index 502787a..78340e8 100644
--- a/BuildServer/lib/tasks/dotnetcheckstyle.js
+++ b/BuildServer/lib/tasks/dotnetcheckstyle.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const async = require("async");
-const glob = require("glob");
+import path = require("path");
+import fs = require("fs");
+import async = require("async");
+import glob = require("glob");
const autoGeneratedMarker
= "//------------------------------------------------------------------------------\n"
@@ -11,7 +11,7 @@ const autoGeneratedMarker
const flagDoneName = "dotnetcheckerDone";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(flagDoneName)) {
return processor.done();
diff --git a/BuildServer/lib/tasks/dotnetcompile.js b/BuildServer/lib/tasks/dotnetcompile.ts
similarity index 82%
rename from BuildServer/lib/tasks/dotnetcompile.js
rename to BuildServer/lib/tasks/dotnetcompile.ts
index bbf360f..6242593 100644
--- a/BuildServer/lib/tasks/dotnetcompile.js
+++ b/BuildServer/lib/tasks/dotnetcompile.ts
@@ -1,11 +1,11 @@
"use strict";
-const path = require("path");
-const _ = require("underscore");
-const settings = require("../../settings");
-const dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
+import path = require("path");
+import _ = require("underscore");
+import settings = require("../../settings");
+import dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
-module.exports = (params, processor) => {
+export = (params, processor) => {
if (settings.isCodeAnalysisUnsupported && params.forceCodeAnalysis) {
processor.onError("Code analysis is not supported");
diff --git a/BuildServer/lib/tasks/dotnetnugetpack.js b/BuildServer/lib/tasks/dotnetnugetpack.js
deleted file mode 100644
index caae541..0000000
--- a/BuildServer/lib/tasks/dotnetnugetpack.js
+++ /dev/null
@@ -1,11 +0,0 @@
-"use strict";
-
-const _ = require("underscore");
-const dotnetnugetprocessinternal = require("./dotnetnugetprocessinternal");
-
-module.exports = (params, processor) => dotnetnugetprocessinternal(_.extendOwn(params, {
- "getFinalTask": (nupkg) => ({
- "params": { "filename": nupkg },
- "type": "copy"
- })
-}), processor);
diff --git a/BuildServer/lib/tasks/dotnetnugetpack.ts b/BuildServer/lib/tasks/dotnetnugetpack.ts
new file mode 100644
index 0000000..2c1e9c6
--- /dev/null
+++ b/BuildServer/lib/tasks/dotnetnugetpack.ts
@@ -0,0 +1,11 @@
+"use strict";
+
+import _ = require("underscore");
+import dotnetnugetprocessinternal = require("./dotnetnugetprocessinternal");
+
+export = (params, processor) => dotnetnugetprocessinternal(_.extendOwn(params, {
+ "getFinalTask": (nupkg) => ({
+ "params": { "filename": nupkg },
+ "type": "copy"
+ })
+}), processor);
diff --git a/BuildServer/lib/tasks/dotnetnugetprocess.js b/BuildServer/lib/tasks/dotnetnugetprocess.ts
similarity index 88%
rename from BuildServer/lib/tasks/dotnetnugetprocess.js
rename to BuildServer/lib/tasks/dotnetnugetprocess.ts
index c2110d6..59ef522 100644
--- a/BuildServer/lib/tasks/dotnetnugetprocess.js
+++ b/BuildServer/lib/tasks/dotnetnugetprocess.ts
@@ -1,8 +1,8 @@
"use strict";
-const conditional = require("./conditional");
+import conditional = require("./conditional");
-module.exports = (params, processor) => conditional({
+export = (params, processor) => conditional({
"branch": "master",
"otherwise": {
"name": "nuget-pack",
diff --git a/BuildServer/lib/tasks/dotnetnugetprocessinternal.js b/BuildServer/lib/tasks/dotnetnugetprocessinternal.ts
similarity index 91%
rename from BuildServer/lib/tasks/dotnetnugetprocessinternal.js
rename to BuildServer/lib/tasks/dotnetnugetprocessinternal.ts
index 5f77a1e..3db3aa7 100644
--- a/BuildServer/lib/tasks/dotnetnugetprocessinternal.js
+++ b/BuildServer/lib/tasks/dotnetnugetprocessinternal.ts
@@ -1,7 +1,7 @@
"use strict";
-const path = require("path");
-const sequential = require("./sequential");
+import path = require("path");
+import sequential = require("./sequential");
const postfixLength = 16;
const fourDigits = 10000;
@@ -15,7 +15,7 @@ const addPostfix = (version, params, processor) => {
return `${version}-r${processor.context.rev.substr(0, postfixLength)}`;
};
-module.exports = (params, processor) => {
+export = (params, processor) => {
const date = new Date();
const major = params.major || "0";
const minor = (date.getFullYear() * fourDigits) + ((date.getMonth() + 1) * twoDigits) + date.getDate();
diff --git a/BuildServer/lib/tasks/dotnetnugetpush.js b/BuildServer/lib/tasks/dotnetnugetpush.js
deleted file mode 100644
index eef7074..0000000
--- a/BuildServer/lib/tasks/dotnetnugetpush.js
+++ /dev/null
@@ -1,11 +0,0 @@
-"use strict";
-
-const _ = require("underscore");
-const dotnetnugetprocessinternal = require("./dotnetnugetprocessinternal");
-
-module.exports = (params, processor) => dotnetnugetprocessinternal(_.extendOwn(params, {
- "getFinalTask": (nupkg) => ({
- "params": { "Package": nupkg },
- "type": "dotnetnugetpushonly"
- })
-}), processor);
diff --git a/BuildServer/lib/tasks/dotnetnugetpush.ts b/BuildServer/lib/tasks/dotnetnugetpush.ts
new file mode 100644
index 0000000..4cf8ca3
--- /dev/null
+++ b/BuildServer/lib/tasks/dotnetnugetpush.ts
@@ -0,0 +1,11 @@
+"use strict";
+
+import _ = require("underscore");
+import dotnetnugetprocessinternal = require("./dotnetnugetprocessinternal");
+
+export = (params, processor) => dotnetnugetprocessinternal(_.extendOwn(params, {
+ "getFinalTask": (nupkg) => ({
+ "params": { "Package": nupkg },
+ "type": "dotnetnugetpushonly"
+ })
+}), processor);
diff --git a/BuildServer/lib/tasks/dotnetnugetpushonly.js b/BuildServer/lib/tasks/dotnetnugetpushonly.ts
similarity index 50%
rename from BuildServer/lib/tasks/dotnetnugetpushonly.js
rename to BuildServer/lib/tasks/dotnetnugetpushonly.ts
index a7c0ffa..b551343 100644
--- a/BuildServer/lib/tasks/dotnetnugetpushonly.js
+++ b/BuildServer/lib/tasks/dotnetnugetpushonly.ts
@@ -1,10 +1,10 @@
"use strict";
-const path = require("path");
-const dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
-const settings = require("../../settings");
+import path = require("path");
+import dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
+import settings = require("../../settings");
-module.exports = (params, processor) => dotnetbuilderwrapper({
+export = (params, processor) => dotnetbuilderwrapper({
"ApiKey": settings.nugetApiKey,
"NugetHost": settings.nugetHost,
"Package": path.join(processor.context.exported, params.Package),
diff --git a/BuildServer/lib/tasks/dotnetnugetrestore.js b/BuildServer/lib/tasks/dotnetnugetrestore.ts
similarity index 73%
rename from BuildServer/lib/tasks/dotnetnugetrestore.js
rename to BuildServer/lib/tasks/dotnetnugetrestore.ts
index e8134c8..f62baa3 100644
--- a/BuildServer/lib/tasks/dotnetnugetrestore.js
+++ b/BuildServer/lib/tasks/dotnetnugetrestore.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const sequential = require("./sequential");
+import path = require("path");
+import sequential = require("./sequential");
-module.exports = (params, processor) => sequential({
+export = (params, processor) => sequential({
"tasks": [
{
"params": {
diff --git a/BuildServer/lib/tasks/dotnetnunit.js b/BuildServer/lib/tasks/dotnetnunit.js
deleted file mode 100644
index d5564d4..0000000
--- a/BuildServer/lib/tasks/dotnetnunit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-"use strict";
-
-const path = require("path");
-const dotNetBuilderWrapper = require("./dotnetbuilderwrapper");
-
-module.exports = (params, processor) => dotNetBuilderWrapper({
- "TestLibraryPath": path.join(processor.context.exported, params.assembly),
- "command": "nunit"
-}, processor);
diff --git a/BuildServer/lib/tasks/dotnetnunit.ts b/BuildServer/lib/tasks/dotnetnunit.ts
new file mode 100644
index 0000000..5f8ba6a
--- /dev/null
+++ b/BuildServer/lib/tasks/dotnetnunit.ts
@@ -0,0 +1,9 @@
+"use strict";
+
+import path = require("path");
+import dotNetBuilderWrapper = require("./dotnetbuilderwrapper");
+
+export = (params, processor) => dotNetBuilderWrapper({
+ "TestLibraryPath": path.join(processor.context.exported, params.assembly),
+ "command": "nunit"
+}, processor);
diff --git a/BuildServer/lib/tasks/dotnetnunitall.js b/BuildServer/lib/tasks/dotnetnunitall.ts
similarity index 94%
rename from BuildServer/lib/tasks/dotnetnunitall.js
rename to BuildServer/lib/tasks/dotnetnunitall.ts
index f4340c3..4ee6445 100644
--- a/BuildServer/lib/tasks/dotnetnunitall.js
+++ b/BuildServer/lib/tasks/dotnetnunitall.ts
@@ -1,9 +1,9 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
const flagDoneName = "dotnetnunitallDone";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");
diff --git a/BuildServer/lib/tasks/dotnetpackwebapp.js b/BuildServer/lib/tasks/dotnetpackwebapp.ts
similarity index 89%
rename from BuildServer/lib/tasks/dotnetpackwebapp.js
rename to BuildServer/lib/tasks/dotnetpackwebapp.ts
index fd2f7d1..070f167 100644
--- a/BuildServer/lib/tasks/dotnetpackwebapp.js
+++ b/BuildServer/lib/tasks/dotnetpackwebapp.ts
@@ -1,10 +1,9 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const Mustache = require("mustache");
-
-const sequential = require("./sequential");
+import path = require("path");
+import fs = require("fs");
+import Mustache = require("mustache");
+import sequential = require("./sequential");
// eslint-disable-next-line no-sync
const msbuildTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.template.msbuild"), { "encoding": "utf8" });
@@ -13,7 +12,7 @@ const deployTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.t
// eslint-disable-next-line no-sync
const versionTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.template.version.aspx"), { "encoding": "utf8" });
-module.exports = (params, processor) => sequential({
+export = (params, processor) => sequential({
"tasks": [
{
"params": {
diff --git a/BuildServer/lib/tasks/dotnetrewrite.js b/BuildServer/lib/tasks/dotnetrewrite.ts
similarity index 91%
rename from BuildServer/lib/tasks/dotnetrewrite.js
rename to BuildServer/lib/tasks/dotnetrewrite.ts
index c6db85c..a91fbc9 100644
--- a/BuildServer/lib/tasks/dotnetrewrite.js
+++ b/BuildServer/lib/tasks/dotnetrewrite.ts
@@ -1,10 +1,10 @@
"use strict";
-const path = require("path");
-const fs = require("fs");
-const async = require("async");
-const glob = require("glob");
-const settings = require("../../settings");
+import path = require("path");
+import fs = require("fs");
+import async = require("async");
+import glob = require("glob");
+import settings = require("../../settings");
const flagDoneName = "dotnetrewriterDone";
@@ -31,7 +31,7 @@ const processAssemblyInfo = (params, processor, appendInformationalVersion) => (
return cb(null, processInformationalVersion(processInternalsVisible(originalContent)));
};
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(flagDoneName)) {
return processor.done();
diff --git a/BuildServer/lib/tasks/echo.js b/BuildServer/lib/tasks/echo.ts
similarity index 88%
rename from BuildServer/lib/tasks/echo.js
rename to BuildServer/lib/tasks/echo.ts
index dd5560b..d7079e5 100644
--- a/BuildServer/lib/tasks/echo.js
+++ b/BuildServer/lib/tasks/echo.ts
@@ -1,6 +1,6 @@
"use strict";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (params.error) {
processor.onError(params.error);
diff --git a/BuildServer/lib/tasks/eslintbrowser.js b/BuildServer/lib/tasks/eslintbrowser.ts
similarity index 83%
rename from BuildServer/lib/tasks/eslintbrowser.js
rename to BuildServer/lib/tasks/eslintbrowser.ts
index e1d8b57..9a60085 100644
--- a/BuildServer/lib/tasks/eslintbrowser.js
+++ b/BuildServer/lib/tasks/eslintbrowser.ts
@@ -1,13 +1,13 @@
"use strict";
-const path = require("path");
-const CLIEngine = require("eslint").CLIEngine;
-const settings = require("../../settings");
+import path = require("path");
+import { CLIEngine } from "eslint";
+import settings = require("../../settings");
const cli = new CLIEngine({ "configFile": settings.eslintBrowserConfig });
const errorSeverity = 2;
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const filePath = path.join(processor.context.exported, params.filename);
const result = cli.executeOnFiles([filePath]);
diff --git a/BuildServer/lib/tasks/eslintbrowserall.js b/BuildServer/lib/tasks/eslintbrowserall.ts
similarity index 93%
rename from BuildServer/lib/tasks/eslintbrowserall.js
rename to BuildServer/lib/tasks/eslintbrowserall.ts
index 82d253c..8c3836a 100644
--- a/BuildServer/lib/tasks/eslintbrowserall.js
+++ b/BuildServer/lib/tasks/eslintbrowserall.ts
@@ -1,9 +1,9 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
const flagDoneName = "eslintbrowserallDone";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("eslintbrowserall task is executed more than once; this is probably a bug in your mbs.json");
diff --git a/BuildServer/lib/tasks/index.js b/BuildServer/lib/tasks/index.ts
similarity index 54%
rename from BuildServer/lib/tasks/index.js
rename to BuildServer/lib/tasks/index.ts
index ec631b6..4f0fc02 100644
--- a/BuildServer/lib/tasks/index.js
+++ b/BuildServer/lib/tasks/index.ts
@@ -1,13 +1,17 @@
"use strict";
+var tasks = {};
+
// Code taken from http://stackoverflow.com/a/17204293
// eslint-disable-next-line no-sync
require("fs").readdirSync(__dirname)
.forEach((file) => {
- if (file.match(/\.js$/) !== null && file !== "index.js") {
- const name = file.replace(".js", "");
+ if (file.match(/\.ts$/) !== null && file !== "index.ts") {
+ const name = file.replace(".ts", "");
// eslint-disable-next-line global-require
- exports[name] = require(`./${file}`);
+ tasks[name] = require(`./${file}`);
}
});
+
+export default tasks;
diff --git a/BuildServer/lib/tasks/noop.js b/BuildServer/lib/tasks/noop.js
deleted file mode 100644
index 5e82011..0000000
--- a/BuildServer/lib/tasks/noop.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";
-
-module.exports = (params, processor) => ({ "process": () => processor.done() });
diff --git a/BuildServer/lib/tasks/noop.ts b/BuildServer/lib/tasks/noop.ts
new file mode 100644
index 0000000..e51c990
--- /dev/null
+++ b/BuildServer/lib/tasks/noop.ts
@@ -0,0 +1,3 @@
+"use strict";
+
+export = (params, processor) => ({ "process": () => processor.done() });
diff --git a/BuildServer/lib/tasks/packform.js b/BuildServer/lib/tasks/packform.ts
similarity index 86%
rename from BuildServer/lib/tasks/packform.js
rename to BuildServer/lib/tasks/packform.ts
index 38c4b3b..6588cf3 100644
--- a/BuildServer/lib/tasks/packform.js
+++ b/BuildServer/lib/tasks/packform.ts
@@ -1,8 +1,8 @@
"use strict";
-const sequential = require("./sequential");
+import sequential = require("./sequential");
-module.exports = (params, processor) => sequential({
+export = (params, processor) => sequential({
"tasks": [
{
"params": { "excludeFiles": params.eslintExcludeFiles },
diff --git a/BuildServer/lib/tasks/parallel.js b/BuildServer/lib/tasks/parallel.js
deleted file mode 100644
index 6e4525e..0000000
--- a/BuildServer/lib/tasks/parallel.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-const async = require("async");
-
-const mapper = (processor) => (task) => (callback) => processor.processTask(task, callback);
-
-module.exports = (params, processor) => ({ "process": () => async.parallel(params.tasks.map(mapper(processor)), () => processor.done()) });
diff --git a/BuildServer/lib/tasks/parallel.ts b/BuildServer/lib/tasks/parallel.ts
new file mode 100644
index 0000000..c81415e
--- /dev/null
+++ b/BuildServer/lib/tasks/parallel.ts
@@ -0,0 +1,7 @@
+"use strict";
+
+import async = require("async");
+
+const mapper = (processor) => (task) => (callback) => processor.processTask(task, callback);
+
+export = (params, processor) => ({ "process": () => async.parallel(params.tasks.map(mapper(processor)), () => processor.done()) });
diff --git a/BuildServer/lib/tasks/sequential.js b/BuildServer/lib/tasks/sequential.js
deleted file mode 100644
index 818813d..0000000
--- a/BuildServer/lib/tasks/sequential.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-const async = require("async");
-
-const mapper = (processor) => (task) => (callback) => processor.processTask(task, callback);
-
-module.exports = (params, processor) => ({ "process": () => async.series(params.tasks.map(mapper(processor)), () => processor.done()) });
diff --git a/BuildServer/lib/tasks/sequential.ts b/BuildServer/lib/tasks/sequential.ts
new file mode 100644
index 0000000..35b5abb
--- /dev/null
+++ b/BuildServer/lib/tasks/sequential.ts
@@ -0,0 +1,7 @@
+"use strict";
+
+import async = require("async");
+
+const mapper = (processor) => (task) => (callback) => processor.processTask(task, callback);
+
+export = (params, processor) => ({ "process": () => async.series(params.tasks.map(mapper(processor)), () => processor.done()) });
diff --git a/BuildServer/lib/tasks/uglifyjs.js b/BuildServer/lib/tasks/uglifyjs.ts
similarity index 80%
rename from BuildServer/lib/tasks/uglifyjs.js
rename to BuildServer/lib/tasks/uglifyjs.ts
index cea7827..094a2a3 100644
--- a/BuildServer/lib/tasks/uglifyjs.js
+++ b/BuildServer/lib/tasks/uglifyjs.ts
@@ -1,10 +1,10 @@
"use strict";
-const fs = require("fs");
-const path = require("path");
-const UglifyJS = require("uglify-js");
+import fs = require("fs");
+import path = require("path");
+import UglifyJS = require("uglify-js");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const filePath = path.normalize(path.join(processor.context.exported, params.filename));
const result = UglifyJS.minify(filePath);
diff --git a/BuildServer/lib/tasks/uglifyjsall.js b/BuildServer/lib/tasks/uglifyjsall.ts
similarity index 93%
rename from BuildServer/lib/tasks/uglifyjsall.js
rename to BuildServer/lib/tasks/uglifyjsall.ts
index 0af6ef1..94bd135 100644
--- a/BuildServer/lib/tasks/uglifyjsall.js
+++ b/BuildServer/lib/tasks/uglifyjsall.ts
@@ -1,10 +1,10 @@
"use strict";
-const glob = require("glob");
+import glob = require("glob");
const doneFlagName = "uglifyjsallDone";
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
if (processor.context.containsFlag(doneFlagName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");
diff --git a/BuildServer/lib/tasks/writefile.js b/BuildServer/lib/tasks/writefile.ts
similarity index 82%
rename from BuildServer/lib/tasks/writefile.js
rename to BuildServer/lib/tasks/writefile.ts
index 30b02d5..340ff48 100644
--- a/BuildServer/lib/tasks/writefile.js
+++ b/BuildServer/lib/tasks/writefile.ts
@@ -1,9 +1,9 @@
"use strict";
-const fs = require("fs");
-const path = require("path");
+import fs = require("fs");
+import path = require("path");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const filePath = path.join(processor.context.exported, params.filename);
diff --git a/BuildServer/lib/tasks/zip.js b/BuildServer/lib/tasks/zip.ts
similarity index 84%
rename from BuildServer/lib/tasks/zip.js
rename to BuildServer/lib/tasks/zip.ts
index 64c6c9e..fac39db 100644
--- a/BuildServer/lib/tasks/zip.js
+++ b/BuildServer/lib/tasks/zip.ts
@@ -1,10 +1,10 @@
"use strict";
-const fs = require("fs");
-const path = require("path");
-const Archiver = require("archiver");
+import fs = require("fs");
+import path = require("path");
+import Archiver = require("archiver");
-module.exports = (params, processor) => ({
+export = (params, processor) => ({
"process": () => {
const sourceDirectoryPath = path.normalize(path.join(processor.context.exported, String(params.directory || "")));
const targetArchivePath = path.normalize(path.join(processor.context.release, params.archive));
diff --git a/BuildServer/package.json b/BuildServer/package.json
index 8327619..ccdda39 100644
--- a/BuildServer/package.json
+++ b/BuildServer/package.json
@@ -42,8 +42,8 @@
"fp"
],
"extends": [
- "eslint:all",
- "plugin:fp/recommended"
+ "eslint:all",
+ "plugin:fp/recommended"
],
"rules": {
"fp/no-unused-expression": "off",
@@ -130,7 +130,8 @@
}
},
"devDependencies": {
- "eslint": "^3.15.0",
- "eslint-plugin-fp": "^2.3.0"
+ "@types/node": "^7.0.5",
+ "tslint": "^4.4.2",
+ "typescript": "^2.1.6"
}
}
diff --git a/BuildServer/routes/artifact.js b/BuildServer/routes/artifact.ts
similarity index 93%
rename from BuildServer/routes/artifact.js
rename to BuildServer/routes/artifact.ts
index 57b3dee..c317233 100644
--- a/BuildServer/routes/artifact.js
+++ b/BuildServer/routes/artifact.ts
@@ -1,6 +1,6 @@
"use strict";
-module.exports = (req, res) => {
+export = (req, res) => {
const options = {
"branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch,
diff --git a/BuildServer/routes/index.js b/BuildServer/routes/index.js
deleted file mode 100644
index 985145b..0000000
--- a/BuildServer/routes/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-"use strict";
-
-exports.index = (req, res) => res.render("index", { "title": `Express
\r\n${req}` });
-
-exports.postreceive = require("./postreceive");
-exports.manual = require("./manual");
-exports.status = require("./status");
-exports.artifact = require("./artifact");
-exports.release = require("./release");
diff --git a/BuildServer/routes/index.ts b/BuildServer/routes/index.ts
new file mode 100644
index 0000000..15363c0
--- /dev/null
+++ b/BuildServer/routes/index.ts
@@ -0,0 +1,12 @@
+"use strict";
+
+import postreceive = require("./postreceive");
+import manual = require("./manual");
+import status = require("./status");
+import artifact = require("./artifact");
+import release = require("./release");
+
+const index = (req, res) => res.render("index", { "title": `Express
\r\n${req}` });
+
+export { index, postreceive, manual, status, artifact, release };
+
diff --git a/BuildServer/routes/manual.js b/BuildServer/routes/manual.ts
similarity index 70%
rename from BuildServer/routes/manual.js
rename to BuildServer/routes/manual.ts
index b14dd9f..337855e 100644
--- a/BuildServer/routes/manual.js
+++ b/BuildServer/routes/manual.ts
@@ -1,11 +1,11 @@
"use strict";
-const _ = require("underscore");
-const builder = require("../lib/builder");
+import _ = require("underscore");
+import builder = require("../lib/builder");
-exports.get = (req, res) => res.render("manual");
+export const get = (req, res) => res.render("manual");
-exports.post = (req, res) => {
+export const post = (req, res) => {
const options = _.extend(req.body, {
"app": req.app,
"url": `https://pos-github.payonline.ru/${req.body.owner}/${req.body.reponame}`
@@ -19,4 +19,4 @@ exports.post = (req, res) => {
result
});
});
-};
+};
\ No newline at end of file
diff --git a/BuildServer/routes/postreceive.js b/BuildServer/routes/postreceive.ts
similarity index 96%
rename from BuildServer/routes/postreceive.js
rename to BuildServer/routes/postreceive.ts
index de7eff2..9507f16 100644
--- a/BuildServer/routes/postreceive.js
+++ b/BuildServer/routes/postreceive.ts
@@ -1,7 +1,7 @@
"use strict";
-const builder = require("../lib/builder");
-const commenter = require("../lib/commenter");
+import builder = require("../lib/builder");
+import commenter = require("../lib/commenter");
const getBranchDescription = (options) => `${options.owner}/${options.reponame}:${options.branchname || options.branch}`;
@@ -90,7 +90,7 @@ const processPullRequest = (req, res, payload) => {
);
};
-module.exports = (req, res) => {
+export = (req, res) => {
if (!req.body || (!req.body.payload && !req.body.repository)) {
return res.end();
}
diff --git a/BuildServer/routes/release.js b/BuildServer/routes/release.ts
similarity index 89%
rename from BuildServer/routes/release.js
rename to BuildServer/routes/release.ts
index ba9b4fe..8ad054a 100644
--- a/BuildServer/routes/release.js
+++ b/BuildServer/routes/release.ts
@@ -1,9 +1,9 @@
"use strict";
-const path = require("path");
-const Archiver = require("archiver");
+import path = require("path");
+import Archiver = require("archiver");
-const reportProcessor = require("../lib/report-processor");
+import reportProcessor = require("../lib/report-processor");
const getDatePart = (report) => {
if (!report.date) {
@@ -23,7 +23,7 @@ const getDatePart = (report) => {
return `${year}.${month}.${day}.${hours}.${minutes}.${seconds}`;
};
-module.exports = (req, res, next) => {
+export = (req, res, next) => {
const options = {
"branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch,
diff --git a/BuildServer/routes/status.js b/BuildServer/routes/status.ts
similarity index 88%
rename from BuildServer/routes/status.js
rename to BuildServer/routes/status.ts
index 4aa859e..dbb75c4 100644
--- a/BuildServer/routes/status.js
+++ b/BuildServer/routes/status.ts
@@ -1,8 +1,8 @@
"use strict";
-const url = require("url");
-const _ = require("underscore");
-const statusProcessor = require("../lib/status-processor");
+import url = require("url");
+import _ = require("underscore");
+import statusProcessor = require("../lib/status-processor");
const parseOptionsFromReferer = (path, callback) => {
const pathParts = path.split("/").filter((value) => value);
@@ -39,7 +39,7 @@ const createShowReport = (res) => (err, inputOptions) => {
res.render("status", options);
};
-exports.image = (req, res) => {
+export const image = (req, res) => {
const getAdditionalOptions = (err, options) => {
if (err === "ReportFileNotFound") {
return { "status": "Building" };
@@ -98,7 +98,7 @@ exports.image = (req, res) => {
});
};
-exports.page = (req, res) => {
+export const page = (req, res) => {
const options = {
"branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch,
@@ -110,9 +110,9 @@ exports.page = (req, res) => {
statusProcessor.getReport(req.app, options, createShowReport(res));
};
-exports.pageFromGithub = (req, res) => parseOptionsFromReferer(req.params[0], (err, options) => {
+export const pageFromGithub = (req, res) => parseOptionsFromReferer(req.params[0], (err, options) => {
if (err) {
- return createShowReport(err, options);
+ return createShowReport(res)(err, options);
}
return statusProcessor.getReport(req.app, options, createShowReport(res));
diff --git a/BuildServer/settings.js.example b/BuildServer/settings.ts.example
similarity index 92%
rename from BuildServer/settings.js.example
rename to BuildServer/settings.ts.example
index 4ab41be..77d7fc3 100644
--- a/BuildServer/settings.js.example
+++ b/BuildServer/settings.ts.example
@@ -12,8 +12,10 @@ const createGithub = () => new GitHubApi({
"version": "3.0.0"
});
-module.exports = {
+export = {
"builderExecutable": "../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe",
+ "codeSigningKeyFile": null,
+ "codeSigningPublicKey": null,
"createGithub": (repoOwner) => {
const github = createGithub();
@@ -36,6 +38,7 @@ module.exports = {
"eslintBrowserConfig": "settings-eslint-browser.json",
"gitpath": "M:/g",
"ignoreCodeAnalysisByDefault": true,
+ "isCodeAnalysisUnsupported": false,
"nugetApiKey": "*** NUGET API KEY ***",
"nugetHost": "https://*** NUGET HOST ***/",
"port": 3000,
diff --git a/BuildServer/tsconfig.json b/BuildServer/tsconfig.json
new file mode 100644
index 0000000..fe3b5ae
--- /dev/null
+++ b/BuildServer/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "compilerOptions": {
+ "target": "es6",
+ "typeRoots": [
+ "node_modules/@types"
+ ]
+ }
+}