I am going to start a new long-term project and I am responsible of API development.
I decided to use Loopback due to its various features for API rapid development, but it is now built with es5 in contrast of Loopback4
that will come with ES2017 and many modern tools as I see but still in Pre-Beta version.
After some search I found some trials in using ES6 with Loopback3:
This question Loopback models in ES6
and this issue https://github.com/strongloop/loopback/issues/2083#issuecomment-281201056
and no complete/official solution.
Also I think that the feature of upgrade from 3 to 4 will not be available.
The question is: should I use Loopback 3 now with es6 and Babel.
OR use another tool for the current project to avoid refactoring/rebuilding in future, and wait untill Loopback4 is released
Related
I have a main react application in which many other react applications have been developed. This was developed way before I joined. However, this is bothering me , because react applications keep coming in, and technically we keep building using nodejs10 to each new application.
Iam overthinking ?, or something can happen in the future
Can this be supported by node js?
I also considered updating all applications to the latest nodejs. But I'm fearful of the damages or if this idea is even feasible to implement?
From my personal experience, it's quite rare for a Node upgrade to break a React build.
But it all depends on the complexity of the app and the packages used and how old are the dependencies.
I wouldn't say you're overthinking, Node 10 support ended at the end of April so it would be advisable to upgrade to a more recent version.
I would ask the relevant person to have a couple of days to tackle the tech debt and try to upgrade Node to 16.
If you are using nvm you could switch to Node 16 using the --reinstall-packages-from command targeting your current version and try to build.
It's going to take you a couple of minutes.
You can always switch back to 10 with a single command.
I am analyzing the monorepo strategy for some of my framework node modules / libraries that are currently part of different repos. I have around two dozen node modules / libraries and not all of them are used by a single application. Few applications just use a single node module / library whereas others use 5+ of them. I am using a semver for these modules.
If i move to monorepo, what would be the best GIT branching strategy in the following scenario
I planned to support only the two major versions of a module at any time. (latest & latest -1). Latest should have all enhancements & breaking changes. latest - 1 is to support bug fixes of previous release. What would be the best branching model for this scenario ? Note, another developer in my team may modify a different module for bug fixing or he / she may add new enhancements to a module. How do we separate our changes inside a single repo ? what is a proven branching model in this scenario
When developing front-end code for the browser, I often use the es2017 preset when transpiling down to a distribution bundle, which allows me all the conveniences of the included transformers. For conventional modules, I usually stick to whatever the required node engine I've specified for that particular module supports.
I would like to start developing these "conventional" modules using babel transformers as well, but I can foresee drawbacks to this, including:
It might inhibit the debugging workflow (more specifically when working with an IDE)
The performance of the module might suffer
What's the current state on this matter - would you say it makes sense to use babel in conventional modules given the aforementioned and other trade-offs? What are the pros/cons for your preferred workflow?
Bonus question: What are some reputable modules and/or module authors out there that are already using this technique? I've seen Facebook do it for their react ecosystem but I guess that makes sense since those are mostly modules for the browser.
It is converted back to vanilla JS (babel does that part).
What you get is that you can utilize Classes which I found useful.
Hopefully with time, browsers will support ES6 and we will not need babel.
The only drawback is that when debugging, you have to produce a source map, but that is temporary, see above.
To answer your second question: I'm using React in one of the websites, and most of the modules I needed (from npm) are using ES6.
I believe that the trade-offs or drawbacks that you mention both do not apply to developing nodejs code using babel as ES7 transpiler. Personally, I find using ES7 features with node tremendously productive.
There is source map support for debugging. I use karma for testing and it comes with excellent source map support (I use IntelliJ but I believe most IDEs will do). You can checkout this REST-API repository on github. It's a nice stack for building nodejs data backend. It uses karma for testing - even comes with code coverage support. It also integrates with pm2 for scaling and availability.
Regarding performance: I think transpiled code has been shown to run faster in many scenarios than the code a developer would write when not having advanced language features available. I will post some links later.
I don't know with web apps if you still have to use Babel if Node 4 is out which supports ES6 so why would I need babel anymore for any web related code? Or maybe I don't?
I see most apps are using babel but I wonder if people are pulling it out now or is there middleware people typically use in web apps that still rely on it, thus you have to keep it and keep using babel?
Node v4 doesn't support the full feature set of ES2015 (aka ES6). For those that aren't supported you still can use Babel. You can find a list of node's support of ES2015 features in this page.
You say "web related code", which is too broad, but I assume you're interested in browser support as well. No browser supports all ES2015 features yet, so you should use a transpiler like Babel. You can find a table of feature compatibility here.
You will also find that no transpiler has full support either, so be careful when introducing new features.
It's not likely that projects will stop using transpilers yet. Even less so if they want to support older versions of node.
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+.