Giter Site home page Giter Site logo

nx-electron's Introduction

Nx Electron

Electron builders and schematics for Nrwl Nx platform.

License NPM Version Downloads Sponsor Star this repo



Features

Nx Electron provides a set of power ups on Nx for developing cross platform desktop apps using Electron.

  • Schematics: Provides schematics for developing cross platform apps in a mono repo environment.
  • Typescript: Uses Typescript to help reduce errors, and create more structured code.
  • Obfuscation: Since Electron are used on the client machines, nx-electron obfuscates you code (and only it).
  • Minimization: Electron apps tend to be quite large, hence we use webpack to bundle, and minimize to code.
  • Live Update: Provides continuous live reload for your backend code.
  • Event Templates: Provides templates for common events like squirrel setup events, auto update events and IPC events.
  • Packaging: Packages your frontend and backend webpack bundles into single electron package.
  • Making: Makes your frontend and backend webpack bundles into single executable.

Getting Started

Prerequisite

This module is based on Nx, you will need to set up an Nx workspace before you can use nx-electron.

npx create-nx-workspace@16

Make sure to select Integrated monorepo as a project style, and Webpack as a bundler. You should also create a frontend project in you workspace (in any nx supported framework you like) for you electron app.

Installation

npm install -D nx-electron

Creating Nx Electron Application

nx g nx-electron:app <electron-app-name> --frontendProject=<frontend-app-name>

NOTE: You should add a frontend project to you workspace prior to invoking this command.

NOTE: On certain frontend platforms (such as Angular, React, etc...) it is important to change the baseHref field to "./", and use the hash strategy on the router in order for it to work well with electron. Further details can be found here.

Building Nx Electron Application

  • Run nx build <electron-app-name> to build your application.

Serving Nx Electron Application

  • Run nx serve <electron-app-name> to serve your application.

Packaging Nx Electron Application

  • Run nx run <electron-app-name>:package [--options] to package your application.
  • Or nx run <electron-app-name>:make --prepackgeOnly to package your application.

The options that can be passed are described here.

Making Nx Electron Application

  • Run nx run <electron-app-name>:make [--options] to make your application.

The options that can be passed are described here.

Configuring static packaging / making options

It is possible to configure all the packaging / making options in .\apps\<electron-app-name>\src\app\options\maker.options.json. For more information read this article. Notice: the option you define at this file will override the options you pass manually via the command line or choose via the angular console.

Migrating Nx Electron Application

To migrate automatically run ng update nx-electron@<version>. You can find detailed information in the following migration guides.

Testing Nx Electron Application

  • Run nx test <electron-app-name> to test your application.

Debugging Nx Electron Application

Minimal Project Structure

Regardless of what framework you chose, the resulting file tree will look like this:

<workspace name>/
├── apps/
│   ├── electron-app-name/
│   ├── frontend-app-name/
│   └── frontend-app-name-e2e/
├── libs/
├── tools/
├── nx.json
├── package.json
├── tsconfig.json
└── tslint.json

Support

If you're having any problem, please raise an issue on GitHub and we'll be happy to help.

Contribute

Versioning

This repository follows the semantic versioning rules while adhering to Nx and Angular version scheme. I.e. version 15.x of nx-electron will be compatible with version 15.y of NX.

Attribution

This project is highly inspired by (and dependent on) Nrwl Nx platform. Under the hood, we use Electron Builder to package and make electron application executables.



Author: Benny Megidish.

nx-electron's People

Contributors

bennymeg avatar dependabot[bot] avatar willpoulson avatar pascalbayer avatar kockicica avatar neil-hyd avatar ericwooley avatar narektutikian avatar johnjcool avatar ratatoeskr666 avatar ashkanyarmoradi avatar adaoud-ims avatar sh-himanshu avatar mvdbastos avatar patdx avatar tbhesswebber avatar s4m0r4m4 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.