From 9c4db932b7b3707bceb4c6190c1cbb5187d0a056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Borz=C3=AC?= Date: Sun, 17 Mar 2024 11:18:07 +0100 Subject: [PATCH] docs: add NX to README.md (#2822) --- README.md | 64 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index eee4773d3b..62ba0ef07f 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,12 @@ To use Keira3, you don't need to install any dependency. Just [download](https:/ You need to first install [node](https://nodejs.org) in order to have `npm` available in your system. -Install dependencies with npm : +This project uses [NX](https://nx.dev/), you can install it globally using `npm install -g nx@latest` -``` bash -npm install -``` - -If you want to generate Angular components with Angular-cli , you **MUST** install `@angular/cli` in npm global context. -Please follow [Angular-cli documentation](https://github.com/angular/angular-cli) if you had installed a previous version of `angular-cli`. +Then install the dependencies using: ``` bash -npm install -g @angular/cli +npm install ``` Only for **Windows** ([Windows 7 or older versions](https://github.com/azerothcore/Keira3/issues/2212) are not officially supported), install `windows-build-tools` as administrator: @@ -67,7 +62,35 @@ npm install --global-production windows-build-tools ``` This installation will take time and probably your PC will **reboot** during the installation. -### Build +### Running checks on projects + +The entire codebse is organised in [NX](https://nx.dev/) projects (apps and libraries), that are located in: + +- `apps/*` +- `libs/*` + +All lib paths are declared in the [tsconfig.base.json](https://github.com/azerothcore/Keira3/blob/master/tsconfig.base.json) and their names are: + +- `keira-path-name-of-the-project` + +Examples: + +- `keira-features-smart-scripts` +- `keira-main-connection-window` +- `keira-shared-base-editor-components` + +You can run checks such as `lint` or `test` of any project using: + +- `nx lint project-name` +- `nx test project-name` + +Examples: + +- `nx lint keira` +- `nx lint keira-shared-utils` +- `nx test keira-features-creature` + +### Run the app To run the app in local development with hot reload: @@ -77,18 +100,17 @@ npm start More commands: -|Command|Description| -|--|--| -|`npm run ng:serve:web`| Execute the app in the browser with hot reload (NOTE: no Electron/Node lib will work in this case) | -|`npm run build`| Build the app. Your built files are in the /dist folder. | -|`npm run build:prod`| Build the app with Angular aot. Your built files are in the /dist folder. | -|`npm run electron:local`| Builds your application and start electron -|`npm run electron:linux`| Builds your application and creates an app consumable on linux system | -|`npm run electron:windows`| On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems | -|`npm run electron:mac`| On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Mac | -|`npm run test-ci`| Run unit tests once | -|`npm run test`| Run unit tests in watch mode | -|`npm run e2e`| Run e2e tests. It requires to run `npm run build:prod` first | +| Command | Description | +|----------------------------|-------------------------------------------------------------------------------------------------------------| +| `npm run lint` | Run lint of affected projects | +| `npm run test` | Run unit tests of affected projects | +| `npm run e2e` | Run e2e tests. It requires to run `npm run build:prod` first | +| `npm run build` | Build the app. Your built files are in the /dist folder. | +| `npm run build:prod` | Build the app with Angular aot. Your built files are in the /dist folder. | +| `npm run electron:local` | Builds your application and start electron +| `npm run electron:linux` | Builds your application and creates an app consumable on linux system | +| `npm run electron:windows` | On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems | +| `npm run electron:mac` | On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Mac | **Note: Only /dist folder and node dependencies will be included in the executable.**