DefinitelyTyped/types/appdmg/appdmg-tests.ts
2017-12-09 09:59:31 -08:00

48 lines
939 B
TypeScript

import appdmg = require("appdmg");
import { Options, Specification, SpecificationOptions } from "appdmg";
const proc = appdmg({
target: "/foo/bar.dmg",
basepath: "/baz",
specification: {
title: "Happy",
icon: "happy.icns",
background: "happy.tiff",
format: "UDBZ",
"icon-size": 98,
contents: [
{
x: 405,
y: 150,
type: "link",
path: "/Applications"
},
{
x: 127,
y: 150,
type: "file",
path: "/foo/bar.app"
}
]
}
});
proc.on("progress", info => {
if (info.type === "step-begin") {
process.stdout.write(`${info.title}... `);
}
if (info.type === "step-end") {
process.stdout.write(`${info.status}\n`);
}
});
proc.on("finish", () => {
console.log('Installer was created successfully!');
});
proc.on("error", (err) => {
console.error('Installer could not be created', err);
process.exit(1);
});