fix(template-base): install correct version of plugin-fuses #3823
+19
−11
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.
Context
In #3480, we added the
@electron/fuses
plugin to our templates.This was done by adding the dependencies directly into the
tmpl/package.json
file for each template like so:forge/packages/template/base/tmpl/package.json
Lines 13 to 16 in 71eb328
This approach eventually caused two problems:
import
command didn't install the correct Fuses dependency (ref Error: Cannot find module '@electron-forge/plugin-fuses' whennpm run make
after importing manually created project #3509)init
script was hard-coding the version to^7.2.0
instead of matching the current Electron Forge version.The first bug was fixed by #3535, which added both
@electron/fuses
and@electron-forge/plugin-fuses
to the base dependencies we install via theinitNPM
utility function:forge/packages/api/core/src/api/init-scripts/init-npm.ts
Lines 18 to 27 in 34c33fa
Solution
#3535 actually made adding the deps via
tmpl/package.json
redundant because they're treated as "common" dependencies (i.e. non-template-specific) and installed anyways. The solution to fixing the second problem is just to remove the deps fromtmpl/package.json
altogether.BaseTemplate
changesWhile crafting this PR, I found that we actually support adding dependencies via templates in another way: adding them to the
TemplateClass.dependencies
orTemplateClass.devDependencies
arrays.The
BaseTemplate
has a getter fordevDependencies
that does the magic replacement for theELECTRON_FORGE/VERSION
syntax, but no equivalent fordependencies
. This PR changes that.It also extends a specific custom initializer fixture to grab
dependencies
anddevDependencies
from the basepackage.json
via these getters so that custom deps are added to what we expect from the base template.