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


TypeScript builder-util.debug函数代码示例

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


在下文中一共展示了debug函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 certList = asArray<CertInfo>(JSON.parse(await vm.exec("powershell.exe", ["Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint,IssuerName | ConvertTo-Json -Compress"])))
  for (const certInfo of certList) {
    if (certificateSubjectName != null) {
      if (!certInfo.IssuerName.Name.includes(certificateSubjectName)) {
        continue
      }
    }
    else if (certInfo.Thumbprint !== certificateSha1) {
      continue
    }

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

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

示例2: cleanupPackageJson

function cleanupPackageJson(data: any, options: CleanupPackageFileOptions): any {
  const deps = data.dependencies
  // https://github.com/electron-userland/electron-builder/issues/507#issuecomment-312772099
  const isRemoveBabel = deps != null && typeof deps === "object" && !Object.getOwnPropertyNames(deps).some(it => it.startsWith("babel"))
  try {
    let changed = false
    for (const prop of Object.getOwnPropertyNames(data)) {
      // removing devDependencies from package.json breaks levelup in electron, so, remove it only from main package.json
      if (prop[0] === "_" ||
        ignoredPackageMetadataProperties.has(prop) ||
        (options.isRemovePackageScripts && prop === "scripts") ||
        (options.isMain && prop === "devDependencies") ||
        (!options.isMain && prop === "bugs") ||
        (isRemoveBabel && prop === "babel")) {
        delete data[prop]
        changed = true
      }
    }

    if (changed) {
      return JSON.stringify(data, null, 2)
    }
  }
  catch (e) {
    debug(e)
  }

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

示例3: readChildPackage

async function readChildPackage(name: string, parentDir: string, parent: any, parentDepth: number, pathToMetadata: Map<string, Dependency>): Promise<Dependency | null> {
  const rawDir = path.join(parentDir, "node_modules", name)
  let dir: string | null = rawDir
  const stat = await lstat(dir)
  const isSymbolicLink = stat.isSymbolicLink()
  if (isSymbolicLink) {
    dir = await orNullIfFileNotExist(realpath(dir))
    if (dir == null) {
      debug(`Broken symlink ${rawDir}`)
      return null
    }
  }

  const processed = pathToMetadata.get(dir)
  if (processed != null) {
    return processed
  }

  const metadata: Dependency = await orNullIfFileNotExist(readJson(path.join(dir, "package.json")))
  if (metadata == null) {
    return null
  }

  if (isSymbolicLink) {
    metadata.link = dir
    metadata.stat = stat
  }
  metadata.path = rawDir
  await _readInstalled(dir, metadata, parent, name, parentDepth + 1, pathToMetadata)
  return metadata
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:31,代码来源:packageDependencies.ts

示例4: computeFileSets

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

    const fromStat = await statOrNull(fileWalker.matcher.from)
    if (fromStat == null) {
      debug(`Directory ${fileWalker.matcher.from} doesn't exists, skip file copying`)
      continue
    }

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

    const transformedFiles = await BluebirdPromise.map(files, it => {
      const fileStat = metadata.get(it)
      return fileStat != null && fileStat.isFile() ? transformer(it) : null
    }, CONCURRENCY)

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

  const mainFileSet = fileSets[0]
  if (isElectronCompile) {
    // cache should be first in the asar
    fileSets.unshift(await compileUsingElectronCompile(mainFileSet, packager))
  }
  return fileSets
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:29,代码来源:AppFileCopierHelper.ts

示例5: debug

 .then(() => {
   try {
     debug(`${this.providerName} Publisher: ${fileName} was uploaded to ${this.getBucketName()}`)
   }
   finally {
     resolve()
   }
 })
开发者ID:jwheare,项目名称:electron-builder,代码行数:8,代码来源:basePublisher.ts

示例6: releasify

  private async releasify(nupkgPath: string, packageName: string) {
    const args = [
      "--releasify", nupkgPath,
      "--releaseDir", this.outputDirectory
    ]
    const out = (await execSw(this.options, args)).trim()
    if (debug.enabled) {
      debug(`Squirrel output: ${out}`)
    }

    const lines = out.split("\n")
    for (let i = lines.length - 1; i > -1; i--) {
      const line = lines[i]
      if (line.includes(packageName)) {
        return line.trim()
      }
    }

    throw new Error(`Invalid output, cannot find last release entry, output: ${out}`)
  }
开发者ID:electron-userland,项目名称:electron-builder,代码行数:20,代码来源:squirrelPack.ts

示例7: releasify

  private async releasify(nupkgPath: string, packageName: string) {
    const args = [
      "--releasify", nupkgPath,
      "--releaseDir", this.outputDirectory
    ]
    const out = (await exec(process.platform === "win32" ? path.join(this.options.vendorPath, "Update.com") : "mono", prepareArgs(args, path.join(this.options.vendorPath, "Update-Mono.exe")))).trim()
    if (debug.enabled) {
      debug(`Squirrel output: ${out}`)
    }

    const lines = out.split("\n")
    for (let i = lines.length - 1; i > -1; i--) {
      const line = lines[i]
      if (line.includes(packageName)) {
        return line.trim()
      }
    }

    throw new Error(`Invalid output, cannot find last release entry, output: ${out}`)
  }
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:20,代码来源:squirrelPack.ts

示例8: unlink

 unlink(path.join(outputDirectory, outFile.replace(".msi", ".wixpdb"))).catch(e => debug(e.toString())),
开发者ID:electron-userland,项目名称:electron-builder,代码行数:1,代码来源:squirrelPack.ts

示例9: pack

async function pack(options: SquirrelOptions, directory: string, updateFile: string, outFile: string, version: string, packager: WinPackager) {
  // SW now doesn't support 0-level nupkg compressed files. It means that we are forced to use level 1 if store level requested.
  const archive = archiver("zip", {zlib: {level: Math.max(1, (options.packageCompressionLevel == null ? 9 : options.packageCompressionLevel))}})
  const archiveOut = createWriteStream(outFile)
  const archivePromise = new Promise((resolve, reject) => {
    archive.on("error", reject)
    archiveOut.on("error", reject)
    archiveOut.on("close", resolve)
  })
  archive.pipe(archiveOut)

  const author = options.authors
  const copyright = options.copyright || `Copyright Š ${new Date().getFullYear()} ${author}`
  const nuspecContent = `<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>${options.appId}</id>
    <version>${version}</version>
    <title>${options.productName}</title>
    <authors>${author}</authors>
    <iconUrl>${options.iconUrl}</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>${options.description}</description>
    <copyright>${copyright}</copyright>${options.extraMetadataSpecs || ""}
  </metadata>
</package>`
  debug(`Created NuSpec file:\n${nuspecContent}`)
  archive.append(nuspecContent.replace(/\n/, "\r\n"), {name: `${options.name}.nuspec`})

  //noinspection SpellCheckingInspection
  archive.append(`<?xml version="1.0" encoding="utf-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${options.name}.nuspec" Id="Re0" />
  <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/1.psmdcp" Id="Re1" />
</Relationships>`.replace(/\n/, "\r\n"), {name: ".rels", prefix: "_rels"})

  //noinspection SpellCheckingInspection
  archive.append(`<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
  <Default Extension="nuspec" ContentType="application/octet" />
  <Default Extension="pak" ContentType="application/octet" />
  <Default Extension="asar" ContentType="application/octet" />
  <Default Extension="bin" ContentType="application/octet" />
  <Default Extension="dll" ContentType="application/octet" />
  <Default Extension="exe" ContentType="application/octet" />
  <Default Extension="dat" ContentType="application/octet" />
  <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
  <Default Extension="diff" ContentType="application/octet" />
  <Default Extension="bsdiff" ContentType="application/octet" />
  <Default Extension="shasum" ContentType="text/plain" />
  <Default Extension="mp3" ContentType="audio/mpeg" />
  <Default Extension="node" ContentType="application/octet" />
</Types>`.replace(/\n/, "\r\n"), {name: "[Content_Types].xml"})

  archive.append(`<?xml version="1.0" encoding="utf-8"?>
<coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
  <dc:creator>${author}</dc:creator>
  <dc:description>${options.description}</dc:description>
  <dc:identifier>${options.appId}</dc:identifier>
  <version>${version}</version>
  <keywords/>
  <dc:title>${options.productName}</dc:title>
  <lastModifiedBy>NuGet, Version=2.8.50926.602, Culture=neutral, PublicKeyToken=null;Microsoft Windows NT 6.2.9200.0;.NET Framework 4</lastModifiedBy>
</coreProperties>`.replace(/\n/, "\r\n"), {name: "1.psmdcp", prefix: "package/services/metadata/core-properties"})

  archive.file(updateFile, {name: "Update.exe", prefix: "lib/net45"})
  await encodedZip(archive, directory, "lib/net45", options.vendorPath, packager)
  await archivePromise
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:71,代码来源:squirrelPack.ts


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