feat(core): adding register/unregisterForgeConfigForDirectory to utils #3626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Fixes: #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
andunregisterForgeConfigForDirectory(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!!