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

Tracking all the electron-forge things #24

Open
dan-fritchman opened this issue Nov 17, 2022 · 0 comments
Open

Tracking all the electron-forge things #24

dan-fritchman opened this issue Nov 17, 2022 · 0 comments

Comments

@dan-fritchman
Copy link
Collaborator

https://github.com/electron/forge has been incredibly valuable for:

  • Configuring and running a hot-reloading dev server
  • Building stand-alone app images, on basically any OS we could want

It also has plenty of configurability, and history.
Tracking how we use it and why, what we'd prefer if possible.


Workspace-ability and "Hoisting"

Hdl21SchematicEditor is a yarn workspace. It has separate packages for:

  • The app which uses electron and electron-forge
  • The VsCode extension
  • The (TBC) "command-line-able" package
  • Shared stuff between them

Workspaces and electron-forge don't seem to play especially nice together. Issues about when googling those topics, the seminal one seeming to be:

electron/forge#869

The authors say it was fixed in electron-forge v6; that seems wrong. We use v6.0.3, and consistently get:

Error: Cannot find the package "electron". Perhaps you need to run "yarn install" 

Unless applying the nohoist option recommended in this comment:

electron/forge#869 (comment)

"private": true,
"workspaces": {
  "nohoist": [
    "electron",
    "electron/**",
    "electron-squirrel-startup",
    "electron-squirrel-startup/**",
    "@electron-forge",
    "@electron-forge/**"
  ]
},

Whereas many of the issue-commenters think of this as a workaround more than a fix, I think it... seems OK here(?). The "hoisting" idea is essentially "copy these package dependencies into some additional local folder where something expects to find them". Which certainly wastes some disk space. But I don't think it breaks anything - especially for the case where we distribute OS-native packages (dmg, deb, etc).


Versions

We rely on a pretty weird-sounding version of electron-forge:

"@electron-forge/cli": "^6.0.0-beta.65",

Some time between that beta.65 and v6.0, they seem to have removed one of my favorite features: live type-checking as the renderer is edited. With beta.65, injecting a type error generates this in the terminal:

ERROR in editor.ts
../EditorCore/src/editor.ts 134:21-25
[tsl] ERROR in editor.ts(134,22)
      TS2552: Cannot find name 'msg_'. Did you mean 'msg'?
 @ ../EditorCore/src/start.tsx 18:17-36
 @ ../EditorCore/src/index.ts 7:14-32
 @ ./src/renderer.js 8:0-35 26:0-5

Which I find really valuable! And it seems this was changed on purpose:

electron-userland/electron-forge-templates#27 (comment)

But I do "want the app to stop running if there are type errors"! And it does - they just don't get reported in the terminal. They show up in the Electron GUI window. But that's aways less helpful, especially compared to the VsCode internal terminal with all its nice source-mapped clickability.

It seems likely there is some configuration-means of making this happen, but I haven't found it.


Templates

We started Hdl21SchematicEditor with the electron-forge webpack template:
https://www.electronforge.io/templates/webpack-template

And then started to add TypeScript. And then pretty much became all TypeScript. So we thought, why not move to the webpack + TypeScript template:
https://www.electronforge.io/templates/typescript-+-webpack-template

Thus far, that hasn't worked. I believe the reasons are tied up in #versions, particularly the difference between electron-forge v6.0 and its beta-predecessors.


I expect the links in here will notify the electron-forge authors. If it does - thanks so much! The overriding message here is: this library has been invaluable. The secondary message is, keeping track of the subtleties of how we use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant