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


TypeScript log.debug方法代码示例

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


在下文中一共展示了log.debug方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:ledinhphuong,项目名称:electron-builder,代码行数:33,代码来源:windowsCodeSign.ts

示例2: getLicenseButtons

export async function getLicenseButtons(licenseButtonFiles: Array<LicenseButtonsFile>, langWithRegion: string, id: number, name: string) {
  let data = getDefaultButtons(langWithRegion, id, name)

  for (const item of licenseButtonFiles) {
    if (item.langWithRegion !== langWithRegion) {
      continue
    }

    try {
      const fileData = safeLoad(await readFile(item.file, "utf-8")) as any
      const buttonsStr = labelToHex(fileData.lang, item.lang, item.langWithRegion) +
        labelToHex(fileData.agree, item.lang, item.langWithRegion) +
        labelToHex(fileData.disagree, item.lang, item.langWithRegion) +
        labelToHex(fileData.print, item.lang, item.langWithRegion) +
        labelToHex(fileData.save, item.lang, item.langWithRegion) +
        labelToHex(fileData.description, item.lang, item.langWithRegion)

      data = `data 'STR#' (${id}, "${name}") {\n`
      data += serializeString("0006" + buttonsStr)
      data += `\n};`

      if (log.isDebugEnabled) {
        log.debug({lang: item.langName, data}, `overwriting license buttons`)
      }
      return data
    }
    catch (e) {
      log.debug({error: e}, "cannot overwrite license buttons")
      return data
    }
  }

  return data
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:34,代码来源:licenseButtons.ts

示例3: outputFile

  await BluebirdPromise.map(updateChannelFileToInfo.values(), async task => {
    const publishConfig = task.publishConfiguration
    if (publishConfig.publishAutoUpdate === false) {
      log.debug({
        provider: publishConfig.provider,
        reason: "publishAutoUpdate is set to false"
      }, "auto update metadata file not published")
      return
    }

    if (task.info.releaseDate == null) {
      task.info.releaseDate = releaseDate
    }

    const fileContent = Buffer.from(serializeToYaml(task.info, false, true))
    await outputFile(task.file, fileContent)
    packager.dispatchArtifactCreated({
      file: task.file,
      fileContent,
      arch: null,
      packager: task.packager,
      target: null,
      publishConfig,
    })
  }, {concurrency: 4})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:25,代码来源:updateInfoBuilder.ts

示例4: resolve

 .then(() => {
   try {
     log.debug({provider: this.providerName, file: fileName, bucket: this.getBucketName()}, "uploaded")
   }
   finally {
     resolve()
   }
 })
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:8,代码来源:BaseS3Publisher.ts

示例5: hexEncode

function hexEncode(str: string, lang: string, langWithRegion: string) {
  const macCodePages = getMacCodePage(lang, langWithRegion)
  let result = ""

  for (let i = 0; i < str.length; i++) {
    try {
      let hex = getMacHexCode(str, i, macCodePages)
      if (hex === undefined) {
        hex = "3F" //?
      }
      result += hex
    }
    catch (e) {
      log.debug({error: e, char: str[i]}, "cannot convert")
      result += "3F" //?
    }
  }

  return result
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:20,代码来源:licenseButtons.ts

示例6: computeFileSets

export async function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>, isElectronCompile: boolean): Promise<Array<ResolvedFileSet>> {
  const fileSets: Array<ResolvedFileSet> = []
  const packager = platformPackager.info

  for (const matcher of matchers) {
    const fileWalker = new AppFileWalker(matcher, packager)

    const fromStat = await statOrNull(matcher.from)
    if (fromStat == null) {
      log.debug({directory: matcher.from, reason: "doesn't exist"}, `skipped copying`)
      continue
    }

    const files = await walk(matcher.from, fileWalker.filter, fileWalker)
    const metadata = fileWalker.metadata
    fileSets.push(validateFileSet({src: matcher.from, files, metadata, destination: matcher.to}))
  }

  if (isElectronCompile) {
    // cache files should be first (better IO)
    fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))
  }
  return fileSets
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:24,代码来源:appFileCopier.ts

示例7: detectUnpackedDirs

