本文整理汇总了TypeScript中electron-builder.Platform类的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform类的具体用法?TypeScript Platform怎么用?TypeScript Platform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Platform类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test("cli", async () => {
// because these methods are internal
const { configureBuildCommand, normalizeOptions } = require("electron-builder/out/builder")
const yargs = require("yargs")
configureBuildCommand(yargs)
function parse(input: string): any {
return normalizeOptions(yargs.parse(input.split(" ")))
}
function expected(opt: any): object {
return {
publish: undefined,
draft: undefined,
prerelease: undefined, ...opt}
}
expect(parse("--platform mac")).toMatchSnapshot()
expect(parse("-owl --x64 --ia32"))
expect(parse("-mwl --x64 --ia32"))
expect(parse("--dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET)}))
expect(parse("--mac --dir")).toMatchSnapshot()
expect(parse("--x64 --dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET, Arch.x64)}))
expect(parse("--platform linux --dir")).toMatchSnapshot()
expect(parse("--arch x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64)}))
expect(parse("--ia32 --x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64, Arch.ia32)}))
expect(parse("--linux")).toMatchSnapshot()
expect(parse("--win")).toMatchSnapshot()
expect(parse("-owl")).toMatchSnapshot()
expect(parse("-l tar.gz:ia32")).toMatchSnapshot()
expect(parse("-l tar.gz:x64")).toMatchSnapshot()
expect(parse("-l tar.gz")).toMatchSnapshot()
expect(parse("-w tar.gz:x64")).toMatchSnapshot()
expect(parse("-c.compress=store -c.asar -c ./config.json")).toMatchObject({
config: {
asar: true,
compress: "store",
extends: "./config.json"
}
})
function parseExtraMetadata(input: string) {
const result = parse(input)
delete result.targets
return result
}
expect(parseExtraMetadata("--em.foo=bar"))
})
开发者ID:jwheare,项目名称:electron-builder,代码行数:53,代码来源:BuildTest.ts
示例2: test
test("cli", async () => {
// because these methods are internal
const { configureBuildCommand, normalizeOptions } = require("electron-builder/out/builder")
const yargs = require("yargs")
configureBuildCommand(yargs)
function parse(input: string): any {
const options = normalizeOptions(yargs.parse(input.split(" ")))
checkBuildRequestOptions(options)
return options
}
function expected(opt: any): object {
return {
draft: undefined,
prerelease: undefined,
...opt
}
}
expect(parse("--platform mac")).toMatchSnapshot()
expect(parse("-owl --x64 --ia32"))
expect(parse("-mwl --x64 --ia32"))
expect(parse("--dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET)}))
expect(parse("--mac --dir")).toMatchSnapshot()
expect(parse("--x64 --dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET, Arch.x64)}))
expect(parse("--platform linux --dir")).toMatchSnapshot()
expect(parse("--arch x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64)}))
expect(parse("--ia32 --x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64, Arch.ia32)}))
expect(parse("--linux")).toMatchSnapshot()
expect(parse("--win")).toMatchSnapshot()
expect(parse("-owl")).toMatchSnapshot()
expect(parse("-l tar.gz:ia32")).toMatchSnapshot()
expect(parse("-l tar.gz:x64")).toMatchSnapshot()
expect(parse("-l tar.gz")).toMatchSnapshot()
expect(parse("-w tar.gz:x64")).toMatchSnapshot()
expect(parse("-p always -w --x64")).toMatchSnapshot()
expect(parse("--prepackaged someDir -w --x64")).toMatchSnapshot()
expect(parse("--project someDir -w --x64")).toMatchSnapshot()
expect(parse("-c.compress=store -c.asar -c ./config.json")).toMatchObject({
config: {
asar: true,
compress: "store",
extends: "./config.json"
}
})
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:51,代码来源:BuildTest.ts
示例3: test
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()
expect(parse("-owl --x64 --ia32"))
expect(parse("-mwl --x64 --ia32"))
expect(parse("--dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET)}))
expect(parse("--mac --dir")).toMatchSnapshot()
expect(parse("--x64 --dir")).toMatchObject(expected({targets: Platform.current().createTarget(DIR_TARGET, Arch.x64)}))
expect(parse("--platform linux --dir")).toMatchSnapshot()
expect(parse("--arch x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64)}))
expect(parse("--ia32 --x64")).toMatchObject(expected({targets: Platform.current().createTarget(null, Arch.x64, Arch.ia32)}))
expect(parse("--linux")).toMatchSnapshot()
expect(parse("--win")).toMatchSnapshot()
expect(parse("-owl")).toMatchSnapshot()
expect(parse("-l tar.gz:ia32")).toMatchSnapshot()
expect(parse("-l tar.gz:x64")).toMatchSnapshot()
expect(parse("-l tar.gz")).toMatchSnapshot()
expect(parse("-w tar.gz:x64")).toMatchSnapshot()
function parseExtraMetadata(input: string) {
const result = parse(input)
delete result.targets
return result
}
expect(parseExtraMetadata("--em.foo=bar"))
})
开发者ID:djpereira,项目名称:electron-builder,代码行数:45,代码来源:BuildTest.ts
示例4: doExtraResourcesTest
async function doExtraResourcesTest(platform: Platform) {
const osName = platform.buildConfigurationKey
//noinspection SpellCheckingInspection
await assertPack("test-app-one", {
// to check NuGet package
targets: platform.createTarget(platform === Platform.WINDOWS ? "squirrel" : DIR_TARGET),
config: {
extraResources: [
"foo",
"bar/hello.txt",
"./dir-relative/f.txt",
"bar/${arch}.txt",
"${os}/${arch}.txt",
],
[osName]: {
extraResources: [
"platformSpecificR"
],
extraFiles: [
"platformSpecificF"
],
}
},
}, {
projectDirCreated: projectDir => {
return BluebirdPromise.all([
outputFile(path.join(projectDir, "foo/nameWithoutDot"), "nameWithoutDot"),
outputFile(path.join(projectDir, "bar/hello.txt"), "data"),
outputFile(path.join(projectDir, "dir-relative/f.txt"), "data"),
outputFile(path.join(projectDir, `bar/${process.arch}.txt`), "data"),
outputFile(path.join(projectDir, `${osName}/${process.arch}.txt`), "data"),
outputFile(path.join(projectDir, "platformSpecificR"), "platformSpecificR"),
outputFile(path.join(projectDir, "ignoreMe.txt"), "ignoreMe"),
])
},
packed: context => {
const base = path.join(context.outDir, `${platform.buildConfigurationKey}${platform === Platform.MAC ? "" : "-unpacked"}`)
let resourcesDir = path.join(base, "resources")
if (platform === Platform.MAC) {
resourcesDir = path.join(base, `${context.packager.appInfo.productFilename}.app`, "Contents", "Resources")
}
return BluebirdPromise.all([
assertThat(path.join(resourcesDir, "foo")).isDirectory(),
assertThat(path.join(resourcesDir, "foo", "nameWithoutDot")).isFile(),
assertThat(path.join(resourcesDir, "bar", "hello.txt")).isFile(),
assertThat(path.join(resourcesDir, "dir-relative", "f.txt")).isFile(),
assertThat(path.join(resourcesDir, "bar", `${process.arch}.txt`)).isFile(),
assertThat(path.join(resourcesDir, osName, `${process.arch}.txt`)).isFile(),
assertThat(path.join(resourcesDir, "platformSpecificR")).isFile(),
assertThat(path.join(resourcesDir, "ignoreMe.txt")).doesNotExist(),
])
},
})
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:55,代码来源:filesTest.ts
示例5: createBuildResourcesTest
function createBuildResourcesTest(platform: Platform) {
return app({
// only dir - avoid DMG
targets: platform.createTarget(platform === Platform.MAC ? DIR_TARGET : null),
config: {
directories: {
buildResources: "custom",
output: "customDist",
// https://github.com/electron-userland/electron-builder/issues/601
app: ".",
}
},
}, {
packed: async context => {
await assertThat(path.join(context.projectDir, "customDist")).isDirectory()
},
projectDirCreated: projectDir => move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
})
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:19,代码来源:ExtraBuildTest.ts
示例6: platform
export function platform(platform: Platform): PackagerOptions {
return {
targets: platform.createTarget()
}
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:5,代码来源:packTester.ts
示例7: build
(async () => {
// Promise is returned
build({
targets: Platform.current().createTarget(),
config: {
appId: "hr.envox.eez.studio",
copyright: "Copyright Š 2018-present Envox d.o.o.",
directories: {
output: "builder-output"
},
files: [
"dist/**",
"libs/**",
"icon.icns",
"icon.ico",
"LICENSE.TXT",
"node_modules/**",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/node_modules/better-sqlite3/build/Release",
"!**/node_modules/usb/build/Release",
"!**/node_modules/@serial-port/bindings/build/Release",
"!**/node_modules/lzz-gyp/lzz-compiled/linux",
"!**/node_modules/lzz-gyp/lzz-compiled/osx",
"!**/node_modules/lzz-gyp/lzz-compiled/bsd",
"!**/*.js.map"
],
extraResources: await getExtraResource(),
fileAssociations: [
{
ext: "eez-project",
name: "EEZ Studio Project",
role: "Editor"
}
],
mac: {
target: ["dmg", "pkg", "zip"],
category: "public.app-category.utilities",
icon: "./icon.icns",
type: "distribution"
},
dmg: {
background: "dist/eez-studio-ui/_images/background.png",
iconSize: 160,
iconTextSize: 12,
window: {
width: 660,
height: 400
},
contents: [
{
x: 180,
y: 170,
type: "file"
},
{
x: 480,
y: 170,
type: "link",
path: "/Applications"
}
]
},
pkg: {
license: "LICENSE.TXT"
},
win: {
target: ["nsis" /*, "portable", "zip"*/],
icon: "./icon.ico"
},
nsis: {
installerIcon: "./icon.ico",
license: "LICENSE.TXT",
warningsAsErrors: false
},
linux: {
target: ["AppImage", "deb", "rpm", "snap"],
icon: "dist/eez-studio-ui/_images/eez_logo.png",
category: "Utility"
},
snap: {
grade: "stable",
summary: "Cross-platform visual development tool and SCPI instrument controller."
},
publish: {
provider: "github",
owner: "notable",
releaseType: "release",
publishAutoUpdate: true
}
}
//.........这里部分代码省略.........
开发者ID:eez-open,项目名称:studio,代码行数:101,代码来源:build-installation-new.ts
注:本文中的electron-builder.Platform类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论