diff --git a/.prettierignore b/.prettierignore index 3f0fb7ea3..177e4d55a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,3 +7,5 @@ # OpenAPI generated specs **/spec.yaml /.nx + +.angular diff --git a/apps/geoadmin-demo/.eslintrc.json b/apps/geoadmin-demo/.eslintrc.json new file mode 100644 index 000000000..c9b6b193a --- /dev/null +++ b/apps/geoadmin-demo/.eslintrc.json @@ -0,0 +1,36 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "geoadmin", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "geoadmin-root", + "style": "kebab-case" + } + ] + }, + "extends": [ + "plugin:@nx/angular", + "plugin:@angular-eslint/template/process-inline-templates" + ] + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/apps/geoadmin-demo/jest.config.ts b/apps/geoadmin-demo/jest.config.ts new file mode 100644 index 000000000..c6a603e7d --- /dev/null +++ b/apps/geoadmin-demo/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'geoadmin-demo', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../coverage/apps/geoadmin-demo', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + 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/apps/geoadmin-demo/project.json b/apps/geoadmin-demo/project.json new file mode 100644 index 000000000..9a304ee1a --- /dev/null +++ b/apps/geoadmin-demo/project.json @@ -0,0 +1,101 @@ +{ + "name": "geoadmin-demo", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "prefix": "geonetwork-ui", + "sourceRoot": "apps/geoadmin-demo/src", + "tags": [], + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/geoadmin-demo", + "index": "apps/geoadmin-demo/src/index.html", + "main": "apps/geoadmin-demo/src/main.ts", + "polyfills": ["zone.js"], + "tsConfig": "apps/geoadmin-demo/tsconfig.app.json", + "assets": [ + "apps/geoadmin-demo/src/favicon.ico", + "apps/geoadmin-demo/src/assets" + ], + "styles": ["apps/geoadmin-demo/src/styles.css"], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "geoadmin-demo:build:production" + }, + "development": { + "browserTarget": "geoadmin-demo:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "geoadmin-demo:build" + } + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "apps/geoadmin-demo/**/*.ts", + "apps/geoadmin-demo/**/*.html" + ] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "apps/geoadmin-demo/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + }, + "serve-static": { + "executor": "@nx/web:file-server", + "options": { + "buildTarget": "geoadmin-demo:build" + } + } + } +} diff --git a/apps/geoadmin-demo/src/assets/.gitkeep b/apps/geoadmin-demo/src/assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/apps/geoadmin-demo/src/favicon.ico b/apps/geoadmin-demo/src/favicon.ico new file mode 100644 index 000000000..317ebcb23 Binary files /dev/null and b/apps/geoadmin-demo/src/favicon.ico differ diff --git a/apps/geoadmin-demo/src/index.html b/apps/geoadmin-demo/src/index.html new file mode 100644 index 000000000..b2f15deba --- /dev/null +++ b/apps/geoadmin-demo/src/index.html @@ -0,0 +1,16 @@ + + + + + Geoadmin + Geocat integration demo + + + + + + + + diff --git a/apps/geoadmin-demo/src/main.ts b/apps/geoadmin-demo/src/main.ts new file mode 100644 index 000000000..01af04e78 --- /dev/null +++ b/apps/geoadmin-demo/src/main.ts @@ -0,0 +1 @@ +// bla diff --git a/apps/geoadmin-demo/src/styles.css b/apps/geoadmin-demo/src/styles.css new file mode 100644 index 000000000..512f60a03 --- /dev/null +++ b/apps/geoadmin-demo/src/styles.css @@ -0,0 +1,13 @@ +/* You can add global styles to this file, and also import other style files */ +html, +body { + height: 100%; +} +body { + margin: 0; +} + +#geoadmin-root { + width: 100%; + height: 100%; +} diff --git a/apps/geoadmin-demo/src/test-setup.ts b/apps/geoadmin-demo/src/test-setup.ts new file mode 100644 index 000000000..a5e675acf --- /dev/null +++ b/apps/geoadmin-demo/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true, + }, +} +import 'jest-preset-angular/setup-jest' diff --git a/apps/geoadmin-demo/tsconfig.app.json b/apps/geoadmin-demo/tsconfig.app.json new file mode 100644 index 000000000..fff4a41d4 --- /dev/null +++ b/apps/geoadmin-demo/tsconfig.app.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": ["src/main.ts"], + "include": ["src/**/*.d.ts"], + "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] +} diff --git a/apps/geoadmin-demo/tsconfig.editor.json b/apps/geoadmin-demo/tsconfig.editor.json new file mode 100644 index 000000000..8ae117d96 --- /dev/null +++ b/apps/geoadmin-demo/tsconfig.editor.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "compilerOptions": { + "types": ["jest", "node"] + } +} diff --git a/apps/geoadmin-demo/tsconfig.json b/apps/geoadmin-demo/tsconfig.json new file mode 100644 index 000000000..e01cf19bd --- /dev/null +++ b/apps/geoadmin-demo/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./tsconfig.editor.json" + } + ], + "extends": "../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/apps/geoadmin-demo/tsconfig.spec.json b/apps/geoadmin-demo/tsconfig.spec.json new file mode 100644 index 000000000..53fbfcdc1 --- /dev/null +++ b/apps/geoadmin-demo/tsconfig.spec.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +}