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


TypeScript electron-packager類代碼示例

本文整理匯總了TypeScript中electron-packager的典型用法代碼示例。如果您正苦於以下問題:TypeScript electron-packager類的具體用法?TypeScript electron-packager怎麽用?TypeScript electron-packager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了electron-packager類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: packageApp

function packageApp() {
  // not sure if this is needed anywhere, so I'm just going to inline it here
  // for now and see what the future brings...
  const toPackagePlatform = (platform: NodeJS.Platform) => {
    if (platform === 'win32' || platform === 'darwin' || platform === 'linux') {
      return platform
    }
    throw new Error(
      `Unable to convert to platform for electron-packager: '${
        process.platform
      }`
    )
  }

  const toPackageArch = (targetArch: string | undefined): packager.arch => {
    if (targetArch === undefined) {
      return 'x64'
    }

    if (targetArch === 'arm64' || targetArch === 'x64') {
      return targetArch
    }

    throw new Error(
      `Building Desktop for architecture '${targetArch}'  is not supported`
    )
  }

  const options: packager.Options & IPackageAdditionalOptions = {
    name: getExecutableName(),
    platform: toPackagePlatform(process.platform),
    arch: toPackageArch(process.env.TARGET_ARCH),
    asar: false, // TODO: Probably wanna enable this down the road.
    out: getDistRoot(),
    icon: path.join(projectRoot, 'app', 'static', 'logos', 'icon-logo'),
    dir: outRoot,
    overwrite: true,
    tmpdir: false,
    derefSymlinks: false,
    prune: false, // We'll prune them ourselves below.
    ignore: [
      new RegExp('/node_modules/electron($|/)'),
      new RegExp('/node_modules/electron-packager($|/)'),
      new RegExp('/\\.git($|/)'),
      new RegExp('/node_modules/\\.bin($|/)'),
    ],
    appCopyright: 'Copyright Š 2017 GitHub, Inc.',

    // macOS
    appBundleId: getBundleID(),
    appCategoryType: 'public.app-category.developer-tools',
    osxSign: true,
    protocols: [
      {
        name: getBundleID(),
        schemes: [
          isPublishableBuild
            ? 'x-github-desktop-auth'
            : 'x-github-desktop-dev-auth',
          'x-github-client',
          'github-mac',
        ],
      },
    ],

    // Windows
    win32metadata: {
      CompanyName: getCompanyName(),
      FileDescription: '',
      OriginalFilename: '',
      ProductName: getProductName(),
      InternalName: getProductName(),
    },
  }

  return packager(options)
}
開發者ID:soslanashkhotov,項目名稱:desktop,代碼行數:77,代碼來源:build.ts

示例2: callback

import * as packager from "electron-packager";

function callback(err: Error, appPath: string) {
	const msg = err.message;
	const	index = appPath.indexOf("test");
}

packager({
	dir: ".",
	name: "myapplication",
	platform: "win32",
	arch: "all",
	electronVersion: "0.34.0"
}, callback);

packager({
	dir: ".",
	name: "myapplication",
	electronVersion: "0.34.0",
	all: true
}, callback);

packager({
	dir: ".",
	name: "myapplication",
	platform: "win32",
	arch: "all",
	electronVersion: "0.34.0"
}, callback);

packager({
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:electron-packager-tests.ts

示例3: getExtraResource

(async () => {
    try {
        const options: packager.Options = {
            arch: "x64",
            asar: true,
            dir: ".",
            extraResource: await getExtraResource(),
            icon,
            ignore: getIgnore(),
            overwrite: true,
            platform: os.platform(),
            prune: true,

            appCopyright: "Copyright Š 2018-present Envox d.o.o.",
            appVersion: packageJson.version
        };

        const appPaths = await packager(options);

        fs.copyFileSync("./LICENSE.TXT", appPaths[0] + "/LICENSE.EEZSTUDIO.TXT");
    } catch (err) {
        console.error(err);
    }

    process.exit();
})();
開發者ID:eez-open,項目名稱:studio,代碼行數:26,代碼來源:build-installation.ts

示例4: init

    protected init(cb: any) {

        packager(paths.electron.packager, (err: any, appPaths: any) => {
            console.log(appPaths)

            cb()
        })
    }
開發者ID:ifedu,項目名稱:speedseed-multi-tic-tac-toe,代碼行數:8,代碼來源:electron.packager.ts

示例5: packager

gulp.task('package-app', () =>
    packager({
        dir: './dist',
        out: '_package',
        overwrite: true,
        icon: './dist/assets/icon/favicon',
    }, (error, appPaths) => {
        console.log('===========================================================');
        console.log('================ Electron Packager Results ================');
        console.log('===========================================================');
        if (error) {
            console.log(error);
        } else if (appPaths) {
            console.log(appPaths.join('\n'));
        }
    })
開發者ID:acaprojects,項目名稱:a2-composer,代碼行數:16,代碼來源:cli.ts

示例6: completeFunction

function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) {
	callbackFn();
}

function ignoreFunction(path: string) {
	return true;
}

packager({
	dir: ".",
	name: "myapplication",
	platform: "win32",
	arch: "all",
	electronVersion: "0.34.0",
	win32metadata: {
		CompanyName: "Acme CO",
		FileDescription: "My application",
		OriginalFilename: "myapp.exe",
		ProductName: "Application",
		InternalName: "roadrunner",
		"requested-execution-level": "highestAvailable",
		"application-manifest": "manifest.xml"
	}
}, callback);

packager({
	dir: ".",
	name: "myapplication",
	electronVersion: "0.34.0",
	all: true,
	win32metadata: {
		CompanyName: "Acme CO",
開發者ID:Silver-Connection,項目名稱:DefinitelyTyped,代碼行數:32,代碼來源:electron-packager-tests.ts


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