本文整理汇总了TypeScript中bluebird.Promise.mapSeries方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Promise.mapSeries方法的具体用法?TypeScript Promise.mapSeries怎么用?TypeScript Promise.mapSeries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluebird.Promise
的用法示例。
在下文中一共展示了Promise.mapSeries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createKeychain
export function createKeychain(keychainName: string, cscLink: string, cscKeyPassword: string, cscILink?: string, cscIKeyPassword?: string, csaLink?: string): Promise<CodeSigningInfo> {
const certLinks = [csaLink || "https://developer.apple.com/certificationauthority/AppleWWDRCA.cer"]
if (csaLink == null) {
certLinks.push("https://startssl.com/certs/sca.code2.crt", "https://startssl.com/certs/sca.code3.crt")
}
certLinks.push(cscLink)
if (cscILink != null) {
certLinks.push(cscILink)
}
const certPaths = certLinks.map(it => path.join(tmpdir(), randomString() + (it.endsWith(".cer") ? ".cer" : ".p12")))
const keychainPassword = randomString()
return executeFinally(BluebirdPromise.all([
BluebirdPromise.map(certPaths, (p, i) => download(certLinks[i], p)),
BluebirdPromise.mapSeries([
["create-keychain", "-p", keychainPassword, keychainName],
["unlock-keychain", "-p", keychainPassword, keychainName],
["set-keychain-settings", "-t", "3600", "-u", keychainName]
], it => exec("security", it))
])
.then(() => importCerts(keychainName, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null))),
errorOccurred => {
const tasks = certPaths.map(it => deleteFile(it, true))
if (errorOccurred) {
tasks.push(deleteKeychain(keychainName))
}
return all(tasks)
})
}
示例2: createKeychain
export function createKeychain(keychainName: string, cscLink: string, cscKeyPassword: string): Promise<CodeSigningInfo> {
const appleCertPath = path.join(tmpdir(), randomString() + ".cer")
const developerCertPath = path.join(tmpdir(), randomString() + ".p12")
const keychainPassword = randomString()
return executeFinally(Promise.all([
download("https://developer.apple.com/certificationauthority/AppleWWDRCA.cer", appleCertPath),
download(cscLink, developerCertPath),
BluebirdPromise.mapSeries([
["create-keychain", "-p", keychainPassword, keychainName],
["unlock-keychain", "-p", keychainPassword, keychainName],
["set-keychain-settings", "-t", "3600", "-u", keychainName]
], it => exec("security", it))
])
.then(() => importCerts(keychainName, appleCertPath, developerCertPath, cscKeyPassword)),
error => {
const tasks = [deleteFile(appleCertPath, true), deleteFile(developerCertPath, true)]
if (error != null) {
tasks.push(deleteKeychain(keychainName))
}
return all(tasks)
})
}