• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript util.log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中builder-util/out/util.log的典型用法代码示例。如果您正苦于以下问题:TypeScript log类的具体用法?TypeScript log怎么用?TypeScript log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了log类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getCertificateFromStoreInfo

export async function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {
  const certificateSubjectName = options.certificateSubjectName
  const certificateSha1 = options.certificateSha1
  // ExcludeProperty doesn't work, so, we cannot exclude RawData, it is ok
  // powershell can return object if the only item
  const rawResult = await vm.exec("powershell.exe", ["Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress"])
  const certList = rawResult.length === 0 ? [] : asArray<CertInfo>(JSON.parse(rawResult))
  for (const certInfo of certList) {
    if (certificateSubjectName != null) {
      if (!certInfo.Subject.includes(certificateSubjectName)) {
        continue
      }
    }
    else if (certInfo.Thumbprint !== certificateSha1) {
      continue
    }

    const parentPath = certInfo.PSParentPath
    const store = parentPath.substring(parentPath.lastIndexOf("\\") + 1)
    log.debug({store, PSParentPath: parentPath}, "auto-detect certificate store")
    // https://github.com/electron-userland/electron-builder/issues/1717
    const isLocalMachineStore = (parentPath.includes("Certificate::LocalMachine"))
    log.debug(null, "auto-detect using of LocalMachine store")
    return {
      thumbprint: certInfo.Thumbprint,
      subject: certInfo.Subject,
      store,
      isLocalMachineStore
    }
  }

  throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:33,代码来源:windowsCodeSign.ts


示例2: isSignAllowed

export function isSignAllowed(isPrintWarn = true): boolean {
  if (process.platform !== "darwin") {
    if (isPrintWarn) {
      log.warn({reason: "supported only on macOS"}, "skipped macOS application code signing")
    }
    return false
  }

  const buildForPrWarning = "There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the  CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" +
    "\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you."

  if (isPullRequest()) {
    if (isEnvTrue(process.env.CSC_FOR_PULL_REQUEST)) {
      if (isPrintWarn) {
        log.warn(buildForPrWarning)
      }
    }
    else {
      if (isPrintWarn) {
        // https://github.com/electron-userland/electron-builder/issues/1524
        log.warn("Current build is a part of pull request, code signing will be skipped." +
          "\nSet env CSC_FOR_PULL_REQUEST to true to force code signing." +
          `\n${buildForPrWarning}`)
      }
      return false
    }
  }
  return true
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:29,代码来源:macCodeSign.ts


示例3: doSign

async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {
  // https://github.com/electron-userland/electron-builder/pull/1944
  const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000

  let tool: string
  let args: Array<string>
  let env = process.env
  let vm: VmManager
  if (configuration.path.endsWith(".appx") || !("file" in configuration.cscInfo!!) /* certificateSubjectName and other such options */) {
    vm = await packager.vm.value
    tool = getWinSignTool(await getSignVendorPath())
    args = computeSignToolArgs(configuration, true, vm)
  }
  else {
    vm = new VmManager()
    const toolInfo = await getToolPath()
    tool = toolInfo.path
    args = configuration.computeSignToolArgs(process.platform === "win32")
    if (toolInfo.env != null) {
      env = toolInfo.env
    }
  }

  try {
    await vm.exec(tool, args, {timeout, env})
  }
  catch (e) {
    if (e.message.includes("The file is being used by another process") || e.message.includes("The specified timestamp server either could not be reached")) {
      log.warn(`First attempt to code sign failed, another attempt will be made in 2 seconds: ${e.message}`)
      await new Promise((resolve, reject) => {
        setTimeout(() => {
          vm.exec(tool, args, {timeout, env})
            .then(resolve)
            .catch(reject)
        }, 2000)
      })
    }
    throw e
  }
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:40,代码来源:windowsCodeSign.ts


示例4: reportError

export async function reportError(isMas: boolean, certificateType: CertType, qualifier: string | null | undefined, keychainName: string | null | undefined, isForceCodeSigning: boolean) {
  const logFields: Fields = {}
  if (qualifier == null) {
    logFields.reason = ""
    if (isAutoDiscoveryCodeSignIdentity()) {
      logFields.reason += `cannot find valid "${certificateType}" identity${(isMas ? "" : ` or custom non-Apple code signing certificate`)}`
    }
    logFields.reason += ", see https://electron.build/code-signing"
    if (!isAutoDiscoveryCodeSignIdentity()) {
      logFields.CSC_IDENTITY_AUTO_DISCOVERY = false
    }
  }
  else {
    logFields.reason = "Identity name is specified, but no valid identity with this name in the keychain"
    logFields.identity = qualifier
  }

  const args = ["find-identity"]
  if (keychainName != null) {
    args.push(keychainName)
  }

  if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {
    logFields.allIdentities = (await exec("security", args))
      .trim()
      .split("\n")
      .filter(it => !(it.includes("Policy: X.509 Basic") || it.includes("Matching identities")))
      .join("\n")
  }

  if (isMas || isForceCodeSigning) {
    throw new Error(Logger.createMessage("skipped macOS application code signing", logFields, "error", it => it))
  }
  else {
    log.warn(logFields, "skipped macOS application code signing")
  }
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:37,代码来源:macCodeSign.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript destiny2.getVendors函数代码示例发布时间:2022-05-25
下一篇:
TypeScript util.exec函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap