Open chiubaka opened 2 years ago
Just playing around with this a little because I'm excited to get here. Messed with nx-electron
and am discovering that their mental model is that you create a web-based React app, and then generate a separate Electron app that points to and wraps that app.
This way you get isolation between the Electron wrapper and the React app itself, which I find very interesting. You can then continue to use the existing React app as a web-based app, but now you have Electron stuff you can play with as well.
I actually like this a lot. The set up isn't working out of the box, so I'll probably need to play with that.
For E2E testing, if going with an Electron wrapper paradigm, the React app itself should be E2E tested with Cypress.
However, there will be at least a few things that probably should be E2E tested against the full Electron app in order to ensure that Native Modules and Electron-specific code are behaving properly (e.g. if I build an overlay, how might I test that it actually displays over other apps?).
There's some discussion around the web about how Cypress does not support Electron (though it seems like they did, once, and ironically Cypress is built using Electron in some capacity).
Playwright has come up as an interesting possible alternative that does have at least experimental Electron support. This thread has more context.
Oh no! Problem with nx-electron
: it's built for Nx v13.10.3 and the project has not been updated in... well, quite a while. This is posing a potential obstacle to getting nx-electron
integrated and making me wonder if I should either:
nx
for nx-electron
so that I can use itnx-electron
directroyHere's what nx-electron
is actually doing:
initGenerator
nx-electron
as the default collectionnx-electron
, electron
, and exitzero
src/app/constants.ts
file with variables loaded by the code sample
project.json
fileOf the above steps, actually most of it is going to be handled by tooling I've already built internally.
The real secret sauce is in the code sample and the project.json
tasks, I think. Which means the executors
from nx-electron
are actually going to be quite pivotal.
Here's some info about the executors:
nx-electron:build
webpack
under the hood. Not clear to me why it doesn't use or extend @nrwl/web:webpack
or @nrwl/node:webpack
@nrwl/web:webpack
nx-electron:execute
electron
-specific sauce here.nx-electron:package
electron-builder
under the hood. There's a good amount of complexity herenx-electron:make
package
executor.Testing story in nx-electron
is reasonable for unit tests, terrible for E2E tests. In upgrading Nx on a fork, I don't know exactly how confident I'd be that I hadn't broken something in actual running tasks for the generated project.
Bumping this so that it doesn't appear stale for import into Linear.