Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update frontend to Angular 14 #373

Merged
merged 14 commits into from
Mar 15, 2023
Merged
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ node_modules/
src/main/docker/
src/main/resources/static/jdl-studio/
src/test/javascript/protractor.conf.js
src/test/javascript/jest.conf.js
jest.conf.js
coverage/
webpack/
target/
build/
Expand Down
59 changes: 54 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,65 @@
{
"plugins": ["@typescript-eslint/tslint"],
"extends": ["jhipster"],
"parser": "@typescript-eslint/parser",
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"prettier",
"eslint-config-prettier"
],
"env": {
"browser": true,
"es6": true,
"commonjs": true
},
"parserOptions": {
"project": "./tsconfig.json"
"ecmaVersion": 2018,
"sourceType": "module",
"project": ["./tsconfig.json"]
},
"rules": {
"@typescript-eslint/tslint/config": [
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"no-shadow": "off",

"@typescript-eslint/member-ordering": [
"error",
{
"lintFile": "./tslint.json"
"default": ["static-field", "instance-field", "constructor", "static-method", "instance-method"]
}
],
"@typescript-eslint/no-parameter-properties": ["warn", { "allows": ["public", "private", "protected"] }],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/unbound-method": "off",
"spaced-comment": ["warn", "always"],
"guard-for-in": "error",
"no-labels": "error",
"no-caller": "error",
"no-bitwise": "error",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-new-wrappers": "error",
"no-eval": "error",
"no-new": "error",
"no-var": "error",
"radix": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"prefer-const": "error",
"object-shorthand": ["error", "always", { "avoidExplicitReturnArrows": true }],
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.angular/cache
######################
# Project Specific
######################
Expand Down Expand Up @@ -130,6 +131,7 @@ Desktop.ini
*.*~
*~
.merge_file*
coverage/

######################
# Gradle Wrapper
Expand Down
85 changes: 83 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,92 @@
}
},
"prefix": "jhi",
"architect": {}
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack/webpack.custom.js"
},
"outputPath": "target/classes/static/",
"index": "src/main/webapp/index.html",
"main": "src/main/webapp/app/app.main.ts",
"polyfills": "src/main/webapp/app/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/main/webapp/content",
"src/main/webapp/favicon.ico",
"src/main/webapp/manifest.webapp",
"src/main/webapp/robots.txt"
],
"styles": ["src/main/webapp/content/scss/vendor.scss", "src/main/webapp/content/scss/global.scss"],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "jhonline:build:development",
"port": 4200
},
"configurations": {
"production": {
"browserTarget": "jhonline:build:production"
},
"development": {
"browserTarget": "jhonline:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"configPath": "jest.conf.js"
}
}
}
}
},
"defaultProject": "jhonline",
"cli": {
"cache": {
"enabled": true,
"path": "./target/angular/",
"environment": "all"
},
"packageManager": "yarn"
}
}
30 changes: 30 additions & 0 deletions jest.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { pathsToModuleNameMapper } = require('ts-jest');

const {
compilerOptions: { paths = {}, baseUrl = './' }
} = require('./tsconfig.json');
const environment = require('./webpack/environment');

module.exports = {
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'],
testRunner: 'jest-jasmine2',
setupFiles: ['jest-date-mock'],
cacheDirectory: '<rootDir>/target/jest-cache',
coverageDirectory: '<rootDir>/target/test-results/',
globals: {
...environment,
'ts-jest': {
stringifyContentPathRegex: '\\.html$',
tsconfig: '<rootDir>/tsconfig.spec.json'
}
},
coveragePathIgnorePatterns: ['<rootDir>/src/test/javascript'],
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `<rootDir>/${baseUrl}/` }),
reporters: ['default', ['jest-junit', { outputDirectory: './target/test-results/', outputName: 'TESTS-results-jest.xml' }]],
testResultsProcessor: 'jest-sonar-reporter',
testMatch: ['<rootDir>/src/test/javascript/spec/**/@(*.)@(spec.ts)'],
testEnvironmentOptions: {
url: 'http://localhost/'
},
roots: ['<rootDir>', `<rootDir>/${baseUrl}`]
};
Loading