Skip to content

Commit

Permalink
feat(electron): allow config/plugin projects to set electron versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Schmidt committed Jul 12, 2021
1 parent b18f0b1 commit 4146f2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var electronDeps = {};
var preloadScripts = [];
var preloadRequires = [];

// Plugins may override electron dependencies. This list should be added to devDependencies in the app package.
const electronDevDeps = ['electron', 'electron-builder'];

const resolvePackages = function(pack, projectDir, packages) {
if (packages) {
if (!Array.isArray(packages)) {
Expand Down Expand Up @@ -97,6 +100,14 @@ const writer = function(thisPackage, outputDir) {
}
}

// electron dependencies contributed by config/plugin projects should be added to devDependencies
Object.keys(electronDeps).forEach((dep) => {
if (electronDevDeps.includes(dep)) {
appPack.devDependencies[dep] = electronDeps[dep];
delete electronDeps[dep];
}
});

// ditch other deps
delete appPack.peerDependencies;
delete appPack.optionalDependencies;
Expand Down

0 comments on commit 4146f2d

Please sign in to comment.