Skip to content
Permalink
Browse files

fix(packager): allow hooks to be strings or functions depending on co…

…nfig setup
  • Loading branch information
MarshallOfSound committed Dec 17, 2016
1 parent 2d44c41 commit ec0caecc7e8f9a1afc7ca367deedba558e22da0b
Showing with 12 additions and 8 deletions.
  1. +6 −6 README.md
  2. +6 −2 src/electron-forge-package.js
@@ -125,11 +125,7 @@ config object:
You can set `electronPackagerConfig` with **any** of the options from
[Electron Packager](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md).

**NOTE:** The `afterCopy` and `afterExtract` options are mapped to `require`
calls internally, so provide a path to a file that exports your hooks and they
will still run.

**NOTE:** You can also set your `forge` config property of your package.json to point to a JS file the exports the config object like so.
**NOTE:** You can also set your `forge` config property of your package.json to point to a JS file the exports the config object:

```js
{
@@ -139,4 +135,8 @@ will still run.
}
...
}
```
```

**NOTE:** If you use the JSON object then the `afterCopy` and `afterExtract` options are mapped to `require`
calls internally, so provide a path to a file that exports your hooks and they will still run. If you use
the JS file method mentioned above then you can use functions normally.
@@ -73,8 +73,12 @@ const main = async () => {
await rebuildHook(buildPath, electronVersion, pPlatform, pArch);
packagerSpinner = ora.ora('Packaging Application').start();
done();
}].concat(forgeConfig.electronPackagerConfig.afterCopy ? forgeConfig.electronPackagerConfig.afterCopy.map(item => require(item)) : []),
afterExtract: forgeConfig.electronPackagerConfig.afterExtract ? forgeConfig.electronPackagerConfig.afterExtract.map(item => require(item)) : [],
}].concat(forgeConfig.electronPackagerConfig.afterCopy ? forgeConfig.electronPackagerConfig.afterCopy.map(item =>
(typeof item === 'string' ? require(item) : item)
) : []),
afterExtract: forgeConfig.electronPackagerConfig.afterExtract ? forgeConfig.electronPackagerConfig.afterExtract.map(item =>
(typeof item === 'string' ? require(item) : item)
) : [],
dir,
arch,
platform,

0 comments on commit ec0caec

Please sign in to comment.
You can’t perform that action at this time.