diff --git a/angular.json b/angular.json index 4adf861..22357f9 100644 --- a/angular.json +++ b/angular.json @@ -12,6 +12,7 @@ "appointment-utils": "libs/appointment/utils", "core-domain": "libs/core/domain", "nest-api": "apps/nest-api", - "shared-domain": "libs/shared/domain" + "shared-domain": "libs/shared/domain", + "shared-ui": "libs/shared/ui" } } diff --git a/libs/shared/ui/.eslintrc.json b/libs/shared/ui/.eslintrc.json new file mode 100644 index 0000000..0221f67 --- /dev/null +++ b/libs/shared/ui/.eslintrc.json @@ -0,0 +1,36 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": [ + "plugin:@nrwl/nx/angular", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "im", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "im", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nrwl/nx/angular-template"], + "rules": {} + } + ] +} diff --git a/libs/shared/ui/README.md b/libs/shared/ui/README.md new file mode 100644 index 0000000..66b2964 --- /dev/null +++ b/libs/shared/ui/README.md @@ -0,0 +1,7 @@ +# shared-ui + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test shared-ui` to execute the unit tests. diff --git a/libs/shared/ui/jest.config.ts b/libs/shared/ui/jest.config.ts new file mode 100644 index 0000000..2a205a0 --- /dev/null +++ b/libs/shared/ui/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'shared-ui', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + }, + coverageDirectory: '../../../coverage/libs/shared/ui', + transform: { + '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/libs/shared/ui/project.json b/libs/shared/ui/project.json new file mode 100644 index 0000000..252d1cf --- /dev/null +++ b/libs/shared/ui/project.json @@ -0,0 +1,26 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "sourceRoot": "libs/shared/ui/src", + "prefix": "im", + "targets": { + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/shared/ui"], + "options": { + "jestConfig": "libs/shared/ui/jest.config.ts", + "passWithNoTests": true + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "libs/shared/ui/**/*.ts", + "libs/shared/ui/**/*.html" + ] + } + } + }, + "tags": ["scope:shared type:ui"] +} diff --git a/libs/shared/ui/src/index.ts b/libs/shared/ui/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/libs/shared/ui/src/test-setup.ts b/libs/shared/ui/src/test-setup.ts new file mode 100644 index 0000000..1100b3e --- /dev/null +++ b/libs/shared/ui/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular/setup-jest'; diff --git a/libs/shared/ui/tsconfig.json b/libs/shared/ui/tsconfig.json new file mode 100644 index 0000000..7504c34 --- /dev/null +++ b/libs/shared/ui/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "compilerOptions": { + "target": "es2020", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/libs/shared/ui/tsconfig.lib.json b/libs/shared/ui/tsconfig.lib.json new file mode 100644 index 0000000..dd189dc --- /dev/null +++ b/libs/shared/ui/tsconfig.lib.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": [ + "src/test-setup.ts", + "**/*.spec.ts", + "jest.config.ts", + "**/*.test.ts" + ], + "include": ["**/*.ts"] +} diff --git a/libs/shared/ui/tsconfig.spec.json b/libs/shared/ui/tsconfig.spec.json new file mode 100644 index 0000000..7aa46d8 --- /dev/null +++ b/libs/shared/ui/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index dda726d..e9b5f05 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -26,7 +26,8 @@ "@immomio/appointment/ui": ["libs/appointment/ui/src/index.ts"], "@immomio/appointment/utils": ["libs/appointment/utils/src/index.ts"], "@immomio/core/domain": ["libs/core/domain/src/index.ts"], - "@immomio/shared/domain": ["libs/shared/domain/src/index.ts"] + "@immomio/shared/domain": ["libs/shared/domain/src/index.ts"], + "@immomio/shared/ui": ["libs/shared/ui/src/index.ts"] } }, "exclude": ["node_modules", "tmp"]