How to use the builder-util-runtime.asArray function in builder-util-runtime

To help you get started, we’ve selected a few builder-util-runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-builder / packages / app-builder-lib / src / targets / snap.ts View on Github external
}

          snap.plugs[plugName] = plugOptions
        }
      }
    }

    if (buildPackages.length > 0) {
      snap.parts.app["build-packages"] = buildPackages
    }
    if (options.after != null) {
      snap.parts.app.after = options.after
    }

    if (options.assumes != null) {
      snap.assumes = asArray(options.assumes)
    }

    return snap
  }
github electron-userland / electron-builder / packages / app-builder-lib / src / index.ts View on Github external
.then(async buildResult => {
      const afterAllArtifactBuild = resolveFunction(buildResult.configuration.afterAllArtifactBuild, "afterAllArtifactBuild")
      if (afterAllArtifactBuild != null) {
        const newArtifacts = asArray(await Promise.resolve(afterAllArtifactBuild(buildResult)))
        if (newArtifacts.length === 0 || !publishManager.isPublish) {
          return buildResult.artifactPaths
        }

        const publishConfigurations = await publishManager.getGlobalPublishConfigurations()
        if (publishConfigurations == null || publishConfigurations.length === 0) {
          return buildResult.artifactPaths
        }

        for (const newArtifact of newArtifacts) {
          buildResult.artifactPaths.push(newArtifact)
          for (const publishConfiguration of publishConfigurations) {
            publishManager.scheduleUpload(publishConfiguration, {
              file: newArtifact,
              arch: null
            }, packager.appInfo)
github electron-userland / electron-builder / packages / app-builder-lib / src / targets / snap.ts View on Github external
if (!this.isElectronVersionGreaterOrEqualThen("4.0.0")) {
      if (!this.isElectronVersionGreaterOrEqualThen("2.0.0-beta.1")) {
        throw new InvalidConfigurationError("Electron 2 and higher is required to build Snap")
      }

      log.warn("Electron 4 and higher is highly recommended for Snap")
    }

    const appInfo = this.packager.appInfo
    const snapName = this.packager.executableName.toLowerCase()
    const options = this.options

    const plugs = normalizePlugConfiguration(this.options.plugs)

    const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs)
    const buildPackages = asArray(options.buildPackages)
    const defaultStagePackages = getDefaultStagePackages()
    const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages)

    this.isUseTemplateApp = this.options.useTemplateApp !== false &&
      (arch === Arch.x64 || arch === Arch.armv7l) &&
      buildPackages.length === 0 &&
      isArrayEqualRegardlessOfSort(stagePackages, defaultStagePackages)

    const appDescriptor: any = {
      command: "command.sh",
      plugs: plugNames,
      adapter: "none",
    }

    const snap: any = safeLoad(await readFile(path.join(getTemplatePath("snap"), "snapcraft.yaml"), "utf-8"))
    if (this.isUseTemplateApp) {