[electron-packager]: Update types to 14.0 (#36441)

This commit is contained in:
Florian Keller
2019-06-26 09:46:22 -07:00
committed by Benjamin Lichtman
parent 1fa08d6f12
commit e627b5b66b
3 changed files with 227 additions and 217 deletions
+187 -179
View File
@@ -1,209 +1,217 @@
import packager = require("electron-packager");
import packager = require('electron-packager');
function callback(err: Error, appPaths: string[]) {
const msg = err.message;
const index = appPaths.indexOf("test");
const msg = err.message;
const index = appPaths.indexOf('test');
}
function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) {
callbackFn();
function completeFunction(
buildPath: string,
electronVersion: string,
platform: string,
arch: string,
callbackFn: () => void
) {
callbackFn();
}
function ignoreFunction(path: string) {
return true;
return true;
}
function onCompleted(appPaths: string | string[]) {
}
function onCompleted(appPaths: string | string[]) {}
function onError(error: Error) {
}
function onError(error: Error) {}
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"
}
}).then(onCompleted).catch(onError);
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',
},
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
name: "myapplication",
electronVersion: "0.34.0",
all: true,
win32metadata: {
CompanyName: "Acme CO",
FileDescription: "My application",
OriginalFilename: "myapp.exe",
ProductName: "Application",
InternalName: "roadrunner",
"requested-execution-level": "requireAdministrator",
"application-manifest": "manifest.xml"
}
}).then(onCompleted).catch(onError);
dir: '.',
name: 'myapplication',
electronVersion: '0.34.0',
all: true,
win32metadata: {
CompanyName: 'Acme CO',
FileDescription: 'My application',
OriginalFilename: 'myapp.exe',
ProductName: 'Application',
InternalName: 'roadrunner',
'requested-execution-level': 'requireAdministrator',
'application-manifest': 'manifest.xml',
},
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
name: "myapplication",
platform: "all",
arch: "all",
electronVersion: "0.34.0"
}).then(onCompleted).catch(onError);
dir: '.',
name: 'myapplication',
platform: 'all',
arch: 'all',
electronVersion: '0.34.0',
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
name: "myapplication",
electronVersion: "0.34.0",
all: true
}).then(onCompleted).catch(onError);
dir: '.',
name: 'myapplication',
electronVersion: '0.34.0',
all: true,
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
name: "myapplication",
electronVersion: "0.34.0",
arch: "arm64",
executableName: "myapp"
}).then(onCompleted).catch(onError);
dir: '.',
name: 'myapplication',
electronVersion: '0.34.0',
arch: 'arm64',
executableName: 'myapp',
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
afterCopy: [
completeFunction
],
afterExtract: [
completeFunction
],
afterPrune: [
completeFunction
],
appCopyright: "Copyright",
appVersion: "1.0",
arch: "ia32",
asar: false,
buildVersion: "1.2.3",
derefSymlinks: true,
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: true,
strictSSL: true
},
extraResource: "foo.js",
icon: "foo.ico",
ignore: /ab+c/,
out: "out",
overwrite: true,
prune: true,
quiet: true,
tmpdir: "/tmp",
win32metadata: {
CompanyName: "Acme CO",
FileDescription: "My application",
OriginalFilename: "myapp.exe",
ProductName: "Application",
InternalName: "roadrunner",
"requested-execution-level": "asInvoker",
"application-manifest": "manifest.xml"
}
}).then(onCompleted).catch(onError);
dir: '.',
afterCopy: [completeFunction],
afterExtract: [completeFunction],
afterPrune: [completeFunction],
appCopyright: 'Copyright',
appVersion: '1.0',
arch: 'ia32',
asar: false,
buildVersion: '1.2.3',
derefSymlinks: true,
download: {
cacheRoot: './zips',
mirrorOptions: {
mirror: 'https://10.1.2.105/',
},
},
extraResource: 'foo.js',
icon: 'foo.ico',
ignore: /ab+c/,
out: 'out',
overwrite: true,
prune: true,
quiet: true,
tmpdir: '/tmp',
win32metadata: {
CompanyName: 'Acme CO',
FileDescription: 'My application',
OriginalFilename: 'myapp.exe',
ProductName: 'Application',
InternalName: 'roadrunner',
'requested-execution-level': 'asInvoker',
'application-manifest': 'manifest.xml',
},
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
arch: "x64",
asar: true,
derefSymlinks: false,
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: false,
strictSSL: true
},
extraResource: [
"foo.js",
"bar.js"
],
ignore: [
/ab+c/,
new RegExp('abc')
],
overwrite: false,
platform: "darwin",
prune: false,
quiet: false,
tmpdir: "false",
appBundleId: "123456",
appCategoryType: "public.app-category.developer-tools",
extendInfo: "plist.txt",
helperBundleId: "23223f",
osxSign: true
}).then(onCompleted).catch(onError);
dir: '.',
arch: 'x64',
asar: true,
derefSymlinks: false,
download: {
cacheRoot: './zips',
mirrorOptions: {
mirror: 'https://10.1.2.105/',
},
},
extraResource: ['foo.js', 'bar.js'],
ignore: [/ab+c/, new RegExp('abc')],
overwrite: false,
platform: 'darwin',
prune: false,
quiet: false,
tmpdir: 'false',
appBundleId: '123456',
appCategoryType: 'public.app-category.developer-tools',
extendInfo: 'plist.txt',
helperBundleId: '23223f',
osxSign: true,
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
arch: "armv7l",
asar: {
ordering: "order.txt",
unpack: "*.js",
unpackDir: "sub_dir"
},
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: false,
strictSSL: false
},
ignore: ignoreFunction,
platform: "linux"
}).then(onCompleted).catch(onError);
dir: '.',
arch: 'armv7l',
asar: {
ordering: 'order.txt',
unpack: '*.js',
unpackDir: 'sub_dir',
},
download: {
cacheRoot: './zips',
mirrorOptions: {
mirror: 'https://10.1.2.105/',
},
},
ignore: ignoreFunction,
platform: 'linux',
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
arch: "mips64el",
electronVersion: "1.8.8",
prebuiltAsar: "prebuilt.asar",
platform: "linux"
}).then(onCompleted).catch(onError);
dir: '.',
arch: 'mips64el',
electronVersion: '1.8.8',
prebuiltAsar: 'prebuilt.asar',
platform: 'linux',
})
.then(onCompleted)
.catch(onError);
packager({
dir: ".",
arch: [
"ia32",
"x64"
],
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: true,
strictSSL: false
},
platform: "mas",
extendInfo: {
foo: "bar"
},
osxNotarize: {
appleId: "My ID",
appleIdPassword: "Bad Password"
},
osxSign: {
identity: "myidentity",
entitlements: "path/to/my.entitlements",
"entitlements-inherit": "path/to/inherit.entitlements"
},
protocols: [{
name: "myappproto",
schemes: [
"myapp",
"myapp2"
]
}]
}).then(onCompleted).catch(onError);
dir: '.',
arch: ['ia32', 'x64'],
download: {
cacheRoot: './zips',
mirrorOptions: {
mirror: 'https://10.1.2.105/',
},
},
platform: 'mas',
extendInfo: {
foo: 'bar',
},
osxNotarize: {
appleId: 'My ID',
appleIdPassword: 'Bad Password',
},
osxSign: {
identity: 'myidentity',
entitlements: 'path/to/my.entitlements',
'entitlements-inherit': 'path/to/inherit.entitlements',
},
protocols: [
{
name: 'myappproto',
schemes: ['myapp', 'myapp2'],
},
],
})
.then(onCompleted)
.catch(onError);
+32 -38
View File
@@ -1,4 +1,4 @@
// Type definitions for electron-packager 13.0
// Type definitions for electron-packager 14.0
// Project: https://github.com/electron-userland/electron-packager
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
// Juan Jimenez-Anca <https://github.com/cortopy>
@@ -7,8 +7,15 @@
// Mark Lee <https://github.com/malept>
// Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
/// <reference types="node" />
/// <reference types='node' />
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
import { ElectronDownloadRequestOptions as ElectronDownloadOptions } from '@electron/get';
import { NotarizeOptions } from 'electron-notarize';
import { SignOptions as OsXSignOptions } from 'electron-osx-sign';
export = electronPackager;
@@ -23,7 +30,7 @@ export = electronPackager;
*
* @returns A promise containing the path(s) to the newly created application(s)
*/
declare function electronPackager(opts: electronPackager.Options): Promise<string|string[]>;
declare function electronPackager(opts: electronPackager.Options): Promise<string | string[]>;
declare namespace electronPackager {
/**
@@ -32,12 +39,18 @@ declare namespace electronPackager {
* @param err - Contains errors if any.
* @param appPaths - Path(s) to the newly created application(s).
*/
type finalCallback = (err: Error, appPaths: string|string[]) => void;
type finalCallback = (err: Error, appPaths: string | string[]) => void;
type ignoreFunction = (path: string) => boolean;
type onCompleteFn = (buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) => void;
type arch = "ia32" | "x64" | "armv7l" | "arm64" | "mips64el" | "all";
type platform = "linux" | "win32" | "darwin" | "mas" | "all";
type onCompleteFn = (
buildPath: string,
electronVersion: string,
platform: string,
arch: string,
callbackFn: () => void
) => void;
type arch = 'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'all';
type platform = 'linux' | 'win32' | 'darwin' | 'mas' | 'all';
interface AsarOptions {
ordering?: string;
@@ -45,34 +58,15 @@ declare namespace electronPackager {
unpackDir?: string;
}
interface ElectronDownloadOptions {
cache?: string;
mirror?: string;
quiet?: boolean;
strictSSL?: boolean;
}
interface ElectronNotarizeOptions {
appleId: string;
appleIdPassword: string;
}
interface ElectronOsXSignOptions {
entitlements?: string;
"entitlements-inherit"?: string;
"gatekeeper-assess"?: boolean;
// see https://github.com/electron-userland/electron-packager/blob/92d09bba34599283a794fd6f24b88470f0cb1074/src/mac.js#L359
// see https://github.com/electron-userland/electron-packager/blob/92d09bba34599283a794fd6f24b88470f0cb1074/src/mac.js#L340
interface ElectronOsXSignOptions
extends Omit<OsXSignOptions, 'app' | 'binaries' | 'identity' | 'platform' | 'version'> {
identity?: string | true;
"identity-validation"?: boolean;
ignore?: string;
keychain?: string;
"pre-auto-entitlements"?: boolean;
"pre-embed-provisioning-profile"?: boolean;
"provisioning-profile"?: string;
requirements?: string;
type?: string;
}
// see https://github.com/electron-userland/electron-packager/blob/92d09bba34599283a794fd6f24b88470f0cb1074/src/mac.js#L372
type ElectronNotarizeOptions = Omit<NotarizeOptions, 'appBundleId' | 'appPath'>;
/**
* Object (also known as a "hash") of application metadata to embed into the executable
*/
@@ -82,8 +76,8 @@ declare namespace electronPackager {
OriginalFilename?: string;
ProductName?: string;
InternalName?: string;
"requested-execution-level"?: "asInvoker" | "highestAvailable" | "requireAdministrator";
"application-manifest"?: string;
'requested-execution-level'?: 'asInvoker' | 'highestAvailable' | 'requireAdministrator';
'application-manifest'?: string;
}
/** Electron-packager Options. */
@@ -132,7 +126,7 @@ declare namespace electronPackager {
*/
derefSymlinks?: boolean;
/**
* If present, passes custom options to electron-download
* If present, passes custom options to `@electron/get`
*/
download?: ElectronDownloadOptions;
/**
@@ -199,7 +193,7 @@ declare namespace electronPackager {
* When the value is a String, the filename of a plist file. Its contents are added to the app's plist.
* When the value is an Object, an already-parsed plist data structure that is merged into the app's plist.
*/
extendInfo?: string | {[property: string]: any};
extendInfo?: string | { [property: string]: any };
/**
* The bundle identifier to use in the application helper's plist.
*/
@@ -219,8 +213,8 @@ declare namespace electronPackager {
/** The URL protocol schemes the app supports. */
protocols?: Array<{
name: string
schemes: string[]
name: string;
schemes: string[];
}>;
/**
+8
View File
@@ -0,0 +1,8 @@
{
"private": true,
"dependencies": {
"@electron/get": "^1.3.1",
"electron-notarize": "^0.1.1",
"electron-osx-sign": "^0.4.11"
}
}