本文整理匯總了TypeScript中electron-builder.Platform.WINDOWS.createTarget方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Platform.WINDOWS.createTarget方法的具體用法?TypeScript Platform.WINDOWS.createTarget怎麽用?TypeScript Platform.WINDOWS.createTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron-builder.Platform.WINDOWS
的用法示例。
在下文中一共展示了Platform.WINDOWS.createTarget方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: copyTestAsset
import { Arch, archFromString, Platform } from "electron-builder"
import { readFile, writeFile } from "fs-extra-p"
import { safeLoad } from "js-yaml"
import * as path from "path"
import { app, assertPack, copyTestAsset } from "../helpers/packTester"
import { checkHelpers, doTest, expectUpdateMetadata } from "../helpers/winHelper"
const nsisTarget = Platform.WINDOWS.createTarget(["nsis"])
test.ifNotCiMac("boring", app({
targets: nsisTarget,
config: {
nsis: {
oneClick: false,
language: "1031",
},
win: {
legalTrademarks: "My Trademark"
},
}
}, {
signedWin: true,
projectDirCreated: projectDir => {
return copyTestAsset("license.txt", path.join(projectDir, "build", "license.txt"))
},
}))
test.ifNotCiMac("boring, MUI_HEADER", () => {
let installerHeaderPath: string | null = null
return assertPack("test-app-one", {
targets: nsisTarget,
示例2: app
import { Arch, Platform } from "electron-builder"
import { app, copyTestAsset } from "../helpers/packTester"
import * as path from "path"
import BluebirdPromise from "bluebird-lst"
import { ensureDir } from "fs-extra-p"
import { isEnvTrue } from "builder-util"
// test that we can get info from protected pfx
const protectedCscLink = "MIIJWQIBAzCCCR8GCSqGSIb3DQEHAaCCCRAEggkMMIIJCDCCA78GCSqGSIb3DQEHBqCCA7AwggOsAgEAMIIDpQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIarkfkLfaZxICAggAgIIDeM22vRfcAQpRZhx+F9DP3lEsOAoFeUT88x2raMceAy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oizFbJoyOvtHgKWjmhuo+MfdwxOjTuMelxGrwgUhxOT+1a2J9xe4/a+XBIbqwzwl+UsZFqrIwL46ZXjwO18yYwbC1P6kAPxFix9vXvzCW/9NXQP1DzuAIrlah9OHgolY/eVFvqDHMTrHKdd9MlqXXZG3+V0wyXuanSx90ot+pA0q0HXS+7rYaCbjDdAhPfSCktK0JSeQ6/b3tqhcUr85+LtHnqnVMJC4oAovnnhkpPve5nwVb9nxVy7YQfFJ6BZJIsReJwZJWjruepcULs0C6U7bgtntb4G0zDDNO3M6CJbcad3XdAS3g+DU7Z3SpYsAL7oy7FyfhifxhGGdlIF9d6oemGPCINkrHlbXMZVjHpXTxpUHZD8Z8uKqqXyGUvdYdI1V53rJRMBtme2ZjQS22XooSytGJRyARx5jFklfu1d7I06w+zk/OTsR/1CCqw5AzN+jusv+vxNtqMh+eA/HHbNCciU0PZQOhCVmzbIwlgV1LaU4eg/l7b4cAc4wv+fB1fVbBZwnbgXwYeE0dk1MKmiMebFVTfa/SaKF0mhfYlh2JvB/prLSi9tNCKzFm9MeusVeGh9WSdv0RT1MGHxs2rVJhMcKcauokYXsJ4fbJtoOF2k9xTbAoP1RQ10AdtbmKkA/s8sXhFFUgb9L43d9qaoW+mFrUhKs5KFPHrIXv4b8njBFTM17BUH6qSl6W2g4MzG87Vy9tSRrKzVD93X40l61kWe/EMSUwIwYJKoZIhvcNAQkVMRYEFCrpr+tDgu4QhTgZmTVVYL5ecKYQMDEwITAJBgUrDgMCGgUABBTe3zOIgwBb2nek2a9OiZ06Rf+zQQQI5vFHTW+9QnICAggA"
const it = process.platform === "darwin" ? test.ifAll.ifDevOrWinCi : test
it.ifDevOrWinCi("AppX", app({
targets: Platform.WINDOWS.createTarget(["appx"], Arch.x64),
}, {
projectDirCreated: async projectDir => {
const targetDir = path.join(projectDir, "build", "appx")
await ensureDir(targetDir)
await BluebirdPromise.map(["BadgeLogo.scale-100.png", "BadgeLogo.scale-140.png", "BadgeLogo.scale-180.png"], name => copyTestAsset(`appx-assets/${name}`, path.join(targetDir, name)))
},
signedWin: true,
}))
it.ifDevOrWinCi("auto launch", app({
targets: Platform.WINDOWS.createTarget(["appx"], Arch.x64),
config: {
appx: {
addAutoLaunchExtension: true,
},
},
}, {
示例3: app
import { Platform, Arch } from "electron-builder"
import * as path from "path"
import { app, copyTestAsset } from "../helpers/packTester"
// build in parallel - https://github.com/electron-userland/electron-builder/issues/1340#issuecomment-286061789
test.ifAll.ifNotCiMac("portable", app({
targets: Platform.WINDOWS.createTarget(["portable", "nsis"]),
config: {
publish: null,
nsis: {
differentialPackage: false,
},
}
}))
test.ifAll.ifDevOrWinCi("portable zip", app({
targets: Platform.WINDOWS.createTarget("portable"),
config: {
publish: null,
portable: {
useZip: true,
unpackDirName: "0ujssxh0cECutqzMgbtXSGnjorm",
},
compression: "normal",
}
}))
test.ifAll.ifNotCi("portable zip several archs", app({
targets: Platform.WINDOWS.createTarget("portable", Arch.ia32, Arch.x64),
config: {
publish: null,
示例4: test
import BluebirdPromise from "bluebird-lst"
import { Arch, Platform } from "electron-builder"
import { writeFile } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "../helpers/fileAssert"
import { app, appThrows, assertPack, copyTestAsset, modifyPackageJson } from "../helpers/packTester"
import { checkHelpers, doTest, expectUpdateMetadata } from "../helpers/winHelper"
const nsisTarget = Platform.WINDOWS.createTarget(["nsis"])
test("one-click", app({
targets: Platform.WINDOWS.createTarget(["nsis"], Arch.ia32),
config: {
publish: {
provider: "bintray",
owner: "actperepo",
package: "TestApp",
},
nsis: {
deleteAppDataOnUninstall: true,
packElevateHelper: false
},
}
}, {
signedWin: true,
packed: async context => {
await checkHelpers(context.getResources(Platform.WINDOWS, Arch.ia32), false)
await doTest(context.outDir, true, "TestApp Setup", "TestApp", null, false)
await expectUpdateMetadata(context, Arch.ia32, true)
}
}))
示例5: app
import { Platform, DIR_TARGET } from "electron-builder"
import { remove, rename, unlink, writeFile } from "fs-extra-p"
import * as path from "path"
import { CheckingWinPackager } from "../helpers/CheckingPackager"
import { app, appThrows, assertPack, platform } from "../helpers/packTester"
test.ifWinCi("beta version", app({
targets: Platform.WINDOWS.createTarget(["squirrel", "nsis"]),
config: {
extraMetadata: {
version: "3.0.0-beta.2",
},
}
}))
test.ifNotCiMac("win zip", app({
targets: Platform.WINDOWS.createTarget(["zip"]),
}))
test.ifNotCiMac.ifAll("zip artifactName", app({
linux: ["appimage"],
win: ["zip"],
config: {
//tslint:disable-next-line:no-invalid-template-strings
artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
},
}))
test.ifNotCiMac("icon < 256", appThrows(platform(Platform.WINDOWS), {
projectDirCreated: projectDir => rename(path.join(projectDir, "build", "incorrect.ico"), path.join(projectDir, "build", "icon.ico"))
}))
示例6: app
import { Arch, Platform } from "electron-builder"
import * as path from "path"
import { CheckingWinPackager } from "../helpers/CheckingPackager"
import { app, assertPack, copyTestAsset } from "../helpers/packTester"
test.ifAll.ifNotCiMac("Squirrel.Windows", app({
targets: Platform.WINDOWS.createTarget(["squirrel"]),
config: {
win: {
compression: "normal",
}
}
}, {signedWin: true}))
test.ifAll.ifNotCiMac("artifactName", app({
targets: Platform.WINDOWS.createTarget(["squirrel", "zip"]),
config: {
win: {
// tslint:disable:no-invalid-template-strings
artifactName: "Test ${name} foo.${ext}",
}
}
}))
// very slow
test.skip("delta and msi", app({
targets: Platform.WINDOWS.createTarget("squirrel", Arch.ia32),
config: {
squirrelWindows: {
remoteReleases: "https://github.com/develar/__test-app-releases",
msi: true,
示例7: app
linux: {
target: [
"AppImage",
"deb",
"rpm"
],
},
compression: "store"
}
})
}
}))
// test https://github.com/electron-userland/electron-builder/issues/1182 also
test.ifAll.ifDevOrWinCi("override targets in the config - only arch", app({
targets: Platform.WINDOWS.createTarget(null, Arch.ia32),
config: {
extraMetadata: {
version: "1.0.0-beta.1",
},
// https://github.com/electron-userland/electron-builder/issues/1348
win: {
// tslint:disable:no-invalid-template-strings
artifactName: "${channel}-${name}.exe",
target: [
"nsis",
],
},
publish: {
provider: "generic",
url: "https://develar.s3.amazonaws.com/test",
示例8: app
import BluebirdPromise from "bluebird-lst"
import { Arch, Platform } from "electron-builder"
import * as path from "path"
import { CheckingWinPackager } from "../helpers/CheckingPackager"
import { app, assertPack, copyTestAsset, modifyPackageJson } from "../helpers/packTester"
test.ifAll.ifNotCiMac("Squirrel.Windows", app({targets: Platform.WINDOWS.createTarget(["squirrel", "zip"])}, {signed: true}))
// very slow
test.skip("delta and msi", app({
targets: Platform.WINDOWS.createTarget("squirrel", Arch.ia32),
config: {
squirrelWindows: {
remoteReleases: "https://github.com/develar/__test-app-releases",
msi: true,
}
},
}))
test.ifAll("detect install-spinner, certificateFile/password", () => {
let platformPackager: CheckingWinPackager = null
let loadingGifPath: string = null
return assertPack("test-app-one", {
targets: Platform.WINDOWS.createTarget("squirrel"),
platformPackagerFactory: (packager, platform, cleanupTasks) => platformPackager = new CheckingWinPackager(packager),
config: {
win: {
certificatePassword: "pass",
}
}
示例9: async
config: {
npmRebuild: true,
beforeBuild: async () => {
called++
}
}
}, {
packed: async () => {
expect(called).toEqual(2)
}
})
})
// https://github.com/electron-userland/electron-builder/issues/1738
test.ifDevOrLinuxCi("win smart unpack", app({
targets: Platform.WINDOWS.createTarget(DIR_TARGET),
config: {
npmRebuild: true,
},
}, {
projectDirCreated: packageJson(it => {
it.dependencies = {
debug: "3.1.0",
"edge-cs": "1.2.1",
"@electron-builder/test-smart-unpack": "1.0.0",
"@electron-builder/test-smart-unpack-empty": "1.0.0",
}
}),
packed: context => verifySmartUnpack(context.getResources(Platform.WINDOWS))
}))
示例10: app
import { Platform } from "electron-builder"
import * as path from "path"
import { app, copyTestAsset } from "../helpers/packTester"
// build in parallel - https://github.com/electron-userland/electron-builder/issues/1340#issuecomment-286061789
test.ifAll.ifNotCiMac("portable", app({
targets: Platform.WINDOWS.createTarget(["portable", "nsis"]),
config: {
publish: null,
nsis: {
differentialPackage: false,
},
}
}))
test.ifNotCiMac("portable - artifactName and request execution level", app({
targets: Platform.WINDOWS.createTarget(["portable"]),
config: {
nsis: {
artifactName: "${productName}Installer.${version}.${ext}",
installerIcon: "foo test space.ico",
},
portable: {
requestExecutionLevel: "admin",
artifactName: "${productName}Portable.${version}.${ext}"
}
},
}, {
projectDirCreated: projectDir => {
return copyTestAsset("headerIcon.ico", path.join(projectDir, "build", "foo test space.ico"))
},
示例11: app
},
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: {
protonNodeVersion: "current",
},
}, checkOptions))
示例12: app
import { Platform } from "electron-builder"
import { app } from "../helpers/packTester"
test.ifWinCi("AppX", app({targets: Platform.WINDOWS.createTarget(["appx"])}))
示例13: app
import { Arch, Platform } from "electron-builder"
import { app } from "../helpers/packTester"
// tests are heavy, to distribute tests across CircleCI machines evenly, these tests were moved from oneClickInstallerTest
test.ifNotCiMac("web installer", app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.x64),
config: {
publish: {
provider: "s3",
bucket: "develar",
path: "test",
},
}
}))
test.ifAll.ifNotCiMac("web installer (default github)", app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.ia32, Arch.x64),
config: {
publish: {
provider: "github",
// test form without owner
repo: "foo/bar"
}
},
}))
示例14: app
import { app } from "../helpers/packTester"
import { Platform } from "electron-builder"
test.ifAll.ifDevOrWinCi("msi", app({
targets: Platform.WINDOWS.createTarget("msi"),
config: {
appId: "build.electron.test.msi.oneClick.perMachine",
extraMetadata: {
// version: "1.0.0",
},
productName: "Test MSI",
}
}, {
// signed: true,
}))
test.ifAll.ifDevOrWinCi("per-user", app({
targets: Platform.WINDOWS.createTarget("msi"),
config: {
appId: "build.electron.test.msi.oneClick.perUser",
extraMetadata: {
// version: "1.0.0",
},
productName: "Test MSI Per User",
msi: {
perMachine: false,
}
}
}, {
// signed: true,
}))