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


TypeScript log.warn方法代码示例

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


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

示例1: 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:ledinhphuong,项目名称:electron-builder,代码行数:29,代码来源:codeSign.ts

示例2: computeElectronVersion

export async function computeElectronVersion(projectDir: string, projectMetadata: MetadataValue): Promise<string> {
  const result = await getElectronVersionFromInstalled(projectDir)
  if (result != null) {
    return result
  }

  const electronPrebuiltDep = findFromElectronPrebuilt(await projectMetadata!!.value)
  if (electronPrebuiltDep == null || electronPrebuiltDep === "latest") {
    try {
      const releaseInfo = JSON.parse((await httpExecutor.request({
        hostname: "github.com",
        path: "/electron/electron/releases/latest",
        headers: {
          Accept: "application/json",
        },
      }))!!)
      return (releaseInfo.tag_name.startsWith("v")) ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name
    }
    catch (e) {
      log.warn(e)
    }

    throw new Error(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, "package.json")}'`)
  }

  return versionFromDependencyRange(electronPrebuiltDep)
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:27,代码来源:electronVersion.ts

示例3: computeDefaultAppDirectory

export async function computeDefaultAppDirectory(projectDir: string, userAppDir: string | null | undefined): Promise<string> {
  if (userAppDir != null) {
    const absolutePath = path.resolve(projectDir, userAppDir)
    const stat = await statOrNull(absolutePath)
    if (stat == null) {
      throw new InvalidConfigurationError(`Application directory ${userAppDir} doesn't exist`)
    }
    else if (!stat.isDirectory()) {
      throw new InvalidConfigurationError(`Application directory ${userAppDir} is not a directory`)
    }
    else if (projectDir === absolutePath) {
      log.warn({appDirectory: userAppDir}, `Specified application directory equals to project dir — superfluous or wrong configuration`)
    }
    return absolutePath
  }

  for (const dir of DEFAULT_APP_DIR_NAMES) {
    const absolutePath = path.join(projectDir, dir)
    const packageJson = path.join(absolutePath, "package.json")
    const stat = await statOrNull(packageJson)
    if (stat != null && stat.isFile()) {
      return absolutePath
    }
  }
  return projectDir
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:26,代码来源:config.ts

示例4:

 .catch(error => {
   if (dep.optional) {
     log.warn({dep: dep.name}, "cannot build optional native dep")
   }
   else {
     throw error
   }
 })
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:8,代码来源:yarn.ts

示例5: signed

export function signed(packagerOptions: PackagerOptions): PackagerOptions {
  if (process.env.CSC_KEY_PASSWORD == null) {
    log.warn({reason: "CSC_KEY_PASSWORD is not defined"}, "macOS code signing is not tested")
  }
  else {
    packagerOptions.cscLink = CSC_LINK
  }
  return packagerOptions
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:9,代码来源:packTester.ts

示例6: checkMetadata

export function checkMetadata(metadata: Metadata, devMetadata: any | null, appPackageFile: string, devAppPackageFile: string): void {
  const errors: Array<string> = []
  const reportError = (missedFieldName: string) => {
    errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`)
  }

  const checkNotEmpty = (name: string, value: string | null | undefined) => {
    if (isEmptyOrSpaces(value)) {
      reportError(name)
    }
  }

  if ((metadata as any).directories != null) {
    errors.push(`"directories" in the root is deprecated, please specify in the "build"`)
  }

  checkNotEmpty("name", metadata.name)

  if (isEmptyOrSpaces(metadata.description)) {
    log.warn({appPackageFile}, `description is missed in the package.json`)
  }
  if (metadata.author == null) {
    log.warn({appPackageFile}, `author is missed in the package.json`)
  }
  checkNotEmpty("version", metadata.version)

  if (metadata != null) {
    checkDependencies(metadata.dependencies, errors)
  }
  if (metadata !== devMetadata) {
    if (metadata.build != null) {
      errors.push(`'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`)
    }
  }

  const devDependencies = (metadata as any).devDependencies
  if (devDependencies != null && "electron-rebuild" in devDependencies) {
    log.info('electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies\n\nTo ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`')
  }

  if (errors.length > 0) {
    throw new InvalidConfigurationError(errors.join("\n"))
  }
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:44,代码来源:packageMetadata.ts

示例7: getElectronVersionFromInstalled

export async function getElectronVersionFromInstalled(projectDir: string) {
  for (const name of ["electron", "electron-prebuilt", "electron-prebuilt-compile"]) {
    try {
      return (await readJson(path.join(projectDir, "node_modules", name, "package.json"))).version
    }
    catch (e) {
      if (e.code !== "ENOENT") {
        log.warn({name, error: e}, `cannot read electron version package.json`)
      }
    }
  }
  return null
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:13,代码来源:electronVersion.ts

示例8: reactCra

export async function reactCra(projectDir: string): Promise<Configuration> {
  if ((await statOrNull(path.join(projectDir, "public", "electron.js"))) == null) {
    // noinspection SpellCheckingInspection
    log.warn("public/electron.js not found. Please see https://medium.com/@kitze/%EF%B8%8F-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3")
  }

  return {
    directories: {
      buildResources: "assets"
    },
    files: ["build/**/*"],
    extraMetadata: {
      main: "build/electron.js"
    }
  }}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:15,代码来源:rectCra.ts

示例9: getToolPath

async function getToolPath(): Promise<ToolInfo> {
  if (isUseSystemSigncode()) {
    return {path: "osslsigncode"}
  }

  const result = process.env.SIGNTOOL_PATH
  if (result) {
    return {path: result}
  }

  const vendorPath = await getSignVendorPath()
  if (process.platform === "win32") {
    // use modern signtool on Windows Server 2012 R2 to be able to sign AppX
    return {path: getWinSignTool(vendorPath)}
  }
  else if (process.platform === "darwin") {
    let suffix: string | null = null
    try {
      if (await isMacOsSierra()) {
        const toolDirPath = path.join(vendorPath, process.platform, "10.12")
        return {
          path: path.join(toolDirPath, "osslsigncode"),
          env: computeToolEnv([path.join(toolDirPath, "lib")]),
        }
      }
      else if (isCi) {
        // not clear for what we do this instead of using version detection
        suffix = "ci"
      }
    }
    catch (e) {
      log.warn(`${e.stack || e}`)
    }
    return {path: path.join(vendorPath, process.platform, `${suffix == null ? "" : `${suffix}/`}osslsigncode`)}
  }
  else {
    return {path: path.join(vendorPath, process.platform, "osslsigncode")}
  }
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:39,代码来源:windowsCodeSign.ts

示例10: 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:ledinhphuong,项目名称:electron-builder,代码行数:37,代码来源:codeSign.ts


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