[NIFI-12940] - Migrate to Nx (#8574)

* [NIFI-12940] - Migrate to Nx

* Set initial focus in the extension creation dialog to the filter input.

This closes #8574
This commit is contained in:
Rob Fellows 2024-03-27 16:34:23 -04:00 committed by GitHub
parent 8e0b83b025
commit a3dda5eb09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 25044 additions and 21564 deletions

View File

@ -154,11 +154,11 @@
<execution>
<id>lint</id>
<goals>
<goal>npm</goal>
<goal>npx</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run lint</arguments>
<arguments>nx lint</arguments>
<workingDirectory>${frontend.working.dir}</workingDirectory>
</configuration>
</execution>
@ -169,11 +169,11 @@
<execution>
<id>unit-tests</id>
<goals>
<goal>npm</goal>
<goal>npx</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>run test</arguments>
<arguments>nx test</arguments>
<workingDirectory>${frontend.working.dir}</workingDirectory>
</configuration>
</execution>
@ -184,11 +184,11 @@
<execution>
<id>package-web-ui</id>
<goals>
<goal>npm</goal>
<goal>npx</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
<arguments>nx build</arguments>
<workingDirectory>${frontend.working.dir}</workingDirectory>
</configuration>
</execution>
@ -209,6 +209,8 @@
<exclude>src/main/nifi/.prettierrc</exclude>
<exclude>src/main/nifi/.prettierignore</exclude>
<exclude>src/main/nifi/dist/**/*</exclude>
<exclude>src/main/nifi/.angular/**/*</exclude>
<exclude>src/main/nifi/.nx/**/*</exclude>
</excludes>
</configuration>
</plugin>

View File

@ -40,3 +40,6 @@ testem.log
# System files
.DS_Store
Thumbs.db
.nx/cache

View File

@ -19,10 +19,6 @@ npm-debug.log
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous

View File

@ -1,27 +1,41 @@
# NiFi
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
## General Info
### Nx
If you are unfamiliar Nx, you can learn more at https://nx.dev/getting-started/intro. They provide many solid resources to get you up to speed.
_From Nx:_
> We created Nx because developers struggle to configure, maintain and especially integrate various tools and frameworks.
> Setting up a system that works well for a handful of developers and at the same time, easily scales up to an entire organization is hard.
> This includes setting up low-level build tooling, configuring fast CI, and keeping your codebase healthy, up-to-date, and maintainable.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
Run `npx nx serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
Run `npx nx generate <generator> <<generator args>>`.
Or better yet, have a look at the [Nx documentation on integrating with IDEs](https://nx.dev/features/integrate-with-editors)
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
Run `npx nx build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via Jest
Run `npx nx test` to execute the unit tests via Jest
## Running end-to-end tests
## Linting the codebase
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
Run `npx nx lint` to execute lint
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
To get more help on the Nx CLI use `npx nx --help`.

View File

@ -1,95 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"nifi": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/nifi",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": [],
"allowedCommonJsDependencies": ["codemirror"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "3mb"
}
],
"outputHashing": "all",
"optimization": true
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true,
"outputHashing": "none"
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"proxyConfig": "proxy.config.mjs",
"buildTarget": "nifi:build"
},
"configurations": {
"production": {
"buildTarget": "nifi:build:production"
},
"development": {
"buildTarget": "nifi:build:development",
"servePath": "/nifi"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "nifi:build"
}
},
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"configPath": "./jest.config.ts"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts"]
}
}
}
}
},
"cli": {
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
}
}

View File

@ -0,0 +1,41 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"test": {
"cache": true,
"inputs": ["default", "^production"]
},
"lint": {
"cache": true,
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
}
},
"defaultBase": "dev",
"namedInputs": {
"sharedGlobals": [],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
]
},
"plugins": [
{
"plugin": "@nx/jest/plugin",
"options": {
"targetName": "test"
}
}
]
}

View File

