How to use the @electron-forge/core.api.install function in @electron-forge/core

To help you get started, we’ve selected a few @electron-forge/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-forge / packages / api / cli / src / electron-forge-install.ts View on Github external
const chooseAsset = async (assets: InstallAsset[]) => {
    const choices: { name: string, value: string }[] = [];
    assets.forEach((asset) => {
      choices.push({ name: asset.name, value: asset.id });
    });
    const { assetID } = await inquirer.createPromptModule()<{ assetID: string }>({
      choices,
      type: 'list',
      name: 'assetID',
      message: 'Multiple potential assets found, please choose one from the list below:'.cyan,
    });

    return assets.find((asset) => asset.id === assetID)!;
  };

  await api.install({
    chooseAsset,
    repo,
    interactive: true,
    prerelease: program.prerelease,
  });
})();