Implemented subtasks type checks

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 7 years ago
parent 65f55220b2
commit dde7044e18
  1. 22
      BuildServer/lib/task-processor.ts
  2. 8
      BuildServer/lib/tasks/cleanupafterdotnetbuild.ts
  3. 5
      BuildServer/lib/tasks/conditional.ts
  4. 2
      BuildServer/lib/tasks/copy.ts
  5. 8
      BuildServer/lib/tasks/copyglob.ts
  6. 2
      BuildServer/lib/tasks/cssnano.ts
  7. 8
      BuildServer/lib/tasks/cssnanoall.ts
  8. 2
      BuildServer/lib/tasks/deletefromcode.ts
  9. 24
      BuildServer/lib/tasks/dotnetbuild.ts
  10. 28
      BuildServer/lib/tasks/dotnetbuildandtest.ts
  11. 2
      BuildServer/lib/tasks/dotnetbuilderwrapper.ts
  12. 53
      BuildServer/lib/tasks/dotnetbuildwithoutcleanup.ts
  13. 8
      BuildServer/lib/tasks/dotnetcheckstyle.ts
  14. 24
      BuildServer/lib/tasks/dotnetcompile.ts
  15. 14
      BuildServer/lib/tasks/dotnetnugetpack.ts
  16. 18
      BuildServer/lib/tasks/dotnetnugetprocess.ts
  17. 17
      BuildServer/lib/tasks/dotnetnugetprocessinternal.ts
  18. 14
      BuildServer/lib/tasks/dotnetnugetpush.ts
  19. 4
      BuildServer/lib/tasks/dotnetnugetpushonly.ts
  20. 4
      BuildServer/lib/tasks/dotnetnugetrestore.ts
  21. 4
      BuildServer/lib/tasks/dotnetnunit.ts
  22. 8
      BuildServer/lib/tasks/dotnetnunitall.ts
  23. 35
      BuildServer/lib/tasks/dotnetpackwebapp.ts
  24. 4
      BuildServer/lib/tasks/dotnetrewrite.ts
  25. 2
      BuildServer/lib/tasks/echo.ts
  26. 2
      BuildServer/lib/tasks/eslintbrowser.ts
  27. 8
      BuildServer/lib/tasks/eslintbrowserall.ts
  28. 2
      BuildServer/lib/tasks/noop.ts
  29. 35
      BuildServer/lib/tasks/packform.ts
  30. 2
      BuildServer/lib/tasks/parallel.ts
  31. 2
      BuildServer/lib/tasks/sequential.ts
  32. 2
      BuildServer/lib/tasks/uglifyjs.ts
  33. 8
      BuildServer/lib/tasks/uglifyjsall.ts
  34. 2
      BuildServer/lib/tasks/writefile.ts
  35. 2
      BuildServer/lib/tasks/zip.ts
  36. 2
      BuildServer/lib/types/dotnetbuilder-types.ts
  37. 6
      BuildServer/lib/types/task-processor-types.ts

