Initial working version

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 8 years ago
parent c592891dde
commit c9dfd2b5b9
  1. 1
      BuildServer/.gitignore
  2. 28
      BuildServer/app.ts
  3. 0
      BuildServer/compress-old-reports.ts
  4. 26
      BuildServer/lib/builder.ts
  5. 10
      BuildServer/lib/commenter.ts
  6. 14
      BuildServer/lib/git/copy.ts
  7. 8
      BuildServer/lib/git/loader.ts
  8. 3
      BuildServer/lib/mail-sender.js
  9. 3
      BuildServer/lib/mail-sender.ts
  10. 24
      BuildServer/lib/report-processor.ts
  11. 10
      BuildServer/lib/status-processor.ts
  12. 10
      BuildServer/lib/task-processor.ts
  13. 4
      BuildServer/lib/tasks/cleanupafterdotnetbuild.ts
  14. 2
      BuildServer/lib/tasks/conditional.ts
  15. 6
      BuildServer/lib/tasks/copy.ts
  16. 4
      BuildServer/lib/tasks/copyglob.ts
  17. 8
      BuildServer/lib/tasks/cssnano.ts
  18. 4
      BuildServer/lib/tasks/cssnanoall.ts
  19. 6
      BuildServer/lib/tasks/deletefromcode.ts
  20. 4
      BuildServer/lib/tasks/dotnetbuild.ts
  21. 4
      BuildServer/lib/tasks/dotnetbuildandtest.ts
  22. 10
      BuildServer/lib/tasks/dotnetbuilderwrapper.ts
  23. 4
      BuildServer/lib/tasks/dotnetbuildwithoutcleanup.ts
  24. 10
      BuildServer/lib/tasks/dotnetcheckstyle.ts
  25. 10
      BuildServer/lib/tasks/dotnetcompile.ts
  26. 11
      BuildServer/lib/tasks/dotnetnugetpack.js
  27. 11
      BuildServer/lib/tasks/dotnetnugetpack.ts
  28. 4
      BuildServer/lib/tasks/dotnetnugetprocess.ts
  29. 6
      BuildServer/lib/tasks/dotnetnugetprocessinternal.ts
  30. 11
      BuildServer/lib/tasks/dotnetnugetpush.js
  31. 11
      BuildServer/lib/tasks/dotnetnugetpush.ts
  32. 8
      BuildServer/lib/tasks/dotnetnugetpushonly.ts
  33. 6
      BuildServer/lib/tasks/dotnetnugetrestore.ts
  34. 9
      BuildServer/lib/tasks/dotnetnunit.js
  35. 9
      BuildServer/lib/tasks/dotnetnunit.ts
  36. 4
      BuildServer/lib/tasks/dotnetnunitall.ts
  37. 11
      BuildServer/lib/tasks/dotnetpackwebapp.ts
  38. 12
      BuildServer/lib/tasks/dotnetrewrite.ts
  39. 2
      BuildServer/lib/tasks/echo.ts
  40. 8
      BuildServer/lib/tasks/eslintbrowser.ts
  41. 4
      BuildServer/lib/tasks/eslintbrowserall.ts
  42. 10
      BuildServer/lib/tasks/index.ts
  43. 3
      BuildServer/lib/tasks/noop.js
  44. 3
      BuildServer/lib/tasks/noop.ts
  45. 4
      BuildServer/lib/tasks/packform.ts
  46. 7
      BuildServer/lib/tasks/parallel.js
  47. 7
      BuildServer/lib/tasks/parallel.ts
  48. 7
      BuildServer/lib/tasks/sequential.js
  49. 7
      BuildServer/lib/tasks/sequential.ts
  50. 8
      BuildServer/lib/tasks/uglifyjs.ts
  51. 4
      BuildServer/lib/tasks/uglifyjsall.ts
  52. 6
      BuildServer/lib/tasks/writefile.ts
  53. 8
      BuildServer/lib/tasks/zip.ts
  54. 5
      BuildServer/package.json
  55. 2
      BuildServer/routes/artifact.ts
  56. 9
      BuildServer/routes/index.js
  57. 12
      BuildServer/routes/index.ts
  58. 8
      BuildServer/routes/manual.ts
  59. 6
      BuildServer/routes/postreceive.ts
  60. 8
      BuildServer/routes/release.ts
  61. 14
      BuildServer/routes/status.ts
  62. 5
      BuildServer/settings.ts.example
  63. 8
      BuildServer/tsconfig.json

