Reputation: 31
I been trying to extends electron-forge by creating a new maker, to use innosetup.
Now the documentation is very clean and clear on how to create the new maker by extending the MakerBase and implementing isSupportedOnCurrentPlatform and make, but I'm a bit puzzled as how to consume/register the newly created maker in my code.
maker-inno.js
const path = require("path");
const fs = require("fs");
class MakerInno extends require("@electron-forge/maker-base").default {
isSupportedOnCurrentPlatform() {
return process.platform === "win32";
}
async make(options) {
...
return [pathToOutput];
}
}
module.exports = MakerInno;
forge.config.js
const InnoMaker = require("./scripts/maker-inno.js");
const innoMakerConfig = {};
module.exports = {
...
makers : [
new InnoMaker(innoMakerConfig)
]
...
}
Now, I've debugged the forge make code down to @electron-forge/core/api/make... but by the time the config is loaded and the makers are to be used the forgeConfig is wrapped in Proxy object and in turn so are the makers and from there on it just fails to check my maker.
so that said, a pointer on this would be appriciated.
Side Note: I really hate use of require().default for extending the class, must my code is in typescript but when it comes to config files I'm at a loss, a pointer on cleaner way of doing this would be appreciated :p
Upvotes: 1
Views: 878
Reputation: 31
Well I wasn't able to get this working purely by a local class, so had to create a local package under my project
{
"name": "electron-forge-maker-inno",
"version": "1.0.0",
"description": "InnoSetup maker for Electron Forge",
"main": "dist/index.js",
"scripts": {
"build": "tsc --project tsconfig.json"
},
"engines": {
"node": ">= 10.0.0"
},
"dependencies": {
"@electron-forge/maker-base": "6.0.0-beta.54",
"@electron-forge/shared-types": "6.0.0-beta.54",
"innosetup-compiler": "^5.6.1"
}
}
and reference it in the main projects package.json
"devDependencies": {
...
"electron-forge-maker-inno": "file:scripts/maker-inno",
...
}
then i was able to add the maker to my forge config
module.exports = {
...
makers : [
{ name: "electron-forge-maker-inno", config: innoConfig },
]
...
}
This feels terrible but again it worked, ideally someone will add a Inno Setup Maker to forge. "innosetup-compiler" already done must of the work it just need a forge maker wrapper.
Upvotes: 1