Electron React Typescript

screenshot of Electron React Typescript
react
scss

Electron boilerplate with React, Redux, and TypeScript

Overview

electron-react-typescript is a boilerplate that provides an easy start with TypeScript, React, and Electron. It is an Electron application boilerplate based on React, Redux, and Webpack, created for rapid application development using TypeScript.

Features

  • TypeScript: Allows for type-checking and provides better code readability and maintainability.
  • React: A popular JavaScript library for building user interfaces.
  • Electron: A framework for building cross-platform desktop applications.
  • Redux: A predictable state container for JavaScript applications.
  • Webpack: A module bundler that helps package applications.
  • Jest: A JavaScript testing framework for React applications.

Usage

To use electron-react-typescript, follow these steps:

  1. Start both processes simultaneously in different console tabs:
npm run start
  1. This will start the application with hot-reload, allowing you to instantly start developing your application.

Alternatively, you can start both processes in a single process by running the following command:

npm run start-singe-process

Packaging

electron-react-typescript uses Electron Builder to build and package the application. By default, you can run the following command to package for your current platform:

npm run package

This will create an installer for your platform in the "releases" folder.

You can also make builds for specific platforms or multiple platforms by using the options found in the project's documentation. For example, to build for all platforms (Windows, Mac, Linux), you can use the following command:

npm run package-all

Husky and Prettier

This project comes with both Husky and Prettier set up to ensure a consistent code style. To change the code style, you can modify the configuration in the .prettierrc file.

If you want to remove Husky and Prettier from the project, you can follow these steps:

  • Remove the "precommit" command from the scripts section in package.json.
  • Remove the "lint-staged" section from package.json.
  • Remove "lint-staged", "prettier", "eslint-config-prettier", and "husky" from the devDependencies section in package.json.
  • Remove all mentions of Prettier from the "extends" section in .eslintrc.json.

Summary

electron-react-typescript is a boilerplate that provides an easy start for developing desktop applications using TypeScript, React, and Electron. It offers features such as hot-reloading, packaging for different platforms, and consistent code style enforcement. It is based on the Electron React Boilerplate project and React Redux TypeScript guide and is available under the MIT license.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

scss
SCSS

SCSS is a preprocessor scripting language that extends the capabilities of CSS by adding features such as variables, nesting, and mixins. It allows developers to write more efficient and maintainable CSS code, and helps to streamline the development process by reducing repetition and increasing reusability.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

Redux

Redux is a state management library for JavaScript apps that provides a predictable and centralized way to manage application state. It enables developers to write actions and reducers that update the state in response to user interactions, server responses, and other events, and can be used with a variety of front-end frameworks and back-end technologies.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.

webpack
Webpack

Webpack is a popular open-source module bundler for JavaScript applications that bundles and optimizes the code and its dependencies for production-ready deployment. It can also be used to transform other types of assets such as CSS, images, and fonts.