本文整理汇总了TypeScript中electron-packager.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript electron-packager.default方法的具体用法?TypeScript electron-packager.default怎么用?TypeScript electron-packager.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron-packager
的用法示例。
在下文中一共展示了electron-packager.default方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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();
})();
示例2: init
protected init(cb: any) {
packager(paths.electron.packager, (err: any, appPaths: any) => {
console.log(appPaths)
cb()
})
}
示例3: 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'));
}
})
示例4: 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)
}
示例5: 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",
示例6: 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({