[Proposal] Decouple User Interface from OS specific behavior in Project.
Why ?
- It would be nice for JSUI to also work as a web app in the browser.
- It would make it possible to use JSUI remotely. (Nice, if you want to run a script on a server, or on any number of machines.)
- Handling OS compatibility will become limited to the server code.
- Other use cases ?
One of the first steps to do that is to decouple OS specific behavior (read, parse, edit project information) from the User Interface models.
How ?
Server
When the electron app starts, we create a socket.io server that listens to the client, runs commands and streams back command output, or whatever the client requested.
Client
No external API change should be required on the client models.
In Process and Project we'd need to setup the socket listener on afterCreate and replace the action code with socket emitters.
e.g. moveDependency becomes a one liner : socket.emit('move-dependency', {name, version, isDev})). and the listener to package-json that we created on afterCreate will emit a change when it needs to, reflecting the updated package.json in the project.
I could whip up a fast prototype for this if you're interested in the direction, and we can continue the discussion on a PR.
What do you think ?
Cheers !
Hey, this sounds good but it's not the direction I want to take the project to. Please don't waste time on a PR. We can leave the issue open and talk about it in the future.