本文整理汇总了TypeScript中electron-builder.Platform.LINUX类的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.LINUX类的具体用法?TypeScript Platform.LINUX怎么用?TypeScript Platform.LINUX使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Platform.LINUX类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: copyDir
if (src != null) {
await copyDir(src, projectDir + "/node_modules")
}
},
isInstallDepsBefore: false,
}
test.ifAll.ifMac("mac", app({
targets: Platform.MAC.createTarget(),
config: {
protonNodeVersion: "current",
},
}, checkOptions))
test.ifAll.ifLinuxOrDevMac("linux", app({
targets: Platform.LINUX.createTarget("appimage"),
config: {
protonNodeVersion: "current",
},
}, checkOptions))
test.ifAll.ifDevOrWinCi("win", app({
targets: Platform.WINDOWS.createTarget("nsis"),
config: {
protonNodeVersion: "current",
},
}, checkOptions))
test.ifAll.ifDevOrWinCi("win ia32", app({
targets: Platform.WINDOWS.createTarget("nsis", Arch.ia32),
config: {
示例2: app
import { Arch, build, Platform } from "electron-builder"
import { copyFile, move, outputFile, remove, rename } from "fs-extra-p"
import * as path from "path"
import { GenericServerOptions } from "builder-util-runtime"
import { assertThat } from "../helpers/fileAssert"
import { app, appThrows, copyTestAsset, modifyPackageJson } from "../helpers/packTester"
import { ELECTRON_VERSION } from "../helpers/testConfig"
const appImageTarget = Platform.LINUX.createTarget("appimage")
// test update info file name
const testPublishConfig: GenericServerOptions = {
provider: "generic",
url: "https://example.com/download",
}
test.ifNotWindows("AppImage", app({
targets: appImageTarget,
config: {
publish: testPublishConfig,
},
}))
// also test os macro in output dir
test.ifAll.ifNotWindows.ifNotCiMac("AppImage ia32", app({
targets: Platform.LINUX.createTarget("Appimage", Arch.ia32),
config: {
directories: {
// tslint:disable:no-invalid-template-strings
output: "dist/${os}",
},
示例3: parse
import BluebirdPromise from "bluebird-lst"
import { Arch, BuildOptions, createTargets, DIR_TARGET, Platform } from "electron-builder"
import { walk } from "electron-builder-util/out/fs"
import { readAsarJson } from "electron-builder/out/asar"
import { configureBuildCommand, normalizeOptions } from "electron-builder/out/builder"
import { checkWineVersion } from "electron-builder/out/packager"
import { move, outputJson } from "fs-extra-p"
import * as path from "path"
import { ELECTRON_VERSION } from "./helpers/config"
import { app, appTwo, appTwoThrows, assertPack, modifyPackageJson, packageJson } from "./helpers/packTester"
const linuxDirTarget = Platform.LINUX.createTarget(DIR_TARGET)
test("cli", async () => {
const yargs = require("yargs")
configureBuildCommand(yargs)
function parse(input: string): BuildOptions {
return normalizeOptions(yargs.parse(input.split(" ")))
}
function expected(opt: BuildOptions): object {
return Object.assign({
publish: undefined,
draft: undefined,
prerelease: undefined,
extraMetadata: undefined,
}, opt)
}
expect(parse("--platform mac")).toMatchSnapshot()
示例4: outputFile
await Promise.all([
outputFile(path.join(appDir, "assets", "file"), "data"),
outputFile(path.join(appDir, "b2", "file"), "data"),
outputFile(path.join(appDir, "do-not-unpack-dir", "file.json"), "{}")
.then(() => writeFile(path.join(appDir, "do-not-unpack-dir", "must-be-not-unpacked"), "{}"))
])
const dir = path.join(appDir, "do-not-unpack-dir", "dir-2", "dir-3", "dir-3")
await mkdirs(dir)
await writeFile(path.join(dir, "file-in-asar"), "{}")
await symlink(path.join(appDir, "assets", "file"), path.join(appDir, "assets", "file-symlink"))
}
test.ifDevOrLinuxCi("unpackDir one", app({
targets: Platform.LINUX.createTarget(DIR_TARGET),
config: {
asarUnpack: [
"assets",
"b2",
"do-not-unpack-dir/file.json",
],
}
}, {
projectDirCreated: createFiles,
packed: assertDirs,
}))
async function assertDirs(context: PackedContext) {
const resourceDir = context.getResources(Platform.LINUX)
await Promise.all([
示例5: app
import { createTargets, Platform } from "electron-builder"
import * as path from "path"
import { app, checkDirContents } from "./helpers/packTester"
import { assertThat } from "./helpers/fileAssert"
test.ifDevOrLinuxCi("generic, github and spaces", app({
targets: Platform.LINUX.createTarget(),
config: {
generateUpdatesFilesForAllChannels: true,
publish: [
{
provider: "generic",
url: "https://example.com/downloads"
},
{
provider: "github",
repo: "foo/foo"
},
{
provider: "spaces",
name: "mySpaceName",
region: "nyc3"
},
]
},
}))
test.ifAll.ifNotWindows("os macro", app({
targets: createTargets([Platform.LINUX, Platform.MAC], "zip"),
config: {
publish: {
示例6:
import { safeLoad } from "js-yaml"
import * as path from "path"
import pathSorter from "path-sort"
import { parse as parsePlist } from "plist"
import { deepAssign } from "read-config-file/out/deepAssign"
import { TmpDir } from "temp-file"
import { CSC_LINK, WIN_CSC_LINK } from "./codeSignData"
import { assertThat } from "./fileAssert"
if (process.env.TRAVIS !== "true") {
process.env.CIRCLE_BUILD_NUM = "42"
}
const OUT_DIR_NAME = "dist"
export const linuxDirTarget = Platform.LINUX.createTarget(DIR_TARGET)
interface AssertPackOptions {
readonly projectDirCreated?: (projectDir: string, tmpDir: TmpDir) => Promise<any>
readonly packed?: (context: PackedContext) => Promise<any>
readonly expectedArtifacts?: Array<string>
readonly checkMacApp?: (appDir: string, info: any) => Promise<any>
readonly useTempDir?: boolean
readonly signed?: boolean
readonly signedWin?: boolean
readonly installDepsBefore?: boolean
readonly publish?: PublishPolicy
示例7: app
import { Arch, Platform } from "electron-builder"
import { readFile } from "fs-extra-p"
import { app } from "../helpers/packTester"
test.ifNotWindows("deb", app({targets: Platform.LINUX.createTarget("deb")}))
test.ifNotWindows("arm deb", app({targets: Platform.LINUX.createTarget("deb", Arch.armv7l)}))
test.ifNotWindows("custom depends", app({
targets: Platform.LINUX.createTarget("deb"),
config: {
linux: {
executableName: "Boo",
},
deb: {
depends: ["foo"],
},
},
effectiveOptionComputed: async (it) => {
const content = await readFile(it[1], "utf8")
expect(content).toMatchSnapshot()
return false
}
}))
示例8: app
import { Platform } from "electron-builder"
import { app } from "../helpers/packTester"
test.ifAll.ifDevOrLinuxCi("tar", app({targets: Platform.LINUX.createTarget(["tar.xz", "tar.lz", "tar.bz2"])}))
示例9: githubPublisher
function githubPublisher(repo: string): GithubOptions {
return {
provider: "github",
repo,
}
}
function genericPublisher(url: string): GenericServerOptions {
return {
provider: "generic",
url,
}
}
test.ifDevOrLinuxCi("github and spaces (publishAutoUpdate)", app({
targets: Platform.LINUX.createTarget("AppImage"),
config: {
mac: {
electronUpdaterCompatibility: ">=2.16",
},
publish: [
githubPublisher("foo/foo"),
spacesPublisher(false),
]
},
}))
test.ifAll("mac artifactName ", app({
targets: Platform.MAC.createTarget("zip"),
config: {
// tslint:disable-next-line:no-invalid-template-strings
示例10: fit
import { Platform } from "electron-builder"
import { app, assertPack } from "../helpers/packTester"
if (process.env.SNAP_TEST === "false") {
fit("Skip snapTest suite â SNAP_TEST is set to false", () => {
console.warn("[SKIP] Skip snapTest suite â SNAP_TEST is set to false")
})
}
const snapTarget = Platform.LINUX.createTarget("snap")
test.ifAll.ifDevOrLinuxCi("snap", app({
targets: snapTarget,
config: {
extraMetadata: {
name: "sep",
},
productName: "Sep",
},
}))
// very slow
test.skip("snap full", app({
targets: snapTarget,
config: {
extraMetadata: {
name: "se-wo-template",
},
productName: "Snap Electron App (full build)",
snap: {
useTemplateApp: false,
示例11: app
import { Arch, build, Platform } from "electron-builder"
import { readFile, remove, rename } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "../helpers/fileAssert"
import { app, appThrows, modifyPackageJson } from "../helpers/packTester"
import { ELECTRON_VERSION } from "../helpers/testConfig"
test.ifNotWindows.ifNotCiMac("AppImage", app({targets: Platform.LINUX.createTarget()}))
test.ifAll.ifNotWindows.ifNotCiMac("AppImage ia32", app({targets: Platform.LINUX.createTarget("Appimage", Arch.ia32)}))
test.ifNotWindows.ifNotCiMac.ifAll("AppImage - doNotAsk system integration", app({
targets: Platform.LINUX.createTarget(),
config: {
appImage: {
systemIntegration: "doNotAsk",
},
extraResources: {
from: "build/icons"
},
}
}))
test.ifNotWindows.ifNotCiMac("AppImage - default icon, custom executable and custom desktop", app({
targets: Platform.LINUX.createTarget("appimage"),
config: {
linux: {
executableName: "Foo",
desktop: {
Foo: "bar",
Terminal: "true",
示例12: app
import { modifyPackageJson, app, appThrows } from "../helpers/packTester"
import { remove, readFile, rename } from "fs-extra-p"
import * as path from "path"
import { Platform, build } from "electron-builder"
import { assertThat } from "../helpers/fileAssert"
test.ifDevOrLinuxCi("AppImage", app({targets: Platform.LINUX.createTarget()}))
test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom desktop", app({
targets: Platform.LINUX.createTarget("appimage"),
effectiveOptionComputed: async (it) => {
const content = await readFile(it[1], "utf-8")
expect(content.includes("Foo=bar")).toBeTruthy()
expect(content.includes("Terminal=true")).toBeTruthy()
return false
},
config: {
linux: {
executableName: "foo",
desktop: {
Foo: "bar",
Terminal: "true",
},
}
}
}, {
projectDirCreated: it => remove(path.join(it, "build")),
}))
test.ifNotWindows("icons from ICNS", app({targets: Platform.LINUX.createTarget()}, {
projectDirCreated: it => remove(path.join(it, "build", "icons")),