How to use the electron-builder.Platform.LINUX function in electron-builder

To help you get started, we’ve selected a few electron-builder 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 / test / src / helpers / packTester.ts View on Github external
}

  expect(objectToCompare).toMatchSnapshot()

  c: for (const [platform, archToType] of packagerOptions.targets!!) {
    for (const [arch, targets] of computeArchToTargetNamesMap(archToType, {platformSpecificBuildOptions: (packagerOptions as any)[platform.buildConfigurationKey] || {}, defaultTarget: []} as any, platform)) {
      if (targets.length === 1 && targets[0] === DIR_TARGET) {
        continue c
      }

      const nameToTarget = platformToTargets.get(platform)!!
      if (platform === Platform.MAC) {
        const packedAppDir = path.join(outDir, nameToTarget.has("mas-dev") ? "mas-dev" : (nameToTarget.has("mas") ? "mas" : "mac"), `${packager.appInfo.productFilename}.app`)
        await checkMacResult(packager, packagerOptions, checkOptions, packedAppDir)
      }
      else if (platform === Platform.LINUX) {
        await checkLinuxResult(outDir, packager, arch, nameToTarget)
      }
      else if (platform === Platform.WINDOWS) {
        await checkWindowsResult(packager, checkOptions, artifacts.get(platform)!!, nameToTarget)
      }
    }
  }

  return {packager, outDir}
}
github electron-userland / electron-builder / test / src / helpers / packTester.ts View on Github external
import { emptyDir, writeJson } from "fs-extra"
import { promises as fs } from "fs"
import { safeLoad } from "js-yaml"
import * as path from "path"
import pathSorter from "path-sort"
import { TmpDir } from "temp-file"
import { readAsar } from "app-builder-lib/out/asar/asar"
import { executeAppBuilderAsJson } from "app-builder-lib/out/util/appBuilder"
import { CSC_LINK, WIN_CSC_LINK } from "./codeSignData"
import { assertThat } from "./fileAssert"

if (process.env.TRAVIS !== "true") {
  process.env.CIRCLE_BUILD_NUM = "42"
}

export const linuxDirTarget = Platform.LINUX.createTarget(DIR_TARGET)
export const snapTarget = Platform.LINUX.createTarget("snap")

export interface AssertPackOptions {
  readonly projectDirCreated?: (projectDir: string, tmpDir: TmpDir) => Promise
  readonly packed?: (context: PackedContext) => Promise
  readonly expectedArtifacts?: Array

  readonly checkMacApp?: (appDir: string, info: any) => Promise

  readonly useTempDir?: boolean
  readonly signed?: boolean
  readonly signedWin?: boolean

  readonly isInstallDepsBefore?: boolean

  readonly publish?: PublishPolicy
github nashaofu / dingtalk / scripts / build.js View on Github external
const path = require('path')
const { build, Platform } = require('electron-builder')
const chalk = require('chalk')
const { author, description } = require('../package.json')

build({
  targets: Platform.LINUX.createTarget(),
  config: {
    appId: 'dingtalk',
    copyright: `Copyright © ${new Date().getFullYear} ${author.name}`,
    productName: '钉钉',
    asar: true,
    linux: {
      description,
      icon: path.join(__dirname, '../icon'),
      target: 'deb',
      category: 'InstantMessaging'
    }
  }
}).then(() => {
  console.log(chalk.cyan('Build complete.\n'))
}).catch(error => {
  throw error
github wojtkowiak / meteor-desktop / lib / installerBuilder.js View on Github external
if (this.$.env.options.win) {
            targets.push(Platform.WINDOWS);
        }
        if (this.$.env.options.linux) {
            targets.push(Platform.LINUX);
        }
        if (this.$.env.options.mac) {
            targets.push(Platform.MAC);
        }

        if (targets.length === 0) {
            if (this.$.env.os.isWindows) {
                targets.push(Platform.WINDOWS);
            } else if (this.$.env.os.isLinux) {
                targets.push(Platform.LINUX);
            } else {
                targets.push(Platform.MAC);
            }
        }

        const target = createTargets(targets, null, arch);

        try {
            await build({
                targets: target,
                devMetadata: {
                    directories: {
                        app: this.$.env.paths.electronApp.root,
                        output: path.join(this.$.env.options.output, this.$.env.paths.installerDir)
                    },
                    build: settings.builderOptions