nrwl nx 平台电子原理图
Nx Electron provides a set of power ups on Nx for developing cross platform desktop apps using Electron.
[!IMPORTANT] This repository follows the semantic versioning rules while adhering to both Nx and Angular versioning scheme. Make sure that
Nx Electronmajor version match Nx major version. I.e. version 21.x ofNx Electronwill be compatible with version 21.y of Nx.
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@21npm install -D nx-electronnx g nx-electron:app --frontendProject=[!IMPORTANT] Make sure to select Integrated monorepo as a project style, and Webpack as a bundler.
[!NOTE] You should add a frontend project to you workspace prior to invoking this command.
[!TIP] On certain frontend platforms (such as Angular, React, etc...) it is important to:
- change the baseHref field to "./".
- Use router outlet hash strategy. Further details can be found here.
[!NOTE]
Nx Electronapplication usually contain both frontend and backend. When you wish to build, serve, test, etc. your application, make sure to invoke the command for both the frontend and the backend. Most of the the time, side-by-side terminal windows are more convenient.
nxe:build:frontend or nx build to build your frontend application.nxe:build:backend or nx build to build your backend application.nxe:serve:frontend or nx serve to serve your frontend application.nxe:serve:backend or nx serve to serve your backend application.nxe:test:frontend or nx test to test your frontend application.nxe:test:backend or nx test to test your backend application.Run nxe:package:app or nx run :package [--options] to package your application.
The options that can be passed are described here.
✦︎ Important
Make sure to build both the frontend project and the backend project before packaging your application.
Run nxe:make:app or nx run :make [--options] to make your standalone application.
The options that can be passed are described here.
✦︎ Important
Make sure to build both the frontend project and the backend project before making your standalone application.
It is possible to configure all the packaging / making options in .\apps\\src\app\options\maker.options.json. For more information read this article.
[!IMPORTANT] Option you define at this file will override the options you pass manually via the command line or choose via the angular console.
To migrate automatically run ng update nx-electron@.
You can find detailed information in the following migration guides.
Regardless of what framework you chose, the resulting file tree will look like this:
/
├── apps/
│ ├── electron-app-name/
│ ├── frontend-app-name/
│ └── frontend-app-name-e2e/
├── libs/
├── tools/
├── nx.json
├── package.json
├── tsconfig.json
└── tslint.jsonIf you're having any problem, please raise an issue on GitHub and we'll be happy to help.
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.
暂无开放 Issues,或尚未同步最近议题。