From ffbd04b5771deea883c35650ec42c8a799eb5114 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Sep 2017 10:17:48 +1000 Subject: [PATCH 1/3] first pass at the electron-winstaller declaration --- .../electron-winstaller-tests.ts | 14 +++ types/electron-winstaller/index.d.ts | 117 ++++++++++++++++++ types/electron-winstaller/tsconfig.json | 23 ++++ types/electron-winstaller/tslint.json | 3 + 4 files changed, 157 insertions(+) create mode 100644 types/electron-winstaller/electron-winstaller-tests.ts create mode 100644 types/electron-winstaller/index.d.ts create mode 100644 types/electron-winstaller/tsconfig.json create mode 100644 types/electron-winstaller/tslint.json diff --git a/types/electron-winstaller/electron-winstaller-tests.ts b/types/electron-winstaller/electron-winstaller-tests.ts new file mode 100644 index 0000000000..91c1923522 --- /dev/null +++ b/types/electron-winstaller/electron-winstaller-tests.ts @@ -0,0 +1,14 @@ +import * as electronInstaller from "electron-winstaller"; + +const options: electronInstaller.Options = { + appDirectory: '/tmp/build/my-app-64', + outputDirectory: '/tmp/build/installer64', + authors: 'My App Inc.', + exe: 'myapp.exe' +}; + +const resultPromise = electronInstaller.createWindowsInstaller(options); + +resultPromise.then( + () => console.log("It worked!"), + (e) => console.log(`No dice: ${e.message}`)); diff --git a/types/electron-winstaller/index.d.ts b/types/electron-winstaller/index.d.ts new file mode 100644 index 0000000000..241482d299 --- /dev/null +++ b/types/electron-winstaller/index.d.ts @@ -0,0 +1,117 @@ +// Type definitions for electron-winstaller 2.6.3 +// Project: https://github.com/electron/windows-installer +// Definitions by: Brendan Forster +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function convertVersion(version: string): string; + +export function createWindowsInstaller(options: Options): Promise; + +type Options = { + /** + * The folder path of your Electron app + */ + appDirectory: string, + /** + * The folder path to create the .exe installer in. + * + * Defaults to the installer folder at the project root. + */ + outputDirectory?: string, + /** + * The local path to a `.gif` file to display during install. + */ + loadingGif?: string, + /** + * The authors value for the nuget package metadata. + * + * Defaults to the `author` field from your app's package.json file when unspecified. + */ + authors: string, + /** + * The owners value for the nuget package metadata. + * + * Defaults to the `authors` field when unspecified. + */ + owners?: string, + /** + * The name of your app's main `.exe` file. + * + * This uses the `name` field in your app's package.json file with an added `.exe` extension when unspecified. + */ + exe?: string, + /** + * The description value for the nuget package metadata. + * + * Defaults to the `description` field from your app's package.json file when unspecified. + */ + description?: string, + /** + * The version value for the nuget package metadata. + * + * Defaults to the `version` field from your app's package.json file when unspecified. + */ + version?: string, + /** + * The title value for the nuget package metadata. + * + * Defaults to the `productName` field and then the `name` field from your app's package.json file when unspecified. + */ + title?: string, + /** + * Windows Application Model ID (appId). + * + * Defaults to the name field in your app's package.json file. + */ + name?: string, + /** + * The path to an Authenticode Code Signing Certificate + */ + certificateFile?: string, + /** + * The password to decrypt the certificate given in `certificateFile` + */ + certificatePassword?: string + /** + * Params to pass to signtool. + * + * Overrides `certificateFile` and `certificatePassword`. + */ + signWithParams?: string, + /** + * A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). + * + * Defaults to the Atom icon. + */ + iconUrl?: string, + /** + * The ICO file to use as the icon for the generated Setup.exe + */ + setupIcon?: string, + /** + * The name to use for the generated Setup.exe file + */ + setupExe?: string, + /** + * The name to use for the generated Setup.msi file + */ + setupMsi?: string, + /** + * Should Squirrel.Windows create an MSI installer? + */ + noMsi?: boolean, + /** + * Should Squirrel.Windows delta packages? (disable only if necessary, they are a Good Thing) + */ + noDelta?: boolean + /** + * A URL to your existing updates. If given, these will be downloaded to create delta updates + */ + remoteReleases?: string, + /** + * Authentication token for remote updates + */ + remoteToken?: string +} + + diff --git a/types/electron-winstaller/tsconfig.json b/types/electron-winstaller/tsconfig.json new file mode 100644 index 0000000000..e7c31f2a6f --- /dev/null +++ b/types/electron-winstaller/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "electron-winstaller-tests.ts" + ] +} \ No newline at end of file diff --git a/types/electron-winstaller/tslint.json b/types/electron-winstaller/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/electron-winstaller/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From da0d364109ac8b1b597323d31b979e1240c4ec6c Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 18 Sep 2017 10:54:18 +1000 Subject: [PATCH 2/3] lint --- types/electron-winstaller/index.d.ts | 48 +++++++++++++--------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/types/electron-winstaller/index.d.ts b/types/electron-winstaller/index.d.ts index 241482d299..bfc294d2a8 100644 --- a/types/electron-winstaller/index.d.ts +++ b/types/electron-winstaller/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for electron-winstaller 2.6.3 +// Type definitions for electron-winstaller 2.6 // Project: https://github.com/electron/windows-installer // Definitions by: Brendan Forster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,111 +7,109 @@ export function convertVersion(version: string): string; export function createWindowsInstaller(options: Options): Promise; -type Options = { +export interface Options { /** * The folder path of your Electron app */ - appDirectory: string, + appDirectory: string; /** * The folder path to create the .exe installer in. * * Defaults to the installer folder at the project root. */ - outputDirectory?: string, + outputDirectory?: string; /** * The local path to a `.gif` file to display during install. */ - loadingGif?: string, + loadingGif?: string; /** * The authors value for the nuget package metadata. * * Defaults to the `author` field from your app's package.json file when unspecified. */ - authors: string, + authors: string; /** * The owners value for the nuget package metadata. * * Defaults to the `authors` field when unspecified. */ - owners?: string, + owners?: string; /** * The name of your app's main `.exe` file. * * This uses the `name` field in your app's package.json file with an added `.exe` extension when unspecified. */ - exe?: string, + exe?: string; /** * The description value for the nuget package metadata. * * Defaults to the `description` field from your app's package.json file when unspecified. */ - description?: string, + description?: string; /** * The version value for the nuget package metadata. * * Defaults to the `version` field from your app's package.json file when unspecified. */ - version?: string, + version?: string; /** * The title value for the nuget package metadata. * * Defaults to the `productName` field and then the `name` field from your app's package.json file when unspecified. */ - title?: string, + title?: string; /** * Windows Application Model ID (appId). * * Defaults to the name field in your app's package.json file. */ - name?: string, + name?: string; /** * The path to an Authenticode Code Signing Certificate */ - certificateFile?: string, + certificateFile?: string; /** * The password to decrypt the certificate given in `certificateFile` */ - certificatePassword?: string + certificatePassword?: string; /** * Params to pass to signtool. * * Overrides `certificateFile` and `certificatePassword`. */ - signWithParams?: string, + signWithParams?: string; /** * A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). * * Defaults to the Atom icon. */ - iconUrl?: string, + iconUrl?: string; /** * The ICO file to use as the icon for the generated Setup.exe */ - setupIcon?: string, + setupIcon?: string; /** * The name to use for the generated Setup.exe file */ - setupExe?: string, + setupExe?: string; /** * The name to use for the generated Setup.msi file */ - setupMsi?: string, + setupMsi?: string; /** * Should Squirrel.Windows create an MSI installer? */ - noMsi?: boolean, + noMsi?: boolean; /** * Should Squirrel.Windows delta packages? (disable only if necessary, they are a Good Thing) */ - noDelta?: boolean + noDelta?: boolean; /** * A URL to your existing updates. If given, these will be downloaded to create delta updates */ - remoteReleases?: string, + remoteReleases?: string; /** * Authentication token for remote updates */ - remoteToken?: string + remoteToken?: string; } - - From a2074748a5e7f882655405608442099946337b80 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Wed, 20 Sep 2017 08:05:07 +1000 Subject: [PATCH 3/3] strictNullChecks: true --- types/electron-winstaller/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/electron-winstaller/tsconfig.json b/types/electron-winstaller/tsconfig.json index e7c31f2a6f..f208c4761f 100644 --- a/types/electron-winstaller/tsconfig.json +++ b/types/electron-winstaller/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "electron-winstaller-tests.ts" ] -} \ No newline at end of file +}