Build server prototype (integration with GitHub / NuGet / etc)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
micro-build-server/BuildServer/lib/tasks/writefile.ts

27 lines
653 B

"use strict";
import { writeFile } from "fs";
import { join } from "path";
import { GenericTask } from "../types";
interface IParameters {
readonly data: string;
readonly filename: string;
}
export default ((params) => (processor) => () => {
const filePath = join(processor.context.exported, params.filename);
processor.onInfo(`Writing to ${filePath}`);
writeFile(filePath, params.data, (err) => {
if (err) {
processor.onError(`Unable to write file: ${err}`);
} else {
processor.onInfo("Written file");
}
return processor.done();
});
}) as GenericTask<IParameters>;