@ -9,15 +9,20 @@ interface IFlags {
const isExternalTask = (task: TaskInfo): task is TaskInfoExternal => (task as TaskInfoExternal).type !== undefined;
let tasksCount = 0;
// TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here.
const createTaskProcessor = (task: TaskInfo, outerProcessor: TaskProcessorCore, callback: TaskProcessorCallback) => {
const taskId = tasksCount++;
const errors: string[] = [];
const name = task.name || (isExternalTask(task) ? task.type : null);
const nameWithId = String(name || "") + "#" + taskId;
const getOuterPrefix = (prefix?: string) => {
if (task.name && prefix) {
return `${task.name}/${prefix}`;
if (!prefix) {
return nameWithId;
}
return String(task.name || "") + String(prefix || "");
return `${nameWithId}/${prefix}`;
};
const onError = (message: string, prefix?: string) => {
errors.push(message);
@ -25,15 +30,22 @@ const createTaskProcessor = (task: TaskInfo, outerProcessor: TaskProcessorCore,
};
const onWarn = (message: string, prefix?: string) => outerProcessor.onWarn(message, getOuterPrefix(prefix));
const onInfo = (message: string, prefix?: string) => outerProcessor.onInfo(message, getOuterPrefix(prefix));
const taskWithParameters = isExternalTask(task) ? tasks[task.type](task.params || {}) : task.task;
let result: TaskProcessor;
result = {
context: outerProcessor.context,
done: () => callback(errors.join("\r\n")),
done: () => {
onInfo(`Completed task ${nameWithId}`);
callback(errors.join("\r\n"));
},
onError,
onWarn,
onInfo,
process: () => (isExternalTask(task) ? tasks[task.type](task.params || {}, result) : task.task)(),
process: () => {
onInfo(`Starting task ${nameWithId}`);
taskWithParameters(result)();
},
processTask: (innerTask, innerCallback) => createTaskProcessor(innerTask, result, innerCallback).process(),
settings: outerProcessor.settings,
};

@ -3,9 +3,10 @@
import * as glob from "glob";
import { GenericTask } from "../types";
import deletefromcode from "./deletefromcode";
import parallel from "./parallel";
export default ((_params, processor) => () => glob("**/obj/{Debug,Release}/*.{dll,pdb,xml}", {
export default ((_params) => (processor) => () => glob("**/obj/{Debug,Release}/*.{dll,pdb,xml}", {
cwd: processor.context.exported,
dot: true,
}, (err, files) => {
@ -22,8 +23,7 @@ export default ((_params, processor) => () => glob("**/obj/{Debug,Release}/*.{dl
return parallel({
tasks: files.map((file) => ({
name: file,
params: { filename: file },
type: "deletefromcode",
task: deletefromcode({ filename: file }),
})),
}, processor)();
})(processor)();
})) as GenericTask<{}>;

@ -1,6 +1,7 @@
"use strict";
import { GenericTask, TaskInfo } from "../types";
import noop from "./noop";
interface IParameters {
readonly owner?: string;
@ -9,10 +10,10 @@ interface IParameters {
readonly otherwise?: TaskInfo;
}
export default ((params, processor) => {
export default ((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;
return () => processor.processTask(task || { type: "noop", params: {} }, processor.done);
return () => processor.processTask(task || { task: noop({}) }, processor.done);
}) as GenericTask<IParameters>;

@ -5,7 +5,7 @@ import { join } from "path";
import { GenericTask } from "../types";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const sourceFilePath = join(processor.context.exported, params.filename);
const targetFilePath = join(processor.context.release, params.filename);

@ -3,9 +3,10 @@
import * as glob from "glob";
import { GenericTask } from "../types";
import copy from "./copy";
import parallel from "./parallel";
export default ((params, processor) => () => glob(params.mask, {
export default ((params) => (processor) => () => glob(params.mask, {
cwd: processor.context.exported,
dot: true,
}, (err, files) => {
@ -22,8 +23,7 @@ export default ((params, processor) => () => glob(params.mask, {
return parallel({
tasks: files.map((file) => ({
name: file,
params: { filename: file },
type: "copy",
task: copy({ filename: file }),
})),
}, processor)();
})(processor)();
})) as GenericTask<{ readonly mask: string }>;

@ -6,7 +6,7 @@ import { join } from "path";
import { GenericTask } from "../types";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const filePath = join(processor.context.exported, params.filename);
readFile(filePath, "utf8", (readErr, css) => {

@ -3,11 +3,12 @@
import * as glob from "glob";
import { GenericTask } from "../types";
import cssnano from "./cssnano";
import parallel from "./parallel";
const flagDoneName = "cssnanoallDone";
export default ((_params, processor) => () => {
export default ((_params) => (processor) => () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("cssnanoall task is executed more than once; this is probably a bug in your mbs.json");
}
@ -27,9 +28,8 @@ export default ((_params, processor) => () => {
return parallel({
tasks: files.map((file) => ({
name: file,
params: { filename: file },
type: "cssnano",
task: cssnano({ filename: file }),
})),
}, processor)();
})(processor)();
});
}) as GenericTask<{}>;

@ -5,7 +5,7 @@ import { join } from "path";
import { GenericTask } from "../types";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const sourceFilePath = join(processor.context.exported, params.filename);
processor.onInfo(`Deleting ${sourceFilePath}`);

@ -1,19 +1,31 @@
"use strict";
import { GenericTask } from "../types";
import cleanupafterdotnetbuild from "./cleanupafterdotnetbuild";
import dotnetbuildwithoutcleanup from "./dotnetbuildwithoutcleanup";
import sequential from "./sequential";
export default ((params, processor) => sequential({
interface IDotNetBuildParameters {
readonly skipMbsCheckStyle?: boolean;
readonly forceCodeAnalysis?: boolean;
readonly ignoreCodeAnalysis?: boolean;
readonly skipCodeAnalysis: boolean;
readonly skipCodeSigning?: boolean;
readonly skipNugetRestore?: boolean;
readonly configuration: string;
readonly solution: string;
readonly ignoreCodeStyle: boolean;
}
export default ((params) => (processor) => sequential({
tasks: [
{
name: "build",
params,
type: "dotnetbuildwithoutcleanup",
task: dotnetbuildwithoutcleanup(params),
},
{
name: "cleanup",
params: {},
type: "cleanupafterdotnetbuild",
task: cleanupafterdotnetbuild({}),
},
],
}, processor)) as GenericTask<{}>;
})(processor)) as GenericTask<IDotNetBuildParameters>;

@ -1,24 +1,36 @@
"use strict";
import { GenericTask } from "../types";
import cleanupafterdotnetbuild from "./cleanupafterdotnetbuild";
import dotnetbuildwithoutcleanup from "./dotnetbuildwithoutcleanup";
import dotnetnunitall from "./dotnetnunitall";
import sequential from "./sequential";
export default ((params, processor) => sequential({
interface IDotNetBuildAndTestParameters {
readonly skipMbsCheckStyle?: boolean;
readonly forceCodeAnalysis?: boolean;
readonly ignoreCodeAnalysis?: boolean;
readonly skipCodeAnalysis: boolean;
readonly skipCodeSigning?: boolean;
readonly skipNugetRestore?: boolean;
readonly configuration: string;
readonly solution: string;
readonly ignoreCodeStyle: boolean;
}
export default ((params) => (processor) => sequential({
tasks: [
{
name: "build",
params,
type: "dotnetbuildwithoutcleanup",
task: dotnetbuildwithoutcleanup(params),
},
{
name: "test",
params,
type: "dotnetnunitall",
task: dotnetnunitall(params),
},
{
name: "cleanup",
params: {},
type: "cleanupafterdotnetbuild",
task: cleanupafterdotnetbuild({}),
},
],
}, processor)) as GenericTask<{}>;
})(processor)) as GenericTask<IDotNetBuildAndTestParameters>;

@ -52,7 +52,7 @@ const wrapBuilder = (builder: ChildProcess, input: string, onExit: (code: number
}).catch((err) => onExit(0, "", err));
};
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const input = JSON.stringify(params);
const builder = spawn(processor.settings.builderExecutable, [params.command]);

@ -1,53 +1,54 @@
"use strict";
import { GenericTask } from "../types";
import { GenericTask, TaskInfo } from "../types";
import dotnetcheckstyle from "./dotnetcheckstyle";
import dotnetcompile from "./dotnetcompile";
import dotnetnugetrestore from "./dotnetnugetrestore";
import dotnetrewrite from "./dotnetrewrite";
import sequential from "./sequential";
interface IParameters {
interface IDotNetBuilderWithoutCleanupParameters {
readonly skipMbsCheckStyle?: boolean;
readonly forceCodeAnalysis?: boolean;
readonly ignoreCodeAnalysis?: boolean;
readonly skipCodeAnalysis: boolean;
readonly skipCodeSigning?: boolean;
readonly skipNugetRestore?: boolean;
readonly configuration: string;
readonly solution: string;
readonly ignoreCodeStyle: boolean;
}
const createTasks = function *(params: IParameters) {
const createTasks = function *(params: IDotNetBuilderWithoutCleanupParameters) {
if (!params.skipMbsCheckStyle) {
yield {
params,
type: "dotnetcheckstyle",
};
name: "dotnetcheckstyle",
task: dotnetcheckstyle(params),
} as TaskInfo;
}
yield {
params,
type: "dotnetrewrite",
};
name: "dotnetrewrite",
task: dotnetrewrite(params),
} as TaskInfo;
if (!params.skipNugetRestore) {
yield {
params,
type: "dotnetnugetrestore",
};
name: "dotnetnugetrestore",
task: dotnetnugetrestore(params),
} as TaskInfo;
}
yield {
params: {
configuration: params.configuration,
forceCodeAnalysis: params.forceCodeAnalysis,
ignoreCodeAnalysis: params.ignoreCodeAnalysis,
skipCodeSigning: params.skipCodeSigning,
solution: params.solution,
name: "dotnetcompile",
task: dotnetcompile({
...params,
target: "Rebuild",
},
type: "dotnetcompile",
};
}),
} as TaskInfo;
};
export default ((params, processor) => {
const tasks = Array.from(createTasks(params));
return sequential({ tasks }, processor);
}) as GenericTask<IParameters>;
export default ((params) => (processor) => {
const tasks = Array.from(createTasks(params)) as TaskInfo[];
return sequential({ tasks })(processor);
}) as GenericTask<IDotNetBuilderWithoutCleanupParameters>;

@ -7,8 +7,8 @@ import { join } from "path";
import { GenericTask } from "../types";
interface IParameters {
ignoreCodeStyle: boolean;
interface IDotNetCheckStyleParameters {
readonly ignoreCodeStyle: boolean;
}
const autoGeneratedMarker
@ -17,7 +17,7 @@ const autoGeneratedMarker
const flagDoneName = "dotnetcheckerDone";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (processor.context.containsFlag(flagDoneName)) {
return processor.done();
}
@ -77,4 +77,4 @@ export default ((params, processor) => () => {
},
)), processor.done);
});
}) as GenericTask<IParameters>;
}) as GenericTask<IDotNetCheckStyleParameters>;

@ -5,18 +5,18 @@ import { join } from "path";
import { BuilderCompileRequest, GenericTask } from "../types";
import dotnetbuilderwrapper from "./dotnetbuilderwrapper";
interface IParameters {
configuration: string;
overrideOutputDirectory: string;
skipCodeAnalysis: boolean;
solution: string;
target: string;
forceCodeAnalysis?: boolean;
skipCodeSigning?: boolean;
ignoreCodeAnalysis: boolean;
interface IDotNetCompileParameters {
readonly configuration: string;
readonly overrideOutputDirectory?: string;
readonly skipCodeAnalysis: boolean;
readonly solution: string;
readonly target: string;
readonly forceCodeAnalysis?: boolean;
readonly skipCodeSigning?: boolean;
readonly ignoreCodeAnalysis?: boolean;
}
export default ((params, processor) => {
export default ((params) => (processor) => {
if (processor.settings.isCodeAnalysisUnsupported && params.forceCodeAnalysis) {
processor.onError("Code analysis is not supported");
@ -45,5 +45,5 @@ export default ((params, processor) => {
...getAdditionalSigningParameters(),
};
return dotnetbuilderwrapper(compileParams, processor);
}) as GenericTask<IParameters>;
return dotnetbuilderwrapper(compileParams)(processor);
}) as GenericTask<IDotNetCompileParameters>;

@ -1,17 +1,21 @@
"use strict";
import { GenericTask } from "../types";
import copy from "./copy";
import dotnetnugetprocessinternal from "./dotnetnugetprocessinternal";
interface IParameters {
interface IDotNetNuGetPackParameters {
readonly withoutCommitSha?: boolean;
readonly major?: string;
readonly version?: string;
readonly name: string;
readonly nuspec: string;
}
export default ((params, processor) => dotnetnugetprocessinternal({
export default ((params) => (processor) => dotnetnugetprocessinternal({
...params,
getFinalTask: (nupkg) => ({
params: { filename: nupkg },
type: "copy",
name: "copynupkg",
task: copy({ filename: nupkg }),
}),
}, processor)) as GenericTask<IParameters>;
})(processor)) as GenericTask<IDotNetNuGetPackParameters>;

@ -2,8 +2,10 @@
import { GenericTask } from "../types";
import conditional from "./conditional";
import dotnetnugetpack from "./dotnetnugetpack";
import dotnetnugetpush from "./dotnetnugetpush";
interface IParameters {
interface IDotNetNuGetPushParameters {
readonly major: string;
readonly nuspecName: string;
readonly version: string;
@ -11,29 +13,27 @@ interface IParameters {
readonly masterRepoOwner: string;
}
export default ((params, processor) => conditional({
export default ((params) => (processor) => conditional({
branch: "master",
otherwise: {
name: "nuget-pack",
params: {
task: dotnetnugetpack({
major: params.major,
name: params.nuspecName,
nuspec: `${params.nuspecName}.nuspec`,
version: params.version,
withoutCommitSha: params.withoutCommitSha,
},
type: "dotnetnugetpack",
}),
},
owner: params.masterRepoOwner,
task: {
name: "nuget-push",
params: {
task: dotnetnugetpush({
major: params.major,
name: params.nuspecName,
nuspec: `${params.nuspecName}.nuspec`,
version: params.version,
withoutCommitSha: params.withoutCommitSha,
},
type: "dotnetnugetpush",
}),
},
}, processor)) as GenericTask<IParameters>;
})(processor)) as GenericTask<IDotNetNuGetPushParameters>;

@ -3,9 +3,10 @@
import { join } from "path";
import { GenericTask, TaskInfo, TaskProcessor } from "../types";
import dotnetbuilderwrapper from "./dotnetbuilderwrapper";
import sequential from "./sequential";
interface IParameters {
interface IDotNetNuGetProcessInternalParameters {
readonly withoutCommitSha?: boolean;
readonly major?: string;
readonly version?: string;
@ -18,7 +19,7 @@ const postfixLength = 16;
const fourDigits = 10000;
const twoDigits = 100;
const addPostfix = (version: string, params: IParameters, processor: TaskProcessor) => {
const addPostfix = (version: string, params: IDotNetNuGetProcessInternalParameters, processor: TaskProcessor) => {
if (params.withoutCommitSha) {
return version;
}
@ -26,7 +27,7 @@ const addPostfix = (version: string, params: IParameters, processor: TaskProcess
return `${version}-r${processor.context.rev.substr(0, postfixLength)}`;
};
export default ((params, processor) => {
export default ((params) => (processor) => {
const date = new Date();
const major = params.major || "0";
const minor = (date.getFullYear() * fourDigits) + ((date.getMonth() + 1) * twoDigits) + date.getDate();
@ -37,16 +38,16 @@ export default ((params, processor) => {
return sequential({
tasks: [
{
params: {
name: "pack",
task: dotnetbuilderwrapper({
BaseDirectory: processor.context.exported,
OutputDirectory: processor.context.exported,
SpecPath: join(processor.context.exported, params.nuspec),
Version: version,
command: "nugetpack",
},
type: "dotnetbuilderwrapper",
}),
},
params.getFinalTask(nupkg),
],
}, processor);
}) as GenericTask<IParameters>;
})(processor);
}) as GenericTask<IDotNetNuGetProcessInternalParameters>;

@ -2,16 +2,20 @@
import { GenericTask } from "../types";
import dotnetnugetprocessinternal from "./dotnetnugetprocessinternal";
import dotnetnugetpushonly from "./dotnetnugetpushonly";
interface IParameters {
interface IDotNetNuGetPushParameters {
readonly withoutCommitSha?: boolean;
readonly major?: string;
readonly version?: string;
readonly name: string;
readonly nuspec: string;
}
export default ((params, processor) => dotnetnugetprocessinternal({
export default ((params) => (processor) => dotnetnugetprocessinternal({
...params,
getFinalTask: (nupkg) => ({
params: { Package: nupkg },
type: "dotnetnugetpushonly",
name: "pushonly",
task: dotnetnugetpushonly({ Package: nupkg }),
}),
}, processor)) as GenericTask<IParameters>;
})(processor)) as GenericTask<IDotNetNuGetPushParameters>;

@ -5,9 +5,9 @@ import { join } from "path";
import { GenericTask } from "../types";
import dotnetbuilderwrapper from "./dotnetbuilderwrapper";
export default ((params, processor) => dotnetbuilderwrapper({
export default ((params) => (processor) => dotnetbuilderwrapper({
ApiKey: processor.settings.nugetApiKey,
NugetHost: processor.settings.nugetHost,
Package: join(processor.context.exported, params.Package),
command: "nugetpush",
}, processor)) as GenericTask<{ readonly Package: string }>;
})(processor)) as GenericTask<{ readonly Package: string }>;

@ -5,8 +5,8 @@ import { join } from "path";
import { GenericTask } from "../types";
import dotnetbuilderwrapper from "./dotnetbuilderwrapper";
export default ((params, processor) => dotnetbuilderwrapper({
export default ((params) => (processor) => dotnetbuilderwrapper({
BaseDirectory: processor.context.exported,
SolutionPath: join(processor.context.exported, params.solution),
command: "nugetrestore",
}, processor)) as GenericTask<{ readonly solution: string }>;
})(processor)) as GenericTask<{ readonly solution: string }>;

@ -5,7 +5,7 @@ import { join } from "path";
import { GenericTask } from "../types";
import dotNetBuilderWrapper from "./dotnetbuilderwrapper";
export default ((params, processor) => dotNetBuilderWrapper({
export default ((params) => (processor) => dotNetBuilderWrapper({
TestLibraryPath: join(processor.context.exported, params.assembly),
command: "nunit",
}, processor)) as GenericTask<{ readonly assembly: string }>;
})(processor)) as GenericTask<{ readonly assembly: string }>;

@ -3,12 +3,13 @@
import * as glob from "glob";
import { GenericTask } from "../types";
import dotnetnunit from "./dotnetnunit";
import parallel from "./parallel";
import sequential from "./sequential";
const flagDoneName = "dotnetnunitallDone";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");
}
@ -36,9 +37,8 @@ export default ((params, processor) => () => {
return task({
tasks: files.map((file) => ({
name: file,
params: { assembly: file },
type: "dotnetnunit",
task: dotnetnunit({ assembly: file }),
})),
}, processor)();
})(processor)();
});
}) as GenericTask<{ readonly preventParallelTests?: boolean }>;

@ -5,11 +5,14 @@ import { render } from "mustache";
import { join } from "path";
import { GenericTask } from "../types";
import dotnetcompile from "./dotnetcompile";
import sequential from "./sequential";
import writefile from "./writefile";
interface IParameters {
readonly configuration: string;
readonly isCodeAnalysisUnsupported: boolean;
readonly skipCodeAnalysis: boolean;
readonly skipCodeSigning: boolean;
}
@ -17,39 +20,37 @@ const msbuildTemplate = readFileSync(join(__dirname, "/dotnetpackwebapp.template
const deployTemplate = readFileSync(join(__dirname, "/dotnetpackwebapp.template.bat"), { encoding: "utf8" });
const versionTemplate = readFileSync(join(__dirname, "/dotnetpackwebapp.template.version.aspx"), { encoding: "utf8" });
export default ((params, processor) => sequential({
export default ((params) => (processor) => sequential({
tasks: [
{
params: {
name: "writemakepackage",
task: writefile({
data: render(msbuildTemplate, params),
filename: "MakePackage.msbuild",
},
type: "writefile",
}),
},
{
params: {
name: "writedeploy",
task: writefile({
data: render(deployTemplate, params),
filename: "Deploy.bat",
},
type: "writefile",
}),
},
{
params: {
name: "writeversion",
task: writefile({
data: render(versionTemplate, params),
filename: "version.aspx",
},
type: "writefile",
}),
},
{
params: {
configuration: params.configuration,
isCodeAnalysisUnsupported: params.isCodeAnalysisUnsupported,
name: "compile",
task: dotnetcompile({
...params,
overrideOutputDirectory: processor.context.release,
skipCodeSigning: params.skipCodeSigning,
solution: "MakePackage.msbuild",
target: "Package",
},
type: "dotnetcompile",
}),
},
],
}, processor)) as GenericTask<IParameters>;
})(processor)) as GenericTask<IParameters>;

@ -8,7 +8,7 @@ import { join } from "path";
import { GenericTask, TaskProcessor } from "../types";
interface IParameters {
readonly skipCodeSigning: boolean;
readonly skipCodeSigning?: boolean;
}
type Callback = (err?: any, result?: string) => void;
@ -38,7 +38,7 @@ const processAssemblyInfo = (params: IParameters, processor: TaskProcessor, appe
return cb(null, processInformationalVersion(processInternalsVisible(originalContent)));
};
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (processor.context.containsFlag(flagDoneName)) {
return processor.done();
}

@ -8,7 +8,7 @@ interface IParameters {
readonly info: string;
}
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (params.error) {
processor.onError(params.error);
}

@ -7,7 +7,7 @@ import { GenericTask } from "../types";
const errorSeverity = 2;
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (processor.settings.isCodeAnalysisUnsupported) {
return;
}

@ -3,11 +3,12 @@
import * as glob from "glob";
import { GenericTask } from "../types";
import eslintbrowser from "./eslintbrowser";
import parallel from "./parallel";
const flagDoneName = "eslintbrowserallDone";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
if (processor.context.containsFlag(flagDoneName)) {
processor.onWarn("eslintbrowserall task is executed more than once; this is probably a bug in your mbs.json");
}
@ -29,9 +30,8 @@ export default ((params, processor) => () => {
return parallel({
tasks: files.filter((file) => !excludeFiles.includes(file)).map((file) => ({
name: file,
params: { filename: file },
type: "eslintbrowser",
task: eslintbrowser({ filename: file }),
})),
}, processor)();
})(processor)();
});
}) as GenericTask<{ readonly excludeFiles?: string[] }>;

@ -2,4 +2,4 @@
import { GenericTask } from "../types";
export default ((_params, processor) => processor.done) as GenericTask<{}>;
export default ((_params) => (processor) => processor.done) as GenericTask<{}>;

@ -1,39 +1,44 @@
"use strict";
import { GenericTask } from "../types";
import cssnanoall from "./cssnanoall";
import eslintbrowserall from "./eslintbrowserall";
import sequential from "./sequential";
import uglifyjsall from "./uglifyjsall";
import writefile from "./writefile";
import zip from "./zip";
interface IParameters {
readonly eslintExcludeFiles: boolean;
readonly eslintExcludeFiles?: string[];
}
export default ((params, processor) => sequential({
export default ((params) => (processor) => sequential({
tasks: [
{
params: { excludeFiles: params.eslintExcludeFiles },
type: "eslintbrowserall",
name: "eslint",
task: eslintbrowserall({ excludeFiles: params.eslintExcludeFiles }),
},
{
params: { },
type: "uglifyjsall",
name: "uglifyjs",
task: uglifyjsall({}),
},
{
params: { },
type: "cssnanoall",
name: "cssnano",
task: cssnanoall({}),
},
{
params: {
name: "writeversion",
task: writefile({
data: processor.context.versionInfo,
filename: "version.txt",
},
type: "writefile",
}),
},
{
params: {
name: "zip",
task: zip({
archive: `${processor.context.reponame}.zip`,
directory: "",
},
type: "zip",
}),
},
],
}, processor)) as GenericTask<IParameters>;
})(processor)) as GenericTask<IParameters>;

@ -10,4 +10,4 @@ interface IParameters {
const mapper = (processor: TaskProcessor) => (task: TaskInfo) => (callback: TaskProcessorCallback) => processor.processTask(task, callback);
export default ((params, processor) => () => parallel(params.tasks.map(mapper(processor)), processor.done)) as GenericTask<IParameters>;
export default ((params) => (processor) => () => parallel(params.tasks.map(mapper(processor)), processor.done)) as GenericTask<IParameters>;

@ -10,4 +10,4 @@ interface IParameters {
const mapper = (processor: TaskProcessor) => (task: TaskInfo) => (callback: TaskProcessorCallback) => processor.processTask(task, callback);
export default ((params, processor) => () => series(params.tasks.map(mapper(processor)), processor.done)) as GenericTask<IParameters>;
export default ((params) => (processor) => () => series(params.tasks.map(mapper(processor)), processor.done)) as GenericTask<IParameters>;

@ -6,7 +6,7 @@ import { minify } from "uglify-js";
import { GenericTask } from "../types";
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const filePath = normalize(join(processor.context.exported, params.filename));
const result = minify(filePath);

@ -4,10 +4,11 @@ import * as glob from "glob";
import { GenericTask } from "../types";
import parallel from "./parallel";
import uglifyjs from "./uglifyjs";
const doneFlagName = "uglifyjsallDone";
export default ((_params, processor) => () => {
export default ((_params) => (processor) => () => {
if (processor.context.containsFlag(doneFlagName)) {
processor.onWarn("dotnetnunitall task is executed more than once; this is probably a bug in your mbs.json");
}
@ -27,9 +28,8 @@ export default ((_params, processor) => () => {
return parallel({
tasks: files.map((file) => ({
name: file,
params: { filename: file },
type: "uglifyjs",
task: uglifyjs({ filename: file }),
})),
}, processor)();
})(processor)();
});
}) as GenericTask<{}>;

@ -10,7 +10,7 @@ interface IParameters {
readonly filename: string;
}
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const filePath = join(processor.context.exported, params.filename);
processor.onInfo(`Writing to ${filePath}`);

@ -11,7 +11,7 @@ interface IParameters {
readonly archive: string;
}
export default ((params, processor) => () => {
export default ((params) => (processor) => () => {
const sourceDirectoryPath = normalize(join(processor.context.exported, String(params.directory || "")));
const targetArchivePath = normalize(join(processor.context.release, params.archive));

@ -3,7 +3,7 @@ export interface ICompileRequest {
readonly SolutionPath: string;
readonly Target: string;
readonly Configuration: string;
readonly OutputDirectory: string;
readonly OutputDirectory?: string;
readonly SigningKey?: string;
readonly SkipCodeAnalysis: boolean;
}

@ -35,9 +35,9 @@ interface ITaskParameters {
readonly [paramName: string]: any;
}
type TaskWithParameters = () => void;
type TaskWithParameters = (processor: ITaskProcessor) => () => void;
export type GenericTask<TParams> = (params: TParams, processor: ITaskProcessor) => TaskWithParameters;
export type GenericTask<TParams> = (params: TParams) => TaskWithParameters;
export type Task = GenericTask<ITaskParameters>;
@ -52,7 +52,7 @@ export interface ITaskInfoExternal {
}
export interface ITaskInfoInternal {
readonly name: string;
readonly name?: string;
readonly task: TaskWithParameters;
}

Loading…
Cancel
Save