forge icon indicating copy to clipboard operation
forge copied to clipboard

feat(core): adding register/unregisterForgeConfigForDirectory to utils

Open IIIMADDINIII opened this issue 1 year ago • 0 comments

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct that this project follows, as appropriate.
  • [x] The changes are appropriately documented (if applicable).
  • [x] The changes have sufficient test coverage (if applicable).
  • [x] The testsuite passes successfully on my local machine (if applicable).

Summary:

Fixes: https://github.com/electron/forge/issues/3510

Currently it is not possible to provide a forge config through the API of @electron-forge/core. This makes integrating electron forge in to other build systems difficult, if these build systems want to provide the configuration for electron forge (for example by using metadata from previous build steps).

This pull request implements two functions utils.registerForgeConfigForDirectory(dir: string, config: ForgeConfig): void and unregisterForgeConfigForDirectory(dir: string): void to make this easier. A "virtual" config registered through the first method behaves as if a forge.config.js file where present at that location exporting the object provided by the config parameter. This takes precedence over any existing config options in an existing forge-config.js or package.json file in that directory.

This is my first contribution to this Project and i do not have a lot of experience in Open Source Development. So If i forgot anything or i should have done something differently, please let me know. Thank You!!

IIIMADDINIII avatar Jun 13 '24 16:06 IIIMADDINIII