當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript electron-builder.build函數代碼示例

本文整理匯總了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()
  },
開發者ID:mbrainiac,項目名稱:electron-builder,代碼行數:14,代碼來源:linuxPackagerTest.ts

示例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,
    });
}
開發者ID:suiruiw,項目名稱:geeks-diary,代碼行數:48,代碼來源:package.ts

示例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"
     }
   })
 }
開發者ID:electron-userland,項目名稱:electron-builder,代碼行數:18,代碼來源:ExtraBuildTest.ts

示例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()
  },
開發者ID:yuya-oc,項目名稱:electron-builder,代碼行數:19,代碼來源:linuxPackagerTest.ts

示例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
            }
        }
//.........這裏部分代碼省略.........
開發者ID:eez-open,項目名稱:studio,代碼行數:101,代碼來源:build-installation-new.ts

示例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)
});
開發者ID:wilmveel,項目名稱:cmacc-electron,代碼行數:31,代碼來源:builder.ts


注:本文中的electron-builder.build函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。