@ -1,77 +1,84 @@
{
"name": "nifi-web-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --verbose",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"test:dev": "ng test --watch=true",
"prettier": "prettier --config .prettierrc . --check",
"prettier-format": "prettier --config .prettierrc . --write",
"ci": "npm ci --ignore-scripts",
"lint": "ng lint --eslint-config .eslintrc.json",
"lint:fix": "ng lint --eslint-config .eslintrc.json --fix"
},
"private": true,
"dependencies": {
"@angular/animations": "^17.1.3",
"@angular/cdk": "^17.1.2",
"@angular/common": "^17.1.3",
"@angular/compiler": "^17.1.3",
"@angular/core": "^17.1.3",
"@angular/forms": "^17.1.3",
"@angular/material": "^17.1.2",
"@angular/platform-browser": "^17.1.3",
"@angular/platform-browser-dynamic": "^17.1.3",
"@angular/router": "^17.1.3",
"@ctrl/ngx-codemirror": "^7.0.0",
"@fontsource/roboto": "^5.0.12",
"@fontsource/roboto-slab": "^5.0.19",
"@ngrx/effects": "^17.1.0",
"@ngrx/router-store": "^17.1.0",
"@ngrx/store": "^17.1.0",
"@ngrx/store-devtools": "^17.1.0",
"codemirror": "^5.65.16",
"d3": "^7.8.5",
"font-awesome": "4.7.0",
"humanize-duration": "^3.31.0",
"ngrx-immer": "^2.1.1",
"ngx-skeleton-loader": "^8.1.0",
"rxjs": "~7.8.1",
"tslib": "^2.6.2",
"webfontloader": "^1.6.28",
"zone.js": "0.14.4"
},
"devDependencies": {
"@angular-builders/jest": "^17.0.2",
"@angular-devkit/build-angular": "17.2.0",
"@angular-eslint/builder": "17.2.1",
"@angular-eslint/eslint-plugin": "17.2.1",
"@angular-eslint/eslint-plugin-template": "17.2.1",
"@angular-eslint/schematics": "17.2.1",
"@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "~17.1.3",
"@angular/compiler-cli": "^17.1.3",
"@types/codemirror": "^5.60.15",
"@types/d3": "^7.4.3",
"@types/humanize-duration": "^3.27.3",
"@types/jest": "^29.5.12",
"@types/webfontloader": "^1.6.38",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"postcss": "^8.4.32",
"prettier": "3.1.0",
"tailwindcss": "^3.3.6",
"typescript": "5.3.3"
},
"engines": {
"node": ">=21.0.0"
}
"name": "nifi-web-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "nx serve",
"build": "nx build --verbose",
"watch": "nx build --watch --configuration development",
"test": "nx test",
"test:dev": "nx test --watch=true",
"prettier": "prettier --config .prettierrc . --check",
"prettier-format": "prettier --config .prettierrc . --write",
"ci": "npm ci --ignore-scripts",
"lint": "nx lint --eslint-config .eslintrc.json",
"lint:fix": "nx lint --eslint-config .eslintrc.json --fix"
},
"private": true,
"dependencies": {
"@angular/animations": "^17.1.3",
"@angular/cdk": "^17.1.2",
"@angular/common": "^17.1.3",
"@angular/compiler": "^17.1.3",
"@angular/core": "^17.1.3",
"@angular/forms": "^17.1.3",
"@angular/material": "^17.1.2",
"@angular/platform-browser": "^17.1.3",
"@angular/platform-browser-dynamic": "^17.1.3",
"@angular/router": "^17.1.3",
"@ctrl/ngx-codemirror": "^7.0.0",
"@fontsource/roboto": "^5.0.12",
"@fontsource/roboto-slab": "^5.0.19",
"@ngrx/effects": "^17.1.0",
"@ngrx/router-store": "^17.1.0",
"@ngrx/store": "^17.1.0",
"@ngrx/store-devtools": "^17.1.0",
"codemirror": "^5.65.16",
"d3": "^7.8.5",
"font-awesome": "4.7.0",
"humanize-duration": "^3.31.0",
"immer": "10.0.3",
"ngx-skeleton-loader": "^8.1.0",
"rxjs": "~7.8.1",
"tslib": "^2.6.2",
"webfontloader": "^1.6.28",
"zone.js": "0.14.4"
},
"devDependencies": {
"@angular-builders/jest": "^17.0.2",
"@angular-devkit/build-angular": "17.2.0",
"@angular-devkit/core": "~17.1.3",
"@angular-devkit/schematics": "~17.1.3",
"@angular-eslint/builder": "17.2.1",
"@angular-eslint/eslint-plugin": "17.2.1",
"@angular-eslint/eslint-plugin-template": "17.2.1",
"@angular-eslint/schematics": "17.2.1",
"@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "~17.1.3",
"@angular/compiler-cli": "^17.1.3",
"@nx/angular": "18.1.3",
"@nx/jest": "^18.1.3",
"@nx/workspace": "18.1.3",
"@schematics/angular": "~17.1.3",
"@types/codemirror": "^5.60.15",
"@types/d3": "^7.4.3",
"@types/humanize-duration": "^3.27.3",
"@types/jest": "^29.5.12",
"@types/webfontloader": "^1.6.38",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"nx": "18.1.3",
"postcss": "^8.4.32",
"prettier": "3.1.0",
"tailwindcss": "^3.3.6",
"typescript": "5.3.3"
},
"engines": {
"node": ">=21.0.0"
}
}

View File

@ -0,0 +1,86 @@
{
"$schema": "node_modules/nx/schemas/project-schema.json",
"name": "nifi",
"projectType": "application",
"generators": {
"@schematics/angular:component": {
"style": "scss"
}
},
"sourceRoot": "src",
"prefix": "app",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/nifi",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": [],
"allowedCommonJsDependencies": ["codemirror"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "3mb"
}
],
"outputHashing": "all",
"optimization": true
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true,
"outputHashing": "none"
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"options": {
"proxyConfig": "proxy.config.mjs",
"buildTarget": "nifi:build"
},
"configurations": {
"production": {
"buildTarget": "nifi:build:production"
},
"development": {
"buildTarget": "nifi:build:development",
"servePath": "/nifi"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "nifi:build"
}
},
"test": {
"executor": "@angular-builders/jest:run",
"options": {
"configPath": "./jest.config.ts"
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts"]
},
"outputs": ["{options.outputFile}"]
}
}
}

View File

@ -27,6 +27,7 @@
class="px-1.5 py-1 w-64"
type="text"
(keyup)="filterTypes($event)"
cdkFocusInitial
placeholder="Filter types..." />
</mat-form-field>
</div>

View File

@ -74,6 +74,9 @@
<exclude>nifi-web-frontend/src/main/nifi/.prettierrc</exclude>
<exclude>nifi-web-frontend/src/main/nifi/src/.eslintrc</exclude>
<exclude>nifi-web-frontend/target/**/*</exclude>
<exclude>nifi-web-frontend/src/main/nifi/dist/**/*</exclude>
<exclude>nifi-web-frontend/src/main/nifi/.angular/**/*</exclude>
<exclude>nifi-web-frontend/src/main/nifi/.nx/**/*</exclude>
</excludes>
</configuration>
</plugin>