@ -17,5 +17,6 @@ node_modules
data data
*.crt *.crt
settings.js settings.js
settings.ts
iisnode iisnode

@ -1,26 +1,26 @@
"use strict"; "use strict";
const realFs = require("fs"); import realFs = require("fs");
const fs = require("graceful-fs"); import fs = require("graceful-fs");
fs.gracefulify(realFs); fs.gracefulify(realFs);
const express = require("express"); import express = require("express");
const routes = require("./routes"); import routes = require("./routes");
const http = require("http"); import http = require("http");
const path = require("path"); import path = require("path");
const serveFavicon = require("serve-favicon"); import serveFavicon = require("serve-favicon");
const morgan = require("morgan"); import morgan = require("morgan");
const bodyParser = require("body-parser"); import bodyParser = require("body-parser");
const methodOverride = require("method-override"); import methodOverride = require("method-override");
const serveStatic = require("serve-static"); import serveStatic = require("serve-static");
const errorhandler = require("errorhandler"); import errorhandler = require("errorhandler");
const settings = require("./settings"); import settings = require("./settings");
const app = express(); 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("views", path.join(__dirname, "views"));
app.set("view engine", "jade"); app.set("view engine", "jade");
app.set("gitpath", settings.gitpath); app.set("gitpath", settings.gitpath);

@ -1,14 +1,14 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const fse = require("fs-extra"); import fse = require("fs-extra");
const async = require("async"); import async = require("async");
const gitLoader = require("./git/loader"); import gitLoader = require("./git/loader");
const processor = require("./task-processor"); import processor = require("./task-processor");
const reportProcessor = require("./report-processor"); import reportProcessor = require("./report-processor");
const mailSender = require("./mail-sender"); import mailSender = require("./mail-sender");
const settings = require("../settings"); import settings = require("../settings");
const codePostfix = ""; const codePostfix = "";
const mailLazinessLevel = 1000; const mailLazinessLevel = 1000;
@ -62,7 +62,7 @@ const wrapGitLoader = (skipGitLoader) => {
return (gitLoaderOptions, gitLoaderCallback) => process.nextTick(gitLoaderCallback); return (gitLoaderOptions, gitLoaderCallback) => process.nextTick(gitLoaderCallback);
}; };
const safeParseJson = (data) => { const safeParseJson = (data):any => {
try { try {
return { "parsed": JSON.parse(data) }; return { "parsed": JSON.parse(data) };
} catch (err) { } catch (err) {
@ -70,7 +70,7 @@ const safeParseJson = (data) => {
} }
}; };
const build = (options, buildCallback) => { export const build = (options, buildCallback) => {
const url = options.url; const url = options.url;
const owner = options.owner; const owner = options.owner;
const reponame = options.reponame; 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"); 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 allErrors = ((result || {}).errors || {}).$allMessages || [];
const allWarns = ((result || {}).warns || {}).$allMessages || []; const allWarns = ((result || {}).warns || {}).$allMessages || [];
const allInfos = ((result || {}).infos || {}).$allMessages || []; const allInfos = ((result || {}).infos || {}).$allMessages || [];
@ -215,5 +215,3 @@ const build = (options, buildCallback) => {
}); });
}); });
}; };
exports.build = build;

