本文整理匯總了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({