Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use a single version of electron-forge #432

Merged
merged 1 commit into from
Dec 18, 2019

Conversation

bendemboski
Copy link
Member

We have two versions of electron-forge kicking around. ember-electron has it as a dependency so it can use it from the blueprint to create the Electron project using electron-forge's init command. When electron-forge creates a project, it installs itself in that project, so we end up with another version in electron-app/package.json.

When ember-electron was calling electron forge commands from ember electron:* commands, it was just require()ing electron-forge, which would get it the version in /node_modules. This could be a different version from the one in electron-app/node_modules, so the user could get different behavior running, e.g. ember electron:make vs. cd electron-app && yarn electron-forge make, breaking the simple mental model.

Also, recently electron-forge released a new beta version that changed the maker interface slighty, so the makers installed in electron-app/ could be out of sync with the electron-forge version that the ember electron commands use. This is probably only a problem while electron-forge is in beta, but is also addressed by this change.

Now, other than the initial Electron project creation that happens from the blueprint, we only use the electron-forge in electron-app, which puts it right next to the makes in package.json allowing the user to easily see and manage the version without any hidden complexity.

Fixes #431

@bendemboski bendemboski force-pushed the single-forge-version branch 2 times, most recently from 84f7f67 to 8605e08 Compare December 7, 2019 06:20
@jacobq
Copy link
Collaborator

jacobq commented Dec 9, 2019

Summarizing to check my understanding:

  1. Motivation: ember-electron should avoid using its own copy (local node_modules) of any electron-forge packages (@electron-forge/*) to avoid discrepancies (e.g. version mismatch) / improve consistency (e.g. effectively the same behavior with ember electron:... as with equivalent forge commands in electron-app).
  2. New file lib/utils/forge-core.js wraps calls to require('@electron-forge/core') and forces use of version in electron-app/node_modules/ (or GLOBAL_FOLDERS) -- throws an error if it's not there.
  3. This behavior is overridden with a stub during tests
  4. When the blueprints are run (e.g. during ember install ember-electron), ember-electron still uses the electron-forge API directly since (presumably) there isn't anything else yet.
    const { api } = require('@electron-forge/core');

We have two versions of electron-forge kicking around. ember-electron has it as a `dependency` so it can use it from the blueprint to create the Electron project using electron-forge's `init` command. When electron-forge creates a project, it installs itself in that project, so we end up with another version in `electron-app/package.json`.

When `ember-electron` was calling electron forge commands from `ember electron:*` commands, it was just `require()`ing electron-forge, which would get it the version in `/node_modules`. This could be a different version from the one in `electron-app/node_modules`, so the user could get different behavior running, e.g. `ember electron:make` vs. `cd electron-app && yarn electron-forge make`, breaking the simple mental model.

Also, recently electron-forge released a new beta version that changed the maker interface slighty, so the makers installed in `electron-app/` could be out of sync with the `electron-forge` version that the `ember electron` commands use. This is probably only a problem while electron-forge is in beta, but is also addressed by this change.

Now, other than the initial Electron project creation that happens from the blueprint, we only use the electron-forge in `electron-app`, which puts it right next to the makes in `package.json` allowing the user to easily see and manage the version without any hidden complexity.

Fixes #431
@bendemboski bendemboski merged commit cd0be69 into master Dec 18, 2019
@bendemboski bendemboski deleted the single-forge-version branch December 18, 2019 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with electron-forge versions
3 participants