本文整理汇总了TypeScript中electron-builder.Platform.LINUX.createTarget方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.LINUX.createTarget方法的具体用法?TypeScript Platform.LINUX.createTarget怎么用?TypeScript Platform.LINUX.createTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron-builder.Platform.LINUX
的用法示例。
在下文中一共展示了Platform.LINUX.createTarget方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
test.ifAll.ifDevOrLinuxCi("default stagePackages", async () => {
for (const p of [["default"], ["default", "custom"], ["custom", "default"], ["foo1", "default", "foo2"]]) {
await assertPack("test-app-one", {
targets: Platform.LINUX.createTarget("snap"),
config: {
extraMetadata: {
name: "sep",
},
productName: "Sep",
snap: {
stagePackages: p,
plugs: p,
confinement: "classic",
// otherwise "parts" will be removed
useTemplateApp: false,
}
},
effectiveOptionComputed: async ({snap}) => {
delete snap.parts.app.source
expect(snap).toMatchSnapshot()
return true
},
})
}
})
示例2: createExtraMetadataTest
function createExtraMetadataTest(asar: boolean) {
return app({
targets: Platform.LINUX.createTarget(DIR_TARGET),
extraMetadata: {
foo: {
bar: 12,
},
build: {
asar: asar,
linux: {
executableName: "new-name",
},
}
},
}, {
projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
data.scripts = {}
data.devDependencies = {"foo": "boo"}
data.foo = {
bar: 42,
existingProp: 22,
}
}),
packed: async context => {
await assertThat(path.join(context.getContent(Platform.LINUX), "new-name")).isFile()
if (asar) {
expect(await readAsarJson(path.join(context.getResources(Platform.LINUX), "app.asar"), "package.json")).toMatchSnapshot()
}
else {
expect(await readJson(path.join(context.getResources(Platform.LINUX), "app", "package.json"))).toMatchSnapshot()
}
}
})
}
示例3: testLinux
async function testLinux(arch: Arch) {
process.env.TEST_UPDATER_PLATFORM = "linux"
process.env.TEST_UPDATER_ARCH = Arch[arch]
const outDirs: Array<string> = []
await doBuild(outDirs, Platform.LINUX.createTarget(["appimage"], arch))
process.env.APPIMAGE = path.join(outDirs[0], `TestApp-1.0.0-${arch === Arch.x64 ? "x86_64" : "i386"}.AppImage`)
await testBlockMap(outDirs[0], path.join(outDirs[1]), AppImageUpdater)
}
示例4: assertPack
test.ifDevOrLinuxCi("unpackDir", () => {
return assertPack("test-app", {
targets: Platform.LINUX.createTarget(DIR_TARGET),
config: {
asarUnpack: ["assets", "b2", "do-not-unpack-dir/file.json"],
}
}, {
projectDirCreated: projectDir => createFiles(path.join(projectDir, "app")),
packed: assertDirs,
})
})
示例5: rename
packed: async context => {
// test https://github.com/electron-userland/electron-builder/issues/1102
const projectDir = context.getResources(Platform.LINUX)
await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar"))
await build({
targets: Platform.LINUX.createTarget(),
projectDir: projectDir,
})
await assertThat(path.join(projectDir, "dist")).isDirectory()
await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile()
},
示例6: testLinux
async function testLinux(arch: Arch) {
process.env.TEST_UPDATER_ARCH = Arch[arch]
const outDirs: Array<string> = []
const tmpDir = new TmpDir("differential-updater-test")
try {
await doBuild(outDirs, Platform.LINUX.createTarget(["appimage"], arch), tmpDir)
process.env.APPIMAGE = path.join(outDirs[0], `TestApp-1.0.0-${arch === Arch.x64 ? "x86_64" : "i386"}.AppImage`)
await testBlockMap(outDirs[0], path.join(outDirs[1]), AppImageUpdater, `__appImage-${Arch[arch]}`, Platform.LINUX)
}
finally {
await tmpDir.cleanup()
}
}
示例7: rename
packed: async context => {
const projectDir = context.getResources(Platform.LINUX)
await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar"))
await build({
targets: Platform.LINUX.createTarget(),
projectDir,
publish: "never",
config: {
electronVersion: ELECTRON_VERSION,
compression: "store",
npmRebuild: false,
}
})
await assertThat(path.join(projectDir, "dist")).isDirectory()
await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile()
},
示例8: assertPack
test.ifDevOrLinuxCi("asarUnpack and files ignore", () => {
return assertPack("test-app", {
targets: Platform.LINUX.createTarget(DIR_TARGET),
config: {
asarUnpack: [
"!**/ffprobe-static/bin/darwin/x64/ffprobe"
],
}
}, {
projectDirCreated: projectDir => outputFile(path.join(projectDir, "node_modules/ffprobe-static/bin/darwin/x64/ffprobe"), "data"),
packed: async context => {
const resourceDir = context.getResources(Platform.LINUX)
await Promise.all([
assertThat(path.join(resourceDir, "app.asar.unpacked", "node_modules/ffprobe-static/bin/darwin/x64/ffprobe")).doesNotExist(),
])
await verifyAsarFileTree(context.getResources(Platform.LINUX))
},
})
})
示例9: createExtraMetadataTest
function createExtraMetadataTest(asar: boolean) {
return app({
targets: Platform.LINUX.createTarget(DIR_TARGET),
config: coerceTypes({
asar,
linux: {
executableName: "new-name",
},
extraMetadata: {
version: "1.0.0-beta.19",
foo: {
bar: 12,
updated: "true",
disabled: "false",
},
rootKey: "false",
rootKeyT: "true",
rootKeyN: "null",
},
}),
}, {
projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
data.scripts = {}
data.devDependencies = {foo: "boo"}
data.foo = {
bar: 42,
existingProp: 22,
}
}),
packed: async context => {
await assertThat(path.join(context.getContent(Platform.LINUX), "new-name")).isFile()
if (asar) {
expect(await readAsarJson(path.join(context.getResources(Platform.LINUX), "app.asar"), "package.json")).toMatchSnapshot()
}
else {
expect(await readJson(path.join(context.getResources(Platform.LINUX), "app", "package.json"))).toMatchSnapshot()
}
}
})
}