本文整理汇总了TypeScript中builder-util.TmpDir.cleanup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TmpDir.cleanup方法的具体用法?TypeScript TmpDir.cleanup怎么用?TypeScript TmpDir.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类builder-util.TmpDir
的用法示例。
在下文中一共展示了TmpDir.cleanup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createSelfSignedCert
export async function createSelfSignedCert(publisher: string) {
const tmpDir = new TmpDir()
const targetDir = process.cwd()
const tempPrefix = path.join(await tmpDir.getTempDir({prefix: "self-signed-cert-creator"}), sanitizeFileName(publisher))
const cer = `${tempPrefix}.cer`
const pvk = `${tempPrefix}.pvk`
log.info(chalk.bold('When asked to enter a password ("Create Private Key Password"), please select "None".'))
try {
await ensureDir(path.dirname(tempPrefix))
const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
await exec(path.join(vendorPath, "makecert.exe"),
["-r", "-h", "0", "-n", `CN=${quoteString(publisher)}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])
const pfx = path.join(targetDir, `${sanitizeFileName(publisher)}.pfx`)
await unlinkIfExists(pfx)
await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
log.info({file: pfx}, `created. Please see https://electron.build/code-signing how to use it to sign.`)
const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
log.info({file: pfx, certLocation}, `importing. Operation will be succeed only if runned from root. Otherwise import file manually.`)
await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
}
finally {
await tmpDir.cleanup()
}
}
示例2: test
test("postpone symlink", async () => {
const tmpDir = new TmpDir()
const source = await tmpDir.getTempDir()
const aSourceFile = path.join(source, "z", "Z")
const bSourceFileLink = path.join(source, "B")
await outputFile(aSourceFile, "test")
await symlink(aSourceFile, bSourceFileLink)
const dest = await tmpDir.getTempDir()
await copyDir(source, dest)
await tmpDir.cleanup()
})
示例3: test
test("Bintray upload", async () => {
const version = versionNumber()
const tmpDir = new TmpDir()
const artifactPath = await tmpDir.getTempFile({suffix: ".icns"})
await copyFile(iconPath, artifactPath)
//noinspection SpellCheckingInspection
const publisher = new BintrayPublisher(publishContext, {provider: "bintray", owner: "actperepo", package: "test", repo: "generic", token: "5df2cadec86dff91392e4c419540785813c3db15"}, version)
try {
await publisher.upload(artifactPath, Arch.x64)
await publisher.upload(artifactPath, Arch.x64)
}
finally {
try {
await publisher.deleteRelease()
}
finally {
await tmpDir.cleanup()
}
}
})
示例4: test
test("Bintray upload", async () => {
const version = "42.0.0"
const tmpDir = new TmpDir("artifact-publisher-test")
const artifactPath = await tmpDir.getTempFile({suffix: " test-space.icns"})
await copyFile(iconPath, artifactPath)
//noinspection SpellCheckingInspection
const publisher = new BintrayPublisher(publishContext, {provider: "bintray", owner: "actperepo", package: "test", repo: "generic", token: "5df2cadec86dff91392e4c419540785813c3db15"}, version)
try {
// force delete old version to ensure that test doesn't depend on previous runs
await publisher.deleteRelease(true)
await publisher.upload({file: artifactPath, arch: Arch.x64})
await publisher.upload({file: artifactPath, arch: Arch.x64})
}
finally {
try {
await publisher.deleteRelease(false)
}
finally {
await tmpDir.cleanup()
}
}
})
示例5: afterEach
afterEach(() => tmpDir.cleanup())