Skip to content

Commit

Permalink
Adds a hook before MSICreator.create() is called (electron#623)
Browse files Browse the repository at this point in the history
This allows users to take advantage of the template configuration that electron-wix-msi provdes (see https://github.com/felixrieseberg/electron-wix-msi#template-configuration-optional for details)

trailing whitespace removal
  • Loading branch information
Jake Scott authored and MarshallOfSound committed Nov 17, 2018
1 parent ca60a3f commit 9adca97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/maker/wix/src/Config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { MSICreator } from 'electron-wix-msi/lib/creator';

export interface MakerWixConfig {
/**
* String to set as appUserModelId on the shortcut. If none is passed, it'll
Expand Down Expand Up @@ -68,6 +70,10 @@ export interface MakerWixConfig {
* The password to decrypt the certificate given in `certificateFile`.
*/
certificatePassword?: string;
/**
* Allows for the modification of the MSICreator before create is called.
*/
beforeCreate?: (creator: MSICreator) => Promise<void> | void;
}
export interface UIOptions {
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/maker/wix/src/MakerWix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export default class MakerWix extends MakerBase<MakerWixConfig> {
outputDirectory: outPath,
}) as MSICreatorOptions);

if (this.config.beforeCreate) {
await Promise.resolve(this.config.beforeCreate(creator));
}
await creator.create();
const { msiFile } = await creator.compile();

Expand Down

0 comments on commit 9adca97

Please sign in to comment.