本文整理汇总了TypeScript中electron-builder.Platform.MAC类的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.MAC类的具体用法?TypeScript Platform.MAC怎么用?TypeScript Platform.MAC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Platform.MAC类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: assertPack
test.ifMac("no Applications link", () => {
return assertPack("test-app-one", {
targets: Platform.MAC.createTarget(),
config: {
publish: null,
productName: "NoApplicationsLink",
dmg: {
contents: [
{
x: 110,
y: 150
},
{
x: 410,
y: 440,
type: "link",
path: "/Applications/TextEdit.app"
}
],
},
},
effectiveOptionComputed: async it => {
const volumePath = it.volumePath
await BluebirdPromise.all([
assertThat(path.join(volumePath, ".background", "background.tiff")).isFile(),
assertThat(path.join(volumePath, "Applications")).doesNotExist(),
assertThat(path.join(volumePath, "TextEdit.app")).isSymbolicLink(),
assertThat(path.join(volumePath, "TextEdit.app")).isDirectory(),
])
expect(it.specification.contents).toMatchSnapshot()
return false
},
})
})
示例2: createMacTargetTest
export function createMacTargetTest(target: Array<MacOsTargetName>, config?: Configuration, isSigned = true) {
return app({
targets: Platform.MAC.createTarget(),
config: {
extraMetadata: {
repository: "foo/bar",
} as any,
mac: {
target,
},
publish: null,
...config
},
}, {
signed: isSigned,
packed: async context => {
if (!target.includes("tar.gz")) {
return
}
const tempDir = await context.tmpDir.createTempDir({prefix: "mac-target-test"})
await exec("tar", ["xf", path.join(context.outDir, "Test App ßW-1.1.0-mac.tar.gz")], {cwd: tempDir})
await assertThat(path.join(tempDir, "Test App ßW.app")).isDirectory()
}
})
}
示例3: assertPack
test.ifMac("custom background - new way", () => {
const customBackground = "customBackground.png"
return assertPack("test-app-one", {
targets: Platform.MAC.createTarget(),
config: {
publish: null,
mac: {
icon: "customIcon",
},
dmg: {
background: customBackground,
icon: "foo.icns",
},
},
effectiveOptionComputed: async it => {
expect(it.specification.background).toMatch(new RegExp(`.+${customBackground}$`))
expect(it.specification.icon).toEqual("foo.icns")
const packager: PlatformPackager<any> = it.packager
expect(await packager.getIconPath()).toEqual(path.join(packager.projectDir, "build", "customIcon.icns"))
return true
},
}, {
projectDirCreated: projectDir => Promise.all([
copyFile(path.join(getDmgTemplatePath(), "background.tiff"), path.join(projectDir, customBackground)),
// copy, but not rename to test that default icon is not used
copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "customIcon.icns")),
copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "foo.icns")),
]),
})
})
示例4: createMacTargetTest
export function createMacTargetTest(target: Array<MacOsTargetName>) {
return app({
targets: Platform.MAC.createTarget(),
config: {
extraMetadata: {
repository: "foo/bar",
} as any,
mac: {
target,
}
}
}, {
signed: target.includes("mas") || target.includes("pkg") || target.includes("mas-dev"),
packed: async context => {
if (!target.includes("tar.gz")) {
return
}
const tempDir = path.join(context.outDir, getTempName())
await mkdir(tempDir)
await exec("tar", ["xf", path.join(context.outDir, "Test App ßW-1.1.0-mac.tar.gz")], {cwd: tempDir})
await assertThat(path.join(tempDir, "Test App ßW.app")).isDirectory()
}
})
}
示例5: app
test.ifMac.ifAll("png icon small", () => {
let platformPackager: CheckingMacPackager | null = null
return app({
targets: Platform.MAC.createTarget(DIR_TARGET),
config: {
mac: {
icon: "icons/128x128.png",
},
},
platformPackagerFactory: packager => platformPackager = new CheckingMacPackager(packager)
}, {
projectDirCreated: projectDir => Promise.all([
unlink(path.join(projectDir, "build", "icon.icns")),
unlink(path.join(projectDir, "build", "icon.ico")),
]),
packed: async () => {
try {
await platformPackager!!.getIconPath()
}
catch (e) {
if (!e.message.includes("must be at least 512x512")) {
throw e
}
return
}
throw new Error("error expected")
},
})()
})
示例6: async
test.skip("dmg", async () => {
const outDirs: Array<string> = []
const tmpDir = new TmpDir("differential-updater-test")
if (process.env.__SKIP_BUILD == null) {
await doBuild(outDirs, Platform.MAC.createTarget(), tmpDir, {
mac: {
electronUpdaterCompatibility: ">=2.17.0",
},
})
}
else {
// todo
}
await testBlockMap(outDirs[0], path.join(outDirs[1]), MacUpdater, "mac/Test App ßW.app", Platform.MAC)
})
示例7: async
test.ifAll.ifMac.ifNotCi("dmg", async () => {
process.env.TEST_UPDATER_PLATFORM = "darwin"
const outDirs: Array<string> = []
if (process.env.__SKIP_BUILD == null) {
await doBuild(outDirs, Platform.MAC.createTarget(), {
mac: {
electronUpdaterCompatibility: ">=2.17.0",
},
})
}
else {
// todo
}
await testBlockMap(outDirs[0], path.join(outDirs[1]), MacUpdater)
})
示例8: assertPack
test.ifAll("entitlements in build dir", () => {
let platformPackager: CheckingMacPackager = null
return assertPack("test-app-one", signed({
targets: Platform.MAC.createTarget(),
platformPackagerFactory: (packager, platform) => platformPackager = new CheckingMacPackager(packager),
}), {
projectDirCreated: projectDir => BluebirdPromise.all([
writeFile(path.join(projectDir, "build", "entitlements.mac.plist"), ""),
writeFile(path.join(projectDir, "build", "entitlements.mac.inherit.plist"), ""),
]),
packed: context => {
expect(platformPackager.effectiveSignOptions).toMatchObject({
entitlements: path.join(context.projectDir, "build", "entitlements.mac.plist"),
"entitlements-inherit": path.join(context.projectDir, "build", "entitlements.mac.inherit.plist"),
})
return BluebirdPromise.resolve()
}
})
})