Skip to content

Navigation Menu

Sign up

Firebot V6 Tech Explanations

SReject edited this page Sep 14, 2020 · 3 revisions

Electron

If you understand, even a little, of how nodejs works then working within electron will not feel any different. Electron is a fork of nodejs containing all the native functionality you are used to. What you do need to understand about it is this: Electron apps are broken up into two processes:

  • The main process is akin to a nodejs instance. You have access to all of node's features and modules: fs, net, etc. For those with a webdev background it is in essence the server.
  • The renderer process is akin to a browser window of which you are restricted to functionality and security protocols of a typical chrome browser. It serves as the UI for Firebot, in essence it is the browser or client.

These two processes are tied together and communicate via an Inter-Process-Communicator("IPC"). We have abstracted the IPC in such a way you should not have to touch it; instead you just need to go through the abstraction communicator. Its just typescript so isn't hard to follow. For those of a webdev background, the IPC and its abstraction take the place of web requests and websockets for client-server communications

Reactjs

React is a library for creating and manipulating firebot's UI. As stated electron apps are broken up into two parts and as such react is only used within the renderer process. If react is not welcoming to you, then you do not have to touch the UI. You are more than welcome to concentrate on main process development.

TypeScript

Typescript("ts") is a superset of javascript; it is javascript with added features. When firebot is compiled, the typescript compiles into typical js. Its fairly quick to pick up if you have javascript experience. For some it may be quicker to pickup than javascript as the language is more verbose with it's strict typing making code far more clear as to what 'things' are.

TSX

Where typescript is a superset of javascript, tsx is a superset of typescript. It allows developers to include html (and in our case react elements) directly in our source code; no quoting strings or calling DOM functions. If you are at home with html and js/ts then picking up tsx should be well within the next step.

Webpack

Webpack for us serves a few functions in our development pipeline. It compiles our typescript, tsx and sass/scss then bundles it all into a single .js file. As its already been setup for the project, you should not have to touch it at all, thus it is of no concern to you. Think of it as magic that gets invoked when we build the project

ESLint & Prettier

ESLint serves the purpose of catching syntax and coding errors before they make it into a build. It enforces a strict set of rules of how logic should flow. If the logic flow violates those rules, it will warn you of such instances.

Along with ESLint, we've included a library that auto formats your code in regards to whitespacing. Once linting is successful, prettier will automagically format your code.

As a developer you should not need to touch or interact with either of these. They have already been implemented and should work out-of-the-box once you have the project on your computer and setup for developement.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /