Skip to content

Commit

Permalink
fix: angular setup, fix tests, code optimizations (#305)
Browse files Browse the repository at this point in the history
* fix: angular setup, fix tests, code optimizations

* fix: build
  • Loading branch information
HenryT-CG authored Dec 7, 2024
1 parent d00d570 commit 4bed781
Show file tree
Hide file tree
Showing 32 changed files with 6,183 additions and 5,520 deletions.
49 changes: 8 additions & 41 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
{
"files": ["*.ts", "*.js"],
"env": { "es6": true },
"globals": {
"__dirname": true
},
"globals": { "__dirname": true },
"parserOptions": {
"ecmaVersion": "latest",
"project": "**/tsconfig.json",
Expand All @@ -32,44 +30,19 @@
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:prettier/recommended",
"plugin:deprecation/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"semi": ["error", "never"],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"warn",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"prettier/prettier": [
"error",
{
"singleQuote": true
}
],
"@angular-eslint/directive-selector": ["error", { "type": "attribute", "prefix": "app", "style": "camelCase" }],
"@angular-eslint/component-selector": ["warn", { "type": "element", "prefix": "app", "style": "kebab-case" }],
"deprecation/deprecation": "warn",
"prettier/prettier": ["error", { "singleQuote": true }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
"{}": false
}
}
],
"@typescript-eslint/ban-types": ["error", { "extendDefaults": true, "types": { "{}": false } }],
"@typescript-eslint/no-var-requires": 0
}
},
Expand All @@ -78,13 +51,7 @@
"excludedFiles": ["*inline-template-*.component.html"],
"extends": ["plugin:@angular-eslint/template/recommended", "plugin:prettier/recommended"],
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true,
"parser": "angular"
}
]
"prettier/prettier": ["error", { "singleQuote": true, "parser": "angular" }]
}
}
]
Expand Down
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@
dist
tmp
out-tsc
reports

# dependencies
node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
.idea
.project
.classpath
.c9
.settings
.history
.settings
.vscode
*.launch
*.sublime-workspace

# misc
.nx
.angular
.eslintcache
.husky/_
.sass-cache
.scannerwork
.husky/_
.gitlab*
connect.lock
coverage
reports
typings
*.log
*.sh
Expand Down
8 changes: 4 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Add files here to ignore them from prettier formatting
.angular/**
.husky/**
.docusaurus/
.github/**
.scannerwork/
.eslintcache
.dockerignore
.prettierignore
.browserslistrc
.eslintcache
dist/**
helm/**
nginx/**
reports/**
coverage/**
node_modules
LICENSE
CHANGELOG.md
README.md
Dockerfile
*.log
*.sh
src/app/shared/generated/**
src/assets/api/*
src/assets/api
17 changes: 5 additions & 12 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projects": {
"onecx-announcement-ui": {
"projectType": "application",
"schematics": {},
"schematics": { "@schematics/angular:component": { "style": "scss" } },
"root": "",
"sourceRoot": "src",
"prefix": "app",
Expand All @@ -29,14 +29,10 @@
"output": "/onecx-portal-lib/assets/"
}
],
"styles": [
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/@onecx/portal-integration-angular/assets/styles.scss",
"src/styles.scss"
],
"styles": ["src/styles.scss"],
"scripts": ["node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"],
"extraWebpackConfig": "webpack.config.js",
"outputHashing": "all",
"commonChunk": false
},
"configurations": {
Expand All @@ -52,7 +48,7 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumWarning": "1mb",
"maximumError": "3mb"
},
{
Expand All @@ -67,22 +63,19 @@
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all",
"extraWebpackConfig": "webpack.prod.config.js"
}
},
"defaultConfiguration": "production"
},
"serve": {
"defaultConfiguration": "development",
"builder": "ngx-build-plus:dev-server",
"options": {
"buildTarget": "onecx-announcement-ui:build",
"port": 4200,
"publicHost": "http://localhost:4200",
"extraWebpackConfig": "webpack.config.js",
"proxyConfig": "proxy.conf.js",
"disableHostCheck": true
"proxyConfig": "proxy.conf.js"
},
"configurations": {
"development": {
Expand Down
40 changes: 17 additions & 23 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
// https://karma-runner.github.io/6.4/config/configuration-file.html

module.exports = function (config) {
config.set({
Expand All @@ -14,18 +14,26 @@ module.exports = function (config) {
require('karma-sonarqube-unit-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
port: 9876,
colors: true,
autoWatch: true,
singleRun: false,
restartOnFileChange: true,
browserConsoleLogOptions: { level: 'debug', format: '%b %T: %m', terminal: true },
// export CHROME_BIN=<path to binary>
browsers: ['Chrome'],
customLaunchers: {
Chrome: { base: 'ChromeHeadless', flags: ['--no-sandbox', '--disable-web-security'] }
},
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
random: false
},
// https://jasmine.github.io/api/edge/Configuration.html
jasmine: { random: false },
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
reporters: ['progress', 'coverage', 'sonarqubeUnit'],
preprocessors: { 'src/**/*.js': ['coverage'] },
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
suppressAll: true // remove duplicated traces
},
sonarQubeUnitReporter: {
sonarQubeVersion: 'LATEST',
Expand All @@ -39,20 +47,6 @@ module.exports = function (config) {
dir: 'reports',
subdir: 'coverage', // common name instaed browser-specific
reporters: [{ type: 'text-summary' }, { type: 'lcov' }]
},
reporters: ['progress', 'kjhtml', 'coverage', 'sonarqubeUnit'],
preprocessors: { 'src/**/*.js': ['coverage'] },
port: 9876,
colors: true,
autoWatch: true,
singleRun: false,
restartOnFileChange: true,
browsers: ['HeadlessChrome'],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}
})
}
Loading

0 comments on commit 4bed781

Please sign in to comment.