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/zip.ts

24 lines
868 B

"use strict";
import { createWriteStream } from "fs";
import { join, normalize } from "path";
import * as Archiver from "archiver";
export default (params, processor) => ({
"process": () => {
const sourceDirectoryPath = normalize(join(processor.context.exported, String(params.directory || "")));
const targetArchivePath = normalize(join(processor.context.release, params.archive));
processor.onInfo(`Compressing "${params.directory}" to "${params.archive}"`);
const output = createWriteStream(targetArchivePath);
const archive = new Archiver("zip");
output.on("close", () => processor.done());
archive.on("error", (err) => processor.onError(`Error while compressing: ${err}`));
archive.pipe(output);
archive.directory(sourceDirectoryPath, false);
archive.finalize();
}
});