本文整理汇总了TypeScript中builder-util/out/api.PackageBuilder类的典型用法代码示例。如果您正苦于以下问题:TypeScript PackageBuilder类的具体用法?TypeScript PackageBuilder怎么用?TypeScript PackageBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PackageBuilder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: applyProperties
export async function applyProperties(entries: any, env: any, asyncTaskManager: AsyncTaskManager, packager: PackageBuilder) {
const dmgPropertiesFile = await packager.getTempFile("dmgProperties.pl")
asyncTaskManager.addTask(outputFile(dmgPropertiesFile, (await readFile(path.join(getDmgTemplatePath(), "dmgProperties.pl"), "utf-8")).replace("$ENTRIES", entries)))
await asyncTaskManager.awaitTasks()
await exec("/usr/bin/perl", [dmgPropertiesFile], {
cwd: getDmgVendorPath(),
env
})
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:12,代码来源:dmgUtil.ts
示例2: addLicenseToDmg
export async function addLicenseToDmg(packager: PackageBuilder, dmgPath: string) {
// http://www.owsiak.org/?p=700
const licenseFiles = await getLicenseFiles(packager)
if (licenseFiles.length === 0) {
return
}
const licenseButtonFiles = await getLicenseButtonsFile(packager)
packager.debugLogger.add("dmg.licenseFiles", licenseFiles)
packager.debugLogger.add("dmg.licenseButtons", licenseButtonFiles)
const style: Array<string> = []
const rtfs: Array<string> = []
const defaultButtons: Array<string> = []
let counter = 5000
const addedRegionCodes: Array<number> = []
for (const item of licenseFiles) {
log("Adding " + item.langName + " license")
// value from DropDMG, data the same for any language
// noinspection SpellCheckingInspection
style.push(`data 'styl' (${counter}, "${item.langName}") {
$"0001 0000 0000 000E 0011 0015 0000 000C"
$"0000 0000 0000"
};`)
let data = `data 'RTF ' (${counter}, "${item.langName}") {\n`
const fileData = await readFile(item.file, "utf-8")
const isRtf = item.file.endsWith(".rtf") || item.file.endsWith(".RTF")
data += isRtf ? serializeString((Buffer.from(fileData)).toString("hex")) : wrapInRtf(await readFile(item.file, "utf-8"))
data += "\n};"
rtfs.push(data)
defaultButtons.push(await getLicenseButtons(licenseButtonFiles, item.langWithRegion, counter, item.langName))
addedRegionCodes.push(getRegionCode(item.langWithRegion))
counter++
}
const buffer = Buffer.allocUnsafe((2 + (3 * addedRegionCodes.length)) * 2)
let offset = 0
buffer.writeUInt16BE(DEFAULT_REGION_CODE, offset)
offset += 2
buffer.writeUInt16BE(addedRegionCodes.length, offset)
offset += 2
for (let i = 0; i < addedRegionCodes.length; i++) {
const regionCode = addedRegionCodes[i]
buffer.writeUInt16BE(regionCode, offset)
offset += 2
buffer.writeUInt16BE(i, offset)
offset += 2
buffer.writeUInt16BE(/* is two byte */ [14, 51, 52, 53].includes(regionCode) ? 1 : 0, offset)
offset += 2
}
const lPic = `data 'LPic' (5000) {\n${serializeString(buffer.toString("hex"))}\n};`
const data = style
.concat(rtfs)
.concat(lPic)
.concat(defaultButtons)
.join("\n\n")
packager.debugLogger.add("dmg.licenseResource", data)
const tempFile = await packager.getTempFile(".r")
await outputFile(tempFile, data)
await exec("hdiutil", ["unflatten", dmgPath])
await exec("Rez", ["-a", tempFile, "-o", dmgPath])
await exec("hdiutil", ["flatten", dmgPath])
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:73,代码来源:dmgLicense.ts
注:本文中的builder-util/out/api.PackageBuilder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论