export async function detectUnpackedDirs(fileSet: ResolvedFileSet, autoUnpackDirs: Set<string>, unpackedDest: string, rootForAppFilesWithoutAsar: string) {
  const dirToCreate = new Map<string, Array<string>>()
  const metadata = fileSet.metadata

  function addParents(child: string, root: string) {
    child = path.dirname(child)
    if (autoUnpackDirs.has(child)) {
      return
    }

    do {
      autoUnpackDirs.add(child)
      const p = path.dirname(child)
      // create parent dir to be able to copy file later without directory existence check
      addValue(dirToCreate, p, path.basename(child))

      if (child === root || p === root || autoUnpackDirs.has(p)) {
        break
      }
      child = p
    }
    while (true)

    autoUnpackDirs.add(root)
  }

  for (let i = 0, n = fileSet.files.length; i < n; i++) {
    const file = fileSet.files[i]
    const index = file.lastIndexOf(NODE_MODULES_PATTERN)
    if (index < 0) {
      continue
    }

    let nextSlashIndex = file.indexOf(path.sep, index + NODE_MODULES_PATTERN.length + 1)
    if (nextSlashIndex < 0) {
      continue
    }

    if (file[index + NODE_MODULES_PATTERN.length] === "@") {
      nextSlashIndex = file.indexOf(path.sep, nextSlashIndex + 1)
    }

    if (!metadata.get(file)!.isFile()) {
      continue
    }

    const packageDir = file.substring(0, nextSlashIndex)
    const packageDirPathInArchive = path.relative(rootForAppFilesWithoutAsar, getDestinationPath(packageDir, fileSet))
    const pathInArchive = path.relative(rootForAppFilesWithoutAsar, getDestinationPath(file, fileSet))
    if (autoUnpackDirs.has(packageDirPathInArchive)) {
      // if package dir is unpacked, any file also unpacked
      addParents(pathInArchive, packageDirPathInArchive)
      continue
    }

    let shouldUnpack = false
    if (file.endsWith(".dll") || file.endsWith(".exe")) {
      shouldUnpack = true
    }
    else if (!file.includes(".", nextSlashIndex) && path.extname(file) === "") {
      shouldUnpack = await isBinaryFile(file)
    }

    if (!shouldUnpack) {
      continue
    }

    if (log.isDebugEnabled) {
      log.debug({file: pathInArchive, reason: "contains executable code"}, "not packed into asar archive")
    }

    addParents(pathInArchive, packageDirPathInArchive)
  }

  if (dirToCreate.size > 0) {
    await ensureDir(unpackedDest + path.sep + "node_modules")
    // child directories should be not created asynchronously - parent directories should be created first
    await BluebirdPromise.map(dirToCreate.keys(), async parentDir => {
      const base = unpackedDest + path.sep + parentDir
      await ensureDir(base)
      await BluebirdPromise.each(dirToCreate.get(parentDir)!, (it): any => {
        if (dirToCreate.has(parentDir + path.sep + it)) {
          // already created
          return null
        }
        else {
          return ensureDir(base + path.sep + it)
        }
      })
    }, CONCURRENCY)
  }
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:92,代码来源:unpackDetector.ts

示例8: computeFileSets

export async function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer, packager: Packager, isElectronCompile: boolean): Promise<Array<ResolvedFileSet>> {
  const fileSets: Array<ResolvedFileSet> = []
  let hoistedNodeModuleFileSets: Array<ResolvedFileSet> | null = null
  let isHoistedNodeModuleChecked = false
  for (const matcher of matchers) {
    const fileWalker = new AppFileWalker(matcher, packager)

    const fromStat = await statOrNull(matcher.from)
    if (fromStat == null) {
      log.debug({directory: matcher.from, reason: "doesn't exist"}, `skipped copying`)
      continue
    }

    const files = await walk(matcher.from, fileWalker.filter, fileWalker)
    const metadata = fileWalker.metadata

    // https://github.com/electron-userland/electron-builder/issues/2205 Support for hoisted node_modules (lerna + yarn workspaces)
    // if no node_modules in the app dir, it means that probably dependencies are hoisted
    // check that main node_modules doesn't exist in addition to isNodeModulesHandled because isNodeModulesHandled will be false if node_modules dir is ignored by filter
    // here isNodeModulesHandled is required only because of performance reasons (avoid stat call)
    if (!isHoistedNodeModuleChecked && matcher.from === packager.appDir && !fileWalker.isNodeModulesHandled) {
      isHoistedNodeModuleChecked = true
      if ((await statOrNull(path.join(packager.appDir, "node_modules"))) == null) {
        // in the prepacked mode no package.json
        const packageJsonStat = await statOrNull(path.join(packager.appDir, "package.json"))
        if (packageJsonStat != null && packageJsonStat.isFile()) {
          hoistedNodeModuleFileSets = await copyHoistedNodeModules(packager, matcher)
        }
      }
    }

    const transformedFiles = new Map<number, string | Buffer>()
    await BluebirdPromise.filter(files, (it, index) => {
      const fileStat = metadata.get(it)
      if (fileStat == null || !fileStat.isFile()) {
        return false
      }

      const transformedValue = transformer(it)
      if (transformedValue == null) {
        return false
      }

      if (typeof transformedValue === "object" && "then" in transformedValue) {
        return (transformedValue as BluebirdPromise<any>)
          .then(it => {
            if (it != null) {
              transformedFiles.set(index, it)
            }
            return false
          })
      }
      transformedFiles.set(index, transformedValue as string | Buffer)
      return false
    }, CONCURRENCY)

    fileSets.push({src: matcher.from, files, metadata, transformedFiles, destination: matcher.to})
  }

  if (isElectronCompile) {
    // cache files should be first (better IO)
    fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))
  }
  if (hoistedNodeModuleFileSets != null) {
    return fileSets.concat(hoistedNodeModuleFileSets)
  }
  return fileSets
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:68,代码来源:AppFileCopierHelper.ts


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