@ -1,8 +1,8 @@
"use strict"; "use strict";
const _ = require("underscore"); import _ = require("underscore");
const reportProcessor = require("./report-processor"); import reportProcessor = require("./report-processor");
const settings = require("../settings"); import settings = require("../settings");
const featureNamePattern = /^feature-(\d+)(?:-[a-zA-Z0-9]+)+$/; const featureNamePattern = /^feature-(\d+)(?:-[a-zA-Z0-9]+)+$/;
const versionNamePattern = /^v\d+(\.\d+)*$/; 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 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) => { return checkPullRequest(options, () => reportProcessor.getStatusMessageFromRelease(options.app, options.headRepoOptions, (statusMessageErr, statusSuccessMessage) => {
const escapedErr = String(statusMessageErr || "").substring(0, maxCommentLength) const escapedErr = String(statusMessageErr || "").substring(0, maxCommentLength)

@ -1,12 +1,12 @@
"use strict"; "use strict";
const EventEmitter = require("events").EventEmitter; // eslint-disable-line fp/no-events import { EventEmitter } from "events"; // eslint-disable-line fp/no-events
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const async = require("async"); import async = require("async");
const Copier = require("recursive-tree-copy").Copier; import { Copier } from "recursive-tree-copy";
const safeGetEntries = (tree) => { const safeGetEntries = (tree):any => {
try { try {
return { "entries": tree.gitTree.entries() }; return { "entries": tree.gitTree.entries() };
} catch (err) { } 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) { if (err) {
return callback(err); return callback(err);
} }

@ -1,8 +1,8 @@
"use strict"; "use strict";
const nodegit = require("nodegit"); import nodegit = require("nodegit");
const fse = require("fs-extra"); import fse = require("fs-extra");
const gitToFs = require("./copy").gitToFs; import { gitToFs } from "./copy";
const mkdirs = (path) => { const mkdirs = (path) => {
fse.mkdirsSync(path); // eslint-disable-line no-sync 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 url = fixUrl(options.remote);
const path = `${options.local}/${options.hash}`; const path = `${options.local}/${options.hash}`;
const exported = options.exported; const exported = options.exported;

@ -1,3 +0,0 @@
"use strict";
exports.send = (message, callback) => process.nextTick(callback);

@ -0,0 +1,3 @@
"use strict";
export const send = (message, callback) => process.nextTick(callback);

@ -1,11 +1,11 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const zlib = require("zlib"); import zlib = require("zlib");
const glob = require("glob"); import glob = require("glob");
const streamBuffers = require("stream-buffers"); import streamBuffers = require("stream-buffers");
const _ = require("underscore"); import _ = require("underscore");
const reportFilename = "report.json.gz"; const reportFilename = "report.json.gz";
const maxAttemptsNumber = 100; const maxAttemptsNumber = 100;
@ -23,7 +23,7 @@ const getAllErrors = (report) => ((report.result || {}).errors || {}).$allMessag
const getAllWarns = (report) => ((report.result || {}).warns || {}).$allMessages || []; const getAllWarns = (report) => ((report.result || {}).warns || {}).$allMessages || [];
const getAllInfos = (report) => ((report.result || {}).infos || {}).$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({ const data = JSON.stringify({
"date": Date.now(), "date": Date.now(),
err, err,
@ -48,7 +48,7 @@ const writeReport = (releaseDir, err, result, callback) => {
readable.stop(); readable.stop();
}; };
const readReport = (releaseDir, callback) => { export const readReport = (releaseDir, callback) => {
const readStream = fs.createReadStream(path.join(releaseDir, reportFilename)); const readStream = fs.createReadStream(path.join(releaseDir, reportFilename));
const writable = new streamBuffers.WritableStreamBuffer(); const writable = new streamBuffers.WritableStreamBuffer();
@ -71,11 +71,7 @@ const readReport = (releaseDir, callback) => {
}); });
}; };
exports.readReport = readReport; export const loadReport = (app, options, callback) => {
exports.writeReport = writeReport;
exports.loadReport = (app, options, callback) => {
const releaseDir = path.join(app.get("releasepath"), options.owner, options.reponame, options.branch, options.rev); const releaseDir = path.join(app.get("releasepath"), options.owner, options.reponame, options.branch, options.rev);
glob("**", { 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 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 releaseDir = path.join(app.get("releasepath"), options.owner, options.reponame, options.branch, options.rev);
const reportFile = path.join(releaseDir, reportFilename); const reportFile = path.join(releaseDir, reportFilename);

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const _ = require("underscore"); import _ = require("underscore");
const reportProcessor = require("./report-processor"); import reportProcessor = require("./report-processor");
const addBranchInfo = (app, options, callback) => { const addBranchInfo = (app, options, callback) => {
const branchFile = path.join(app.get("releasepath"), options.owner, options.reponame, "$revs", `${options.rev}.branch`); 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); }), callback);
}; };
exports.getReport = (app, options, callback) => parseOptions(app, options, (err, result) => { export const getReport = (app, options, callback) => parseOptions(app, options, (err, result) => {
if (err) { if (err) {
return callback(err, {}); return callback(err, {});
} }

@ -1,14 +1,10 @@
"use strict"; "use strict";
const _ = require("underscore"); import _ = require("underscore");
const tasks = require("./tasks"); import tasks from "./tasks";
// TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here. // TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here.
const TaskProcessor = function (task, outerProcessor, callback) { const TaskProcessor = function (task, outerProcessor, callback) {
if (!this) {
return new TaskProcessor(task);
}
const that = this; const that = this;
const createTaskWorker = () => tasks[task.type](task.params || {}, that); const createTaskWorker = () => tasks[task.type](task.params || {}, that);
const errors = []; const errors = [];
@ -65,7 +61,7 @@ const addFlag = (flags) => (flagName) => {
const containsFlag = (flags) => (flagName) => flags[flagName]; const containsFlag = (flags) => (flagName) => flags[flagName];
exports.processTask = (task, context, callback) => { export const processTask = (task, context, callback) => {
const errors = {}; const errors = {};
const warns = {}; const warns = {};
const infos = {}; const infos = {};

@ -1,8 +1,8 @@
"use strict"; "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}", { "process": () => glob("**/obj/{Debug,Release}/*.{dll,pdb,xml}", {
"cwd": processor.context.exported, "cwd": processor.context.exported,
"dot": true "dot": true

@ -1,6 +1,6 @@
"use strict"; "use strict";
module.exports = (params, processor) => { export = (params, processor) => {
const condition = (!params.owner || params.owner === processor.context.owner) const condition = (!params.owner || params.owner === processor.context.owner)
&& (!params.branch || params.branch === processor.context.branch || `refs/heads/${params.branch}` === processor.context.branch); && (!params.branch || params.branch === processor.context.branch || `refs/heads/${params.branch}` === processor.context.branch);
const task = (condition && params.task) || params.otherwise; const task = (condition && params.task) || params.otherwise;

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fse = require("fs-extra"); import fse = require("fs-extra");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const sourceFilePath = path.join(processor.context.exported, params.filename); const sourceFilePath = path.join(processor.context.exported, params.filename);
const targetFilePath = path.join(processor.context.release, params.filename); const targetFilePath = path.join(processor.context.release, params.filename);

@ -1,8 +1,8 @@
"use strict"; "use strict";
const glob = require("glob"); import glob = require("glob");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => glob(params.mask, { "process": () => glob(params.mask, {
"cwd": processor.context.exported, "cwd": processor.context.exported,
"dot": true "dot": true

@ -1,10 +1,10 @@
"use strict"; "use strict";
const fs = require("fs"); import fs = require("fs");
const path = require("path"); import path = require("path");
const cssnano = require("cssnano"); import cssnano = require("cssnano");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const filePath = path.join(processor.context.exported, params.filename); const filePath = path.join(processor.context.exported, params.filename);

@ -1,9 +1,9 @@
"use strict"; "use strict";
const glob = require("glob"); import glob = require("glob");
const flagDoneName = "cssnanoallDone"; const flagDoneName = "cssnanoallDone";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(flagDoneName)) { if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("cssnanoall task is executed more than once; this is probably a bug in your mbs.json"); processor.onWarn("cssnanoall task is executed more than once; this is probably a bug in your mbs.json");

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fse = require("fs-extra"); import fse = require("fs-extra");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const sourceFilePath = path.join(processor.context.exported, params.filename); const sourceFilePath = path.join(processor.context.exported, params.filename);

@ -1,8 +1,8 @@
"use strict"; "use strict";
const sequential = require("./sequential"); import sequential = require("./sequential");
module.exports = (params, processor) => sequential({ export = (params, processor) => sequential({
"tasks": [ "tasks": [
{ {
"name": "build", "name": "build",

@ -1,8 +1,8 @@
"use strict"; "use strict";
const sequential = require("./sequential"); import sequential = require("./sequential");
module.exports = (params, processor) => sequential({ export = (params, processor) => sequential({
"tasks": [ "tasks": [
{ {
"name": "build", "name": "build",

@ -1,8 +1,8 @@
"use strict"; "use strict";
const spawn = require("child_process").spawn; import { spawn } from "child_process";
const streamBuffers = require("stream-buffers"); import streamBuffers = require("stream-buffers");
const settings = require("../../settings"); import settings = require("../../settings");
const wrapBuilder = (builder, input, onExit) => { const wrapBuilder = (builder, input, onExit) => {
const resultBuffer = new streamBuffers.WritableStreamBuffer(); const resultBuffer = new streamBuffers.WritableStreamBuffer();
@ -26,7 +26,7 @@ const wrapBuilder = (builder, input, onExit) => {
builder.stdin.end(); builder.stdin.end();
}; };
const safeParseJson = (data) => { const safeParseJson = (data):any => {
try { try {
return { "parsed": JSON.parse(data) }; return { "parsed": JSON.parse(data) };
} catch (err) { } catch (err) {
@ -34,7 +34,7 @@ const safeParseJson = (data) => {
} }
}; };
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const input = JSON.stringify(params); const input = JSON.stringify(params);
const builder = spawn(settings.builderExecutable, [params.command]); const builder = spawn(settings.builderExecutable, [params.command]);

@ -1,6 +1,6 @@
"use strict"; "use strict";
const sequential = require("./sequential"); import sequential = require("./sequential");
const createTasks = function *(params) { const createTasks = function *(params) {
if (!params.skipMbsCheckStyle) { if (!params.skipMbsCheckStyle) {
@ -35,7 +35,7 @@ const createTasks = function *(params) {
}; };
}; };
module.exports = (params, processor) => { export = (params, processor) => {
const tasks = Array.from(createTasks(params)); const tasks = Array.from(createTasks(params));
return sequential({ tasks }, processor); return sequential({ tasks }, processor);

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const async = require("async"); import async = require("async");
const glob = require("glob"); import glob = require("glob");
const autoGeneratedMarker const autoGeneratedMarker
= "//------------------------------------------------------------------------------\n" = "//------------------------------------------------------------------------------\n"
@ -11,7 +11,7 @@ const autoGeneratedMarker
const flagDoneName = "dotnetcheckerDone"; const flagDoneName = "dotnetcheckerDone";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(flagDoneName)) { if (processor.context.containsFlag(flagDoneName)) {
return processor.done(); return processor.done();

@ -1,11 +1,11 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const _ = require("underscore"); import _ = require("underscore");
const settings = require("../../settings"); import settings = require("../../settings");
const dotnetbuilderwrapper = require("./dotnetbuilderwrapper"); import dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
module.exports = (params, processor) => { export = (params, processor) => {
if (settings.isCodeAnalysisUnsupported && params.forceCodeAnalysis) { if (settings.isCodeAnalysisUnsupported && params.forceCodeAnalysis) {
processor.onError("Code analysis is not supported"); processor.onError("Code analysis is not supported");

@ -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);

@ -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);

@ -1,8 +1,8 @@
"use strict"; "use strict";
const conditional = require("./conditional"); import conditional = require("./conditional");
module.exports = (params, processor) => conditional({ export = (params, processor) => conditional({
"branch": "master", "branch": "master",
"otherwise": { "otherwise": {
"name": "nuget-pack", "name": "nuget-pack",

@ -1,7 +1,7 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const sequential = require("./sequential"); import sequential = require("./sequential");
const postfixLength = 16; const postfixLength = 16;
const fourDigits = 10000; const fourDigits = 10000;
@ -15,7 +15,7 @@ const addPostfix = (version, params, processor) => {
return `${version}-r${processor.context.rev.substr(0, postfixLength)}`; return `${version}-r${processor.context.rev.substr(0, postfixLength)}`;
}; };
module.exports = (params, processor) => { export = (params, processor) => {
const date = new Date(); const date = new Date();
const major = params.major || "0"; const major = params.major || "0";
const minor = (date.getFullYear() * fourDigits) + ((date.getMonth() + 1) * twoDigits) + date.getDate(); const minor = (date.getFullYear() * fourDigits) + ((date.getMonth() + 1) * twoDigits) + date.getDate();

@ -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);

@ -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);

@ -1,10 +1,10 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const dotnetbuilderwrapper = require("./dotnetbuilderwrapper"); import dotnetbuilderwrapper = require("./dotnetbuilderwrapper");
const settings = require("../../settings"); import settings = require("../../settings");
module.exports = (params, processor) => dotnetbuilderwrapper({ export = (params, processor) => dotnetbuilderwrapper({
"ApiKey": settings.nugetApiKey, "ApiKey": settings.nugetApiKey,
"NugetHost": settings.nugetHost, "NugetHost": settings.nugetHost,
"Package": path.join(processor.context.exported, params.Package), "Package": path.join(processor.context.exported, params.Package),

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const sequential = require("./sequential"); import sequential = require("./sequential");
module.exports = (params, processor) => sequential({ export = (params, processor) => sequential({
"tasks": [ "tasks": [
{ {
"params": { "params": {

@ -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);

@ -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);

@ -1,9 +1,9 @@
"use strict"; "use strict";
const glob = require("glob"); import glob = require("glob");
const flagDoneName = "dotnetnunitallDone"; const flagDoneName = "dotnetnunitallDone";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(flagDoneName)) { if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json"); processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");

@ -1,10 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const Mustache = require("mustache"); import Mustache = require("mustache");
import sequential = require("./sequential");
const sequential = require("./sequential");
// eslint-disable-next-line no-sync // eslint-disable-next-line no-sync
const msbuildTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.template.msbuild"), { "encoding": "utf8" }); 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 // eslint-disable-next-line no-sync
const versionTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.template.version.aspx"), { "encoding": "utf8" }); const versionTemplate = fs.readFileSync(path.join(__dirname, "/dotnetpackwebapp.template.version.aspx"), { "encoding": "utf8" });
module.exports = (params, processor) => sequential({ export = (params, processor) => sequential({
"tasks": [ "tasks": [
{ {
"params": { "params": {

@ -1,10 +1,10 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const fs = require("fs"); import fs = require("fs");
const async = require("async"); import async = require("async");
const glob = require("glob"); import glob = require("glob");
const settings = require("../../settings"); import settings = require("../../settings");
const flagDoneName = "dotnetrewriterDone"; const flagDoneName = "dotnetrewriterDone";
@ -31,7 +31,7 @@ const processAssemblyInfo = (params, processor, appendInformationalVersion) => (
return cb(null, processInformationalVersion(processInternalsVisible(originalContent))); return cb(null, processInformationalVersion(processInternalsVisible(originalContent)));
}; };
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(flagDoneName)) { if (processor.context.containsFlag(flagDoneName)) {
return processor.done(); return processor.done();

@ -1,6 +1,6 @@
"use strict"; "use strict";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (params.error) { if (params.error) {
processor.onError(params.error); processor.onError(params.error);

@ -1,13 +1,13 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const CLIEngine = require("eslint").CLIEngine; import { CLIEngine } from "eslint";
const settings = require("../../settings"); import settings = require("../../settings");
const cli = new CLIEngine({ "configFile": settings.eslintBrowserConfig }); const cli = new CLIEngine({ "configFile": settings.eslintBrowserConfig });
const errorSeverity = 2; const errorSeverity = 2;
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const filePath = path.join(processor.context.exported, params.filename); const filePath = path.join(processor.context.exported, params.filename);
const result = cli.executeOnFiles([filePath]); const result = cli.executeOnFiles([filePath]);

@ -1,9 +1,9 @@
"use strict"; "use strict";
const glob = require("glob"); import glob = require("glob");
const flagDoneName = "eslintbrowserallDone"; const flagDoneName = "eslintbrowserallDone";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(flagDoneName)) { if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("eslintbrowserall task is executed more than once; this is probably a bug in your mbs.json"); processor.onWarn("eslintbrowserall task is executed more than once; this is probably a bug in your mbs.json");

@ -1,13 +1,17 @@
"use strict"; "use strict";
var tasks = {};
// Code taken from http://stackoverflow.com/a/17204293 // Code taken from http://stackoverflow.com/a/17204293
// eslint-disable-next-line no-sync // eslint-disable-next-line no-sync
require("fs").readdirSync(__dirname) require("fs").readdirSync(__dirname)
.forEach((file) => { .forEach((file) => {
if (file.match(/\.js$/) !== null && file !== "index.js") { if (file.match(/\.ts$/) !== null && file !== "index.ts") {
const name = file.replace(".js", ""); const name = file.replace(".ts", "");
// eslint-disable-next-line global-require // eslint-disable-next-line global-require
exports[name] = require(`./${file}`); tasks[name] = require(`./${file}`);
} }
}); });
export default tasks;

@ -1,3 +0,0 @@
"use strict";
module.exports = (params, processor) => ({ "process": () => processor.done() });

@ -0,0 +1,3 @@
"use strict";
export = (params, processor) => ({ "process": () => processor.done() });

@ -1,8 +1,8 @@
"use strict"; "use strict";
const sequential = require("./sequential"); import sequential = require("./sequential");
module.exports = (params, processor) => sequential({ export = (params, processor) => sequential({
"tasks": [ "tasks": [
{ {
"params": { "excludeFiles": params.eslintExcludeFiles }, "params": { "excludeFiles": params.eslintExcludeFiles },

@ -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()) });

@ -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()) });

@ -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()) });

@ -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()) });

@ -1,10 +1,10 @@
"use strict"; "use strict";
const fs = require("fs"); import fs = require("fs");
const path = require("path"); import path = require("path");
const UglifyJS = require("uglify-js"); import UglifyJS = require("uglify-js");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const filePath = path.normalize(path.join(processor.context.exported, params.filename)); const filePath = path.normalize(path.join(processor.context.exported, params.filename));
const result = UglifyJS.minify(filePath); const result = UglifyJS.minify(filePath);

@ -1,10 +1,10 @@
"use strict"; "use strict";
const glob = require("glob"); import glob = require("glob");
const doneFlagName = "uglifyjsallDone"; const doneFlagName = "uglifyjsallDone";
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
if (processor.context.containsFlag(doneFlagName)) { if (processor.context.containsFlag(doneFlagName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json"); processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");

@ -1,9 +1,9 @@
"use strict"; "use strict";
const fs = require("fs"); import fs = require("fs");
const path = require("path"); import path = require("path");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const filePath = path.join(processor.context.exported, params.filename); const filePath = path.join(processor.context.exported, params.filename);

@ -1,10 +1,10 @@
"use strict"; "use strict";
const fs = require("fs"); import fs = require("fs");
const path = require("path"); import path = require("path");
const Archiver = require("archiver"); import Archiver = require("archiver");
module.exports = (params, processor) => ({ export = (params, processor) => ({
"process": () => { "process": () => {
const sourceDirectoryPath = path.normalize(path.join(processor.context.exported, String(params.directory || ""))); const sourceDirectoryPath = path.normalize(path.join(processor.context.exported, String(params.directory || "")));
const targetArchivePath = path.normalize(path.join(processor.context.release, params.archive)); const targetArchivePath = path.normalize(path.join(processor.context.release, params.archive));

@ -130,7 +130,8 @@
} }
}, },
"devDependencies": { "devDependencies": {
"eslint": "^3.15.0", "@types/node": "^7.0.5",
"eslint-plugin-fp": "^2.3.0" "tslint": "^4.4.2",
"typescript": "^2.1.6"
} }
} }

@ -1,6 +1,6 @@
"use strict"; "use strict";
module.exports = (req, res) => { export = (req, res) => {
const options = { const options = {
"branch": `/refs/heads/${req.params.branch}`, "branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch, "branchName": req.params.branch,

@ -1,9 +0,0 @@
"use strict";
exports.index = (req, res) => res.render("index", { "title": `Express<br/>\r\n${req}` });
exports.postreceive = require("./postreceive");
exports.manual = require("./manual");
exports.status = require("./status");
exports.artifact = require("./artifact");
exports.release = require("./release");

@ -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<br/>\r\n${req}` });
export { index, postreceive, manual, status, artifact, release };

@ -1,11 +1,11 @@
"use strict"; "use strict";
const _ = require("underscore"); import _ = require("underscore");
const builder = require("../lib/builder"); 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, { const options = _.extend(req.body, {
"app": req.app, "app": req.app,
"url": `https://pos-github.payonline.ru/${req.body.owner}/${req.body.reponame}` "url": `https://pos-github.payonline.ru/${req.body.owner}/${req.body.reponame}`

@ -1,7 +1,7 @@
"use strict"; "use strict";
const builder = require("../lib/builder"); import builder = require("../lib/builder");
const commenter = require("../lib/commenter"); import commenter = require("../lib/commenter");
const getBranchDescription = (options) => `${options.owner}/${options.reponame}:${options.branchname || options.branch}`; 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)) { if (!req.body || (!req.body.payload && !req.body.repository)) {
return res.end(); return res.end();
} }

@ -1,9 +1,9 @@
"use strict"; "use strict";
const path = require("path"); import path = require("path");
const Archiver = require("archiver"); import Archiver = require("archiver");
const reportProcessor = require("../lib/report-processor"); import reportProcessor = require("../lib/report-processor");
const getDatePart = (report) => { const getDatePart = (report) => {
if (!report.date) { if (!report.date) {
@ -23,7 +23,7 @@ const getDatePart = (report) => {
return `${year}.${month}.${day}.${hours}.${minutes}.${seconds}`; return `${year}.${month}.${day}.${hours}.${minutes}.${seconds}`;
}; };
module.exports = (req, res, next) => { export = (req, res, next) => {
const options = { const options = {
"branch": `/refs/heads/${req.params.branch}`, "branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch, "branchName": req.params.branch,

@ -1,8 +1,8 @@
"use strict"; "use strict";
const url = require("url"); import url = require("url");
const _ = require("underscore"); import _ = require("underscore");
const statusProcessor = require("../lib/status-processor"); import statusProcessor = require("../lib/status-processor");
const parseOptionsFromReferer = (path, callback) => { const parseOptionsFromReferer = (path, callback) => {
const pathParts = path.split("/").filter((value) => value); const pathParts = path.split("/").filter((value) => value);
@ -39,7 +39,7 @@ const createShowReport = (res) => (err, inputOptions) => {
res.render("status", options); res.render("status", options);
}; };
exports.image = (req, res) => { export const image = (req, res) => {
const getAdditionalOptions = (err, options) => { const getAdditionalOptions = (err, options) => {
if (err === "ReportFileNotFound") { if (err === "ReportFileNotFound") {
return { "status": "Building" }; return { "status": "Building" };
@ -98,7 +98,7 @@ exports.image = (req, res) => {
}); });
}; };
exports.page = (req, res) => { export const page = (req, res) => {
const options = { const options = {
"branch": `/refs/heads/${req.params.branch}`, "branch": `/refs/heads/${req.params.branch}`,
"branchName": req.params.branch, "branchName": req.params.branch,
@ -110,9 +110,9 @@ exports.page = (req, res) => {
statusProcessor.getReport(req.app, options, createShowReport(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) { if (err) {
return createShowReport(err, options); return createShowReport(res)(err, options);
} }
return statusProcessor.getReport(req.app, options, createShowReport(res)); return statusProcessor.getReport(req.app, options, createShowReport(res));

@ -12,8 +12,10 @@ const createGithub = () => new GitHubApi({
"version": "3.0.0" "version": "3.0.0"
}); });
module.exports = { export = {
"builderExecutable": "../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe", "builderExecutable": "../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe",
"codeSigningKeyFile": null,
"codeSigningPublicKey": null,
"createGithub": (repoOwner) => { "createGithub": (repoOwner) => {
const github = createGithub(); const github = createGithub();
@ -36,6 +38,7 @@ module.exports = {
"eslintBrowserConfig": "settings-eslint-browser.json", "eslintBrowserConfig": "settings-eslint-browser.json",
"gitpath": "M:/g", "gitpath": "M:/g",
"ignoreCodeAnalysisByDefault": true, "ignoreCodeAnalysisByDefault": true,
"isCodeAnalysisUnsupported": false,
"nugetApiKey": "*** NUGET API KEY ***", "nugetApiKey": "*** NUGET API KEY ***",
"nugetHost": "https://*** NUGET HOST ***/", "nugetHost": "https://*** NUGET HOST ***/",
"port": 3000, "port": 3000,

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es6",
"typeRoots": [
"node_modules/@types"
]
}
}
Loading…
Cancel
Save