当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Promise.mapSeries方法代码示例

本文整理汇总了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)
    })
}
开发者ID:Lange,项目名称:electron-builder,代码行数:30,代码来源:codeSign.ts

示例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)
    })
}
开发者ID:Dreadchild,项目名称:electron-builder,代码行数:23,代码来源:codeSign.ts


注:本文中的bluebird.Promise.mapSeries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。