// forge.config.js
const path = require('path');

module.exports = {
    makers: [
        {
            name: '@electron-forge/maker-squirrel',
            config: {
                // see https://github.com/electron/windows-installer for all of the options
                loadingGif: "assets/install.gif" // The local path to a .gif file to display during install.               
            }
        },
        { name: '@electron-forge/maker-zip' },
        { name: '@electron-forge/maker-dmg' },
    ],
    publishers: [
        // see https://www.electronforge.io/config/publishers for more publisher options        
    ],
    // DO NOT REMOVE - keep these hooks
    hooks: {
        async postMake(_config, makeResults) {
            // we need to store the make results after the first publish call. We need the make results to sign the artifacts
            const fs = require('fs');
            const path = require('path');
            const out = path.resolve(__dirname, 'dist', 'makeResults.json');
            fs.mkdirSync(path.dirname(out), { recursive: true });
            fs.writeFileSync(out, JSON.stringify(makeResults, null, 2));
            return makeResults;
        },

        readPackageJson: async (_forgeConfig, packageJson) => {
            // we need this so we don't need to install electron as a dev dependency; the version specified does not matter
            if (!packageJson.devDependencies.electron) {
                packageJson.devDependencies["electron"] = "38.0.0";
            }
            return packageJson;
        }
    },
};