本文整理汇总了TypeScript中electron-builder.build函数的典型用法代码示例。如果您正苦于以下问题:TypeScript build函数的具体用法?TypeScript build怎么用?TypeScript build使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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()
},
示例2: build
async function build(): Promise<void> {
console.log('Remove build directory.');
await remove(BUILD_PATH);
const packageInfo: PackageInfo = await readJson(
path.resolve(DIST_PATH, 'package.json'),
{ throws: true },
);
console.log('Build started...');
const buildTargets = {
mac: os.platform() === 'darwin' ? ['dmg'] : undefined,
linux: ['snap', 'AppImage'],
win: ['nsis'],
};
await Builder.build({
config: {
appId: packageInfo.appId,
productName: packageInfo.productName,
buildVersion: packageInfo.version,
asar: true,
npmRebuild: false,
directories: {
app: DIST_PATH,
output: BUILD_PATH,
},
mac: {
category: 'public.app-category.developer-tools',
darkModeSupport: true,
icon: path.resolve(SRC_PATH, 'assets/logos/icon-logo.icns'),
},
appImage: {
artifactName: '${name}_${version}.${ext}',
},
win: {
artifactName: '${name}_${version}_${arch}.${ext}',
},
extraMetadata: {
name: packageInfo.name,
description: packageInfo.description,
license: packageInfo.license,
author: packageInfo.author,
repository: packageInfo.repository,
},
},
...buildTargets,
});
}
示例3: build
packed: async context => {
await build({
projectDir: context.projectDir,
linux: ["deb"],
config: {
publish: null,
// https://github.com/electron-userland/electron-builder/issues/1355
linux: {
target: [
"AppImage",
"deb",
"rpm"
],
},
compression: "store"
}
})
}
示例4: 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()
},
示例5: 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
}
}
//.........这里部分代码省略.........
示例6: build
import {Platform, build} from 'electron-builder'
//import * as builder from 'electron-builder'
build({
targets:Platform.MAC.createTarget(),
devMetadata:{
build:{
appId:"",
"app-category-type":"",
productName:"Common Accord Desktop",
asar:false,
dmg:{
icon:"build/icon.icns",
"icon-size":128,
background:"build/background.png"
},
files:['web/*/**','index.html','main.js','src/*/**','assets/*/**','package.json','bower_components','node_modules'],
//compression:null, //linux only
icon:"build/icon.icns",
//fileAssociations:{ext:"cmacc", name:"common accord"} //nsis only
},
},
}).then(() => {
}).catch((error) => {
console.log(error)
});