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


TypeScript electron-builder-util.isEmptyOrSpaces函数代码示例

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


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

示例1: 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 | n) => {
    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)) {
    warn(`description is missed in the package.json (${appPackageFile})`)
  }
  if (!metadata.author) {
    warn(`author is missed in the package.json (${appPackageFile})`)
  }
  checkNotEmpty("version", metadata.version)

  if (devMetadata != null) {
    checkDependencies(devMetadata.dependencies, errors)
  }
  if (metadata !== devMetadata) {
    checkDependencies(metadata.dependencies, errors)

    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('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 Error(errors.join("\n"))
  }
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:46,代码来源:packageMetadata.ts

示例2: findIdentity

export function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {
  let identity = qualifier || process.env.CSC_NAME
  if (isEmptyOrSpaces(identity)) {
    if (isAutoDiscoveryCodeSignIdentity()) {
      return _findIdentity(certType, null, keychain)
    }
    else {
      return BluebirdPromise.resolve(null)
    }
  }
  else {
    identity = identity!.trim()
    for (const prefix of appleCertificatePrefixes) {
      checkPrefix(identity, prefix)
    }
    return _findIdentity(certType, identity, keychain)
  }
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:18,代码来源:codeSign.ts

示例3: build

export async function build(rawOptions?: CliOptions): Promise<Array<string>> {
  const options = normalizeOptions(rawOptions || {})

  if (options.cscLink === undefined && !isEmptyOrSpaces(process.env.CSC_LINK)) {
    options.cscLink = process.env.CSC_LINK
  }
  if (options.cscInstallerLink === undefined && !isEmptyOrSpaces(process.env.CSC_INSTALLER_LINK)) {
    options.cscInstallerLink = process.env.CSC_INSTALLER_LINK
  }
  if (options.cscKeyPassword === undefined && !isEmptyOrSpaces(process.env.CSC_KEY_PASSWORD)) {
    options.cscKeyPassword = process.env.CSC_KEY_PASSWORD
  }
  if (options.cscInstallerKeyPassword === undefined && !isEmptyOrSpaces(process.env.CSC_INSTALLER_KEY_PASSWORD)) {
    options.cscInstallerKeyPassword = process.env.CSC_INSTALLER_KEY_PASSWORD
  }

  if (options.draft === undefined && !isEmptyOrSpaces(process.env.EP_DRAFT)) {
    options.draft = process.env.EP_DRAFT!.toLowerCase() === "true"
  }
  if (options.prerelease === undefined && !isEmptyOrSpaces(process.env.EP_PRELEASE)) {
    options.prerelease = process.env.EP_PRELEASE!.toLowerCase() === "true"
  }

  const cancellationToken = new CancellationToken()
  const packager = new Packager(options, cancellationToken)
  // because artifact event maybe dispatched several times for different publish providers
  const artifactPaths = new Set<string>()
  packager.artifactCreated(event => {
    if (event.file != null) {
      artifactPaths.add(event.file)
    }
  })

  const publishManager = new PublishManager(packager, options, cancellationToken)
  process.on("SIGINT", () => {
    warn("Cancelled by SIGINT")
    cancellationToken.cancel()
    publishManager.cancelTasks()
  })

  return await executeFinally(packager.build().then(() => Array.from(artifactPaths)), errorOccurred => {
    if (errorOccurred) {
      publishManager.cancelTasks()
      return BluebirdPromise.resolve(null)
    }
    else {
      return publishManager.awaitTasks()
    }
  })
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:50,代码来源:builder.ts

示例4: reportError

 const checkNotEmpty = (name: string, value: string | n) => {
   if (isEmptyOrSpaces(value)) {
     reportError(name)
   }
 }
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:5,代码来源:packageMetadata.ts


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