Chromium takes too long to get compiled, like 7 hours on a regular powerful desktop. I'm thinking of some where to get a pre-built Chromium, with which I will be able to compile again only some files to re-link to make a new Chromium binary.
Possible to compile just some source code files and re-link (re-link object files)?
It's hard to build Chromium from source but it's every easy to build a new browser based on Chromium.
With GitHub Electron, any app based on it is a real Chromium browser, and developers may create custom UI for their Electron-based browsers.
However, modern browsers would require having servers for storing users' sync data, this might not be easily affordable for 1-man development army to create a new browser for the mass.
Electron app is a pack of Chromium sandbox, and Node.js backend, the 2 communicate thru' IPC as Node.js will be able to access all resources.
GitHub Electron:
https://electronjs.org
Related
I would like to build an app using Angular + Electron. My app should be able to run both on desktop and browser platforms. I'm considering to use angular-electron starter kit (but I'm open to other possibilities).
What concerns my is the way I read and write data. The data must be stored in a MySQL database. Ideally I would like to:
make the app call an api when NOT running on Electron (browser mode)
make the app query directly the mysql database when running on Electron (desktop mode)
I know I could check for window && window.process && window.process.type to let the app understand wheter running on Electron or not, however I'm a bit concerned about how to handle this. Also because I probably need to import node packages like mysqljs but ONLY in the desktop mode.
You can simply pass in different environment files in Angular during build this allow you to control the environment variables so that you can tell that it is a web app build or an electron app build.
https://angular.io/guide/build
EXTRA
But if you are importing binary packages this is where it gets tricky. I dont think there is a clean way for you to do conditional imports. I did not manage to find a way to do it cleanly and sort of maintained another repository for all my services that needs to import binary files.
To import the binary files you will also need to edit some webpack settings to tell angular to not compile/include the binary files during the build process so that you can use you librarys like mysqljs that require binary files. There is also some settings on the electron end to make binary files compatible for different platforms ie Windows, Mac , Linux. Basically it is really a pain to do it.
Link to how to edit webpack settings for angular 7+
https://github.com/manfredsteyer/ngx-build-plus
I will totally suggest you not to do it unless you really have a very good reason that you need to use these libraries.
EDIT 10/1/19
Okay I was referring to the MySqlJs but it seems like it does not have native modules modules. Native/binary modules basically means javascript code that relies on c++ compiled binaries(Or any native language like rust...).
For my case I was using the grpc modules which has a native dependency. Had to switch to grpc-web in the end.
I will add some footnotes here if you ever need them
https://electronjs.org/docs/tutorial/using-native-node-modules
Node.js / npm - anyway to tell if a package is pure JS or not?
There are a lot of questions on this topic, but they don't seem to distinguish between executables for desktop or server-side apps. I suppose my first question would be: what's the difference? For example, Zeit/pkg says they are a "node.js binary compiler", whereas nwjs (formerly node-webkit) says they are a "an app runtime based on Chromium and node.js".
I tried zeit/pkg and it works great, but have read that there can be performance issues unless it's configured properly. I wanted to make sure I was choosing the right tool and came across nwjs. It seems to do a lot of the same stuff pkg does, but has a larger following, as well as more docs and a robust api. Can I use nwjs as a server-side executable (i.e. not using the desktop feature) the same way I would use pkg?
This answer states that nwjs "is an option, but it really isn't set-up to do a server - client type relationship", but then a comment says "you can launch a server from node-webkit just in the way you launch it in Node.js. It's just that node-webkit provide another way beyond B/S architecture".
So, is nwjs effectively the same as pkg, or fundamentally different?
I realize that there's also Electron, which states "build cross platform desktop apps" and appears similar to nwjs. I'm not trying to get into a Electron vs nwjs debate, but rather desktop vs. server, if there's a difference.
you got most things already, only few clarifications are needed. Reason nw.js / Electron declares itself as for desktop application is, it's core architectural design is intended to integrate node.js with chromium to have UI enables create application does have UI. You can still use part of those framework (node.js side) without initiating visible ui, in that case behaviorwise it'll be similar to plain node.js does. Still there is caveat, like as it tightly integrated with chromium in core already for some cases you should have screen to chromium correctly initiates (or creating virtual buffer as lot of CI does, or etcs).
Also, when your concern is performance, I'd doubt using UI framework for server side work achieves what you desire - while there won't be huge, integration between node to chromium have overhead compare to bare node.js obvioulsy.
Getting back to original question, I feel question itself is somewhat vague. If the intention is truly server side application probably you won't need to package it but correctly deploy node and its dependency modules or packaging it sort of installable manner instead of creating single binary as pkg does.
We are about to start a new project which should be like a desktop app but still run inside a browser for creating items in a system. After these items are created, an .EXE file on the LOCAL machine must be called to do some code generation. Is this possible if using Angular to develop the application or do we need third party libs for executing local .exe's?
No, this is not possible out of the box. Browsers make very sure that local executables cannot be started. You would have to look for other solutions.
One possible idea, depending on how much effort you want to invest, would be to compile the WebKit engine yourself, i.e., create a binary "wrapper" which runs the browser engine itself. Then you are free to extend it in whatever fashion you need, including adding the possibility to start local .exe's (or if those .exe's are your own applications, you could compile them right into your WebKit wrapper).
I think the title should be quite self-explanatory. I am developing a Node JS app using Atom Electron. What I would need is a way to deploy my application in a cross-platform way (Mac OS X, Windows and Linux), while making it capable of automatically updating itself, without having to ask for administration privileges.
Here is what I would like to happen:
The application gets installed by my users, possibly via an easy-to-use installer.
I keep developing my app, adding new features, and so on.
At some point, I release a new version of my code, I pack it somehow and upload it somewhere.
All the clients that are currently online, or whenever a client gets back online, they download the new version, install it, and restart automatically, without having to ask for administration privileges.
As far as I know, there are apps that are capable of doing such a thing. For example, Google Chrome automatically installs updates without having to continuously ask for administrative privileges or, even worse, making its users download new installers all the time.
Is there an elegant and cross platform way to do such a thing? What would be the best solution for my problem?
If this is matters in any way, let me add that my project is completely open source, so I don't care about protecting my code in any way from being read.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to build a code editor in nodejs. There is option like using an express server to show editor and to execute code in backend. But that would require a browser. So I am looking for node modules that can provide standalone gui for windows platform.
There are a couple of different options, depending on how you want to proceed.
Option 1:
Use something like QT or GTK bindings to make a more traditional GUI application. These options generally are just Node bindings to the C/C++ API that GTK and QT expose. See node-qt and yue. Although these seem to not be actively developed.
Update:
You can take a look at NodeGUI: https://github.com/nodegui/nodegui
NodeGUI is a javascript library for building cross-platform native desktop applications with JavaScript and CSS like styling. It uses Qt under the hood and works on Mac, Linux and Windows.
It also has a react based renderer called React NodeGUI which is like React Native but for desktop: https://github.com/nodegui/react-nodegui
Option 2:
Use a framework that takes HTML, CSS, and Javascript and bundles it into a standalone HTML5 app. There are a bunch of frame works out there that do this. Examples include node-webkit and AppJS among many others.
I recommend using an HTML/JS/CSS Framework
Option #1: Electron by GitHub.
Website | GitHub Repo | Releases
It's easier than you think
If you can build a website, you can build a desktop app. Electron is a
framework for creating native applications with web technologies like
JavaScript, HTML, and CSS. It takes care of the hard parts so you can
focus on the core of your application.
Option #2: NW.js (previously known as node-webkit).
Website | GitHub Repo | Releases
Call all Node.js modules directly from DOM/WebWorker and enable a new
way of writing applications with all Web technologies.
Electron and NWJS Pros:
AppJS is officially deprecated
Electron is similar to NW.js but newer, more popular and has a bigger community and updates more frequently. I recommend it.
NWJS always uses the latest Versions of Chromium and Node while Electron takes more time to catch up.
NWJS supports [JavaScript Source Protection][1] by compiling it to V8 native code. Electron does not.
NWJS have a Legacy release for Windows XP and Mac OS X 10.6 support.
Electron and NWJS both use MIT license.
You can compare the contributions to electron with NW.js
Electron and NWJS Cons:
there is no out-of-the-bag run-time solution currently, so you'll have to ship it with your code (~50MB compressed and +100MB uncompressed) or find a way around it.
depending on your app, Electron/NWJS might considered an overkill especially since its startup time is less than ideal, just something to take into account.
no native look, you'll have to create your own UI elements using CSS or using some framework.
Option #3: DeskGap.
Website | GitHub Repo | Releases
DeskGap is a framework for building cross-platform desktop apps with
web technologies (JavaScript, HTML and CSS).
To enable native capabilities while keeping the size down, DeskGap
bundles a Node.js runtime and leaves the HTML rendering to the
operating system‘s webview.
Lightweight since the webview is provided by the operating system.
The API is still quite limited (pretty much a work in progress).
Requires new OS versions.
Apart from the other answers here:
You can take a look at NodeGUI: https://github.com/nodegui/nodegui
NodeGUI is a javascript library for building cross-platform native
desktop applications with JavaScript and CSS like styling. It uses Qt
under the hood and works on Mac, Linux and Windows.
It also has a react based renderer called React NodeGUI which is like React Native but for desktop: https://github.com/nodegui/react-nodegui
Also, its under active development.
I recently discovered https://github.com/yue/yue and I'm having nice experience. It's lightweight, has descent packaging support (and even react/JSX support) and is truly native with decent webview, portable and easy to build target platform's.
Although it seems discontinued I found this project unique, it's really native with options to add a descent webview. I retake some PRs and forked it and I'm adding TypeScript types and documentation since it's really clean/straight forward API, easy to build target platform files. this is my fork although I would like/searching for other users adding missing parts: https://github.com/cancerberoSgx/node-gui . The cons is that it implements node.js event loop so you must use yode (node.js fork) in order for promises and asynchronous code to work well with the GUI code.. m
I wonder if others have experience with this library or forks.
Answer specific to your question may be NodeGui (powered by Qt5, NodeGui-React)
There are many other options. I'm listing a few options below,
electron (Lets you write cross-platform desktop applications using
JavaScript, HTML and CSS, based on Node.js & Chromium)
carlo (Requires Node & Google Chrome to be installed on the system to
run)
NW.js (Similar to electron, provides Source code protection)
DeskGap (bundles a Node.js runtime and leaves the HTML rendering to
the operating system‘s webview)
Proton Native (does the same to desktop that React Native did to
mobile, based on https://github.com/parro-it/libui-node)
For more, you can use my github repo electron-alternatives to pick a cross-platform desktop development option.
Recently also Node-gir may be worth a look: https://github.com/Place1/node-gir
Allows to use Gnome/Glib/Gobject-based libraries from Nodejs. Will allow you to use GTK+.