From 0fb33ae71cca4ac8686fc8bd258ee144e051d240 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 17 Oct 2022 20:41:13 +0200 Subject: [PATCH] Feature/migrate angular.json to project.json (#1374) * Migrate angular.json to project.json * Update changelog --- CHANGELOG.md | 6 + Dockerfile | 1 - angular.json | 395 ----------------------------------- apps/api/project.json | 54 +++++ apps/client-e2e/project.json | 22 ++ apps/client/project.json | 201 ++++++++++++++++++ apps/ui-e2e/project.json | 28 +++ libs/common/project.json | 22 ++ libs/ui/project.json | 57 +++++ package.json | 8 +- 10 files changed, 394 insertions(+), 400 deletions(-) delete mode 100644 angular.json create mode 100644 apps/api/project.json create mode 100644 apps/client-e2e/project.json create mode 100644 apps/client/project.json create mode 100644 apps/ui-e2e/project.json create mode 100644 libs/common/project.json create mode 100644 libs/ui/project.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 03fa316ed..068ad79b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Migrated the `angular.json` to `project.json` files in the `Nx` workspace + ## 1.205.2 - 16.10.2022 ### Changed diff --git a/Dockerfile b/Dockerfile index eaf857fe5..5bc79b61a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,6 @@ RUN yarn install COPY ./decorate-angular-cli.js decorate-angular-cli.js RUN node decorate-angular-cli.js -COPY ./angular.json angular.json COPY ./nx.json nx.json COPY ./replace.build.js replace.build.js COPY ./jest.preset.js jest.preset.js diff --git a/angular.json b/angular.json deleted file mode 100644 index 1ceea18c1..000000000 --- a/angular.json +++ /dev/null @@ -1,395 +0,0 @@ -{ - "version": 1, - "projects": { - "api": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "apps/api", - "sourceRoot": "apps/api/src", - "projectType": "application", - "prefix": "api", - "schematics": {}, - "architect": { - "build": { - "builder": "@nrwl/node:webpack", - "options": { - "outputPath": "dist/apps/api", - "main": "apps/api/src/main.ts", - "tsConfig": "apps/api/tsconfig.app.json", - "assets": ["apps/api/src/assets"] - }, - "configurations": { - "production": { - "generatePackageJson": true, - "optimization": true, - "extractLicenses": true, - "inspect": false, - "fileReplacements": [ - { - "replace": "apps/api/src/environments/environment.ts", - "with": "apps/api/src/environments/environment.prod.ts" - } - ] - } - }, - "outputs": ["{options.outputPath}"] - }, - "serve": { - "builder": "@nrwl/node:node", - "options": { - "buildTarget": "api:build" - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["apps/api/**/*.ts"] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "apps/api/jest.config.ts", - "passWithNoTests": true - }, - "outputs": ["coverage/apps/api"] - } - }, - "tags": [] - }, - "client": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "apps/client", - "sourceRoot": "apps/client/src", - "prefix": "gf", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/apps/client", - "index": "apps/client/src/index.html", - "main": "apps/client/src/main.ts", - "polyfills": "apps/client/src/polyfills.ts", - "tsConfig": "apps/client/tsconfig.app.json", - "assets": [ - { - "glob": "assetlinks.json", - "input": "apps/client/src/assets", - "output": "./../.well-known" - }, - { - "glob": "CHANGELOG.md", - "input": "", - "output": "./../assets" - }, - { - "glob": "LICENSE", - "input": "", - "output": "./../assets" - }, - { - "glob": "robots.txt", - "input": "apps/client/src/assets", - "output": "./../" - }, - { - "glob": "sitemap.xml", - "input": "apps/client/src/assets", - "output": "./../" - }, - { - "glob": "**/*", - "input": "node_modules/ionicons/dist/ionicons", - "output": "./../ionicons" - }, - { - "glob": "**/*.js", - "input": "node_modules/ionicons/dist/", - "output": "./../" - }, - { - "glob": "**/*", - "input": "apps/client/src/assets", - "output": "./../assets/" - } - ], - "styles": ["apps/client/src/styles.scss"], - "scripts": ["node_modules/marked/marked.min.js"], - "vendorChunk": true, - "extractLicenses": false, - "buildOptimizer": false, - "sourceMap": true, - "optimization": false, - "namedChunks": true - }, - "configurations": { - "development-de": { - "baseHref": "/de/", - "localize": ["de"] - }, - "development-en": { - "baseHref": "/en/", - "localize": ["en"] - }, - "development-es": { - "baseHref": "/es/", - "localize": ["es"] - }, - "development-it": { - "baseHref": "/it/", - "localize": ["it"] - }, - "development-nl": { - "baseHref": "/nl/", - "localize": ["nl"] - }, - "production": { - "fileReplacements": [ - { - "replace": "apps/client/src/environments/environment.ts", - "with": "apps/client/src/environments/environment.prod.ts" - } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "budgets": [ - { - "type": "initial", - "maximumWarning": "2mb", - "maximumError": "5mb" - }, - { - "type": "anyComponentStyle", - "maximumWarning": "6kb", - "maximumError": "10kb" - } - ] - } - }, - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "" - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "client:build", - "proxyConfig": "apps/client/proxy.conf.json" - }, - "configurations": { - "development-de": { - "browserTarget": "client:build:development-de" - }, - "development-en": { - "browserTarget": "client:build:development-en" - }, - "development-es": { - "browserTarget": "client:build:development-es" - }, - "development-it": { - "browserTarget": "client:build:development-it" - }, - "development-nl": { - "browserTarget": "client:build:development-nl" - }, - "production": { - "browserTarget": "client:build:production" - } - } - }, - "extract-i18n": { - "builder": "ng-extract-i18n-merge:ng-extract-i18n-merge", - "options": { - "browserTarget": "client:build", - "includeContext": true, - "outputPath": "src/locales", - "targetFiles": [ - "messages.de.xlf", - "messages.es.xlf", - "messages.it.xlf", - "messages.nl.xlf" - ] - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["apps/client/**/*.ts"] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "apps/client/jest.config.ts", - "passWithNoTests": true - }, - "outputs": ["coverage/apps/client"] - } - }, - "i18n": { - "locales": { - "de": { - "baseHref": "/de/", - "translation": "apps/client/src/locales/messages.de.xlf" - }, - "es": { - "baseHref": "/es/", - "translation": "apps/client/src/locales/messages.es.xlf" - }, - "it": { - "baseHref": "/it/", - "translation": "apps/client/src/locales/messages.it.xlf" - }, - "nl": { - "baseHref": "/nl/", - "translation": "apps/client/src/locales/messages.nl.xlf" - } - }, - "sourceLocale": "en" - }, - "tags": [] - }, - "client-e2e": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "apps/client-e2e", - "sourceRoot": "apps/client-e2e/src", - "projectType": "application", - "architect": { - "e2e": { - "builder": "@nrwl/cypress:cypress", - "options": { - "cypressConfig": "apps/client-e2e/cypress.json", - "tsConfig": "apps/client-e2e/tsconfig.e2e.json", - "devServerTarget": "client:serve" - }, - "configurations": { - "production": { - "devServerTarget": "client:serve:production" - } - } - } - }, - "tags": [], - "implicitDependencies": ["client"] - }, - "common": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "libs/common", - "sourceRoot": "libs/common/src", - "projectType": "library", - "architect": { - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["libs/common/**/*.ts"] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "outputs": ["coverage/libs/common"], - "options": { - "jestConfig": "libs/common/jest.config.ts", - "passWithNoTests": true - } - } - }, - "tags": [] - }, - "ui": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "libs/ui", - "sourceRoot": "libs/ui/src", - "prefix": "gf", - "architect": { - "test": { - "builder": "@nrwl/jest:jest", - "outputs": ["coverage/libs/ui"], - "options": { - "jestConfig": "libs/ui/jest.config.ts", - "passWithNoTests": true - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["libs/ui/src/**/*.ts", "libs/ui/src/**/*.html"] - } - }, - "storybook": { - "builder": "@storybook/angular:start-storybook", - "options": { - "port": 4400, - "configDir": "libs/ui/.storybook", - "browserTarget": "ui:build-storybook", - "compodoc": false - }, - "configurations": { - "ci": { - "quiet": true - } - } - }, - "build-storybook": { - "builder": "@storybook/angular:build-storybook", - "outputs": ["{options.outputPath}"], - "options": { - "outputDir": "dist/storybook/ui", - "configDir": "libs/ui/.storybook", - "browserTarget": "ui:build-storybook", - "compodoc": false - }, - "configurations": { - "ci": { - "quiet": true - } - } - } - }, - "tags": [] - }, - "ui-e2e": { - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "apps/ui-e2e", - "sourceRoot": "apps/ui-e2e/src", - "projectType": "application", - "architect": { - "e2e": { - "builder": "@nrwl/cypress:cypress", - "options": { - "cypressConfig": "apps/ui-e2e/cypress.json", - "devServerTarget": "ui:storybook", - "tsConfig": "apps/ui-e2e/tsconfig.json" - }, - "configurations": { - "ci": { - "devServerTarget": "ui:storybook:ci" - } - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["apps/ui-e2e/**/*.{js,ts}"] - } - } - }, - "tags": [], - "implicitDependencies": ["ui"] - } - } -} diff --git a/apps/api/project.json b/apps/api/project.json new file mode 100644 index 000000000..4e1a67592 --- /dev/null +++ b/apps/api/project.json @@ -0,0 +1,54 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/api/src", + "projectType": "application", + "prefix": "api", + "generators": {}, + "targets": { + "build": { + "executor": "@nrwl/node:webpack", + "options": { + "outputPath": "dist/apps/api", + "main": "apps/api/src/main.ts", + "tsConfig": "apps/api/tsconfig.app.json", + "assets": ["apps/api/src/assets"] + }, + "configurations": { + "production": { + "generatePackageJson": true, + "optimization": true, + "extractLicenses": true, + "inspect": false, + "fileReplacements": [ + { + "replace": "apps/api/src/environments/environment.ts", + "with": "apps/api/src/environments/environment.prod.ts" + } + ] + } + }, + "outputs": ["{options.outputPath}"] + }, + "serve": { + "executor": "@nrwl/node:node", + "options": { + "buildTarget": "api:build" + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/api/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "apps/api/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["coverage/apps/api"] + } + }, + "tags": [] +} diff --git a/apps/client-e2e/project.json b/apps/client-e2e/project.json new file mode 100644 index 000000000..94276384e --- /dev/null +++ b/apps/client-e2e/project.json @@ -0,0 +1,22 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/client-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/client-e2e/cypress.json", + "tsConfig": "apps/client-e2e/tsconfig.e2e.json", + "devServerTarget": "client:serve" + }, + "configurations": { + "production": { + "devServerTarget": "client:serve:production" + } + } + } + }, + "tags": [], + "implicitDependencies": ["client"] +} diff --git a/apps/client/project.json b/apps/client/project.json new file mode 100644 index 000000000..2a8dabdbb --- /dev/null +++ b/apps/client/project.json @@ -0,0 +1,201 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "generators": { + "@schematics/angular:component": { + "style": "scss" + } + }, + "sourceRoot": "apps/client/src", + "prefix": "gf", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/apps/client", + "index": "apps/client/src/index.html", + "main": "apps/client/src/main.ts", + "polyfills": "apps/client/src/polyfills.ts", + "tsConfig": "apps/client/tsconfig.app.json", + "assets": [ + { + "glob": "assetlinks.json", + "input": "apps/client/src/assets", + "output": "./../.well-known" + }, + { + "glob": "CHANGELOG.md", + "input": "", + "output": "./../assets" + }, + { + "glob": "LICENSE", + "input": "", + "output": "./../assets" + }, + { + "glob": "robots.txt", + "input": "apps/client/src/assets", + "output": "./../" + }, + { + "glob": "sitemap.xml", + "input": "apps/client/src/assets", + "output": "./../" + }, + { + "glob": "**/*", + "input": "node_modules/ionicons/dist/ionicons", + "output": "./../ionicons" + }, + { + "glob": "**/*.js", + "input": "node_modules/ionicons/dist/", + "output": "./../" + }, + { + "glob": "**/*", + "input": "apps/client/src/assets", + "output": "./../assets/" + } + ], + "styles": ["apps/client/src/styles.scss"], + "scripts": ["node_modules/marked/marked.min.js"], + "vendorChunk": true, + "extractLicenses": false, + "buildOptimizer": false, + "sourceMap": true, + "optimization": false, + "namedChunks": true + }, + "configurations": { + "development-de": { + "baseHref": "/de/", + "localize": ["de"] + }, + "development-en": { + "baseHref": "/en/", + "localize": ["en"] + }, + "development-es": { + "baseHref": "/es/", + "localize": ["es"] + }, + "development-it": { + "baseHref": "/it/", + "localize": ["it"] + }, + "development-nl": { + "baseHref": "/nl/", + "localize": ["nl"] + }, + "production": { + "fileReplacements": [ + { + "replace": "apps/client/src/environments/environment.ts", + "with": "apps/client/src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + }, + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "client:build", + "proxyConfig": "apps/client/proxy.conf.json" + }, + "configurations": { + "development-de": { + "browserTarget": "client:build:development-de" + }, + "development-en": { + "browserTarget": "client:build:development-en" + }, + "development-es": { + "browserTarget": "client:build:development-es" + }, + "development-it": { + "browserTarget": "client:build:development-it" + }, + "development-nl": { + "browserTarget": "client:build:development-nl" + }, + "production": { + "browserTarget": "client:build:production" + } + } + }, + "extract-i18n": { + "executor": "ng-extract-i18n-merge:ng-extract-i18n-merge", + "options": { + "browserTarget": "client:build", + "includeContext": true, + "outputPath": "src/locales", + "targetFiles": [ + "messages.de.xlf", + "messages.es.xlf", + "messages.it.xlf", + "messages.nl.xlf" + ] + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/client/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "apps/client/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["coverage/apps/client"] + } + }, + "i18n": { + "locales": { + "de": { + "baseHref": "/de/", + "translation": "apps/client/src/locales/messages.de.xlf" + }, + "es": { + "baseHref": "/es/", + "translation": "apps/client/src/locales/messages.es.xlf" + }, + "it": { + "baseHref": "/it/", + "translation": "apps/client/src/locales/messages.it.xlf" + }, + "nl": { + "baseHref": "/nl/", + "translation": "apps/client/src/locales/messages.nl.xlf" + } + }, + "sourceLocale": "en" + }, + "tags": [] +} diff --git a/apps/ui-e2e/project.json b/apps/ui-e2e/project.json new file mode 100644 index 000000000..12bf828c5 --- /dev/null +++ b/apps/ui-e2e/project.json @@ -0,0 +1,28 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/ui-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/ui-e2e/cypress.json", + "devServerTarget": "ui:storybook", + "tsConfig": "apps/ui-e2e/tsconfig.json" + }, + "configurations": { + "ci": { + "devServerTarget": "ui:storybook:ci" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/ui-e2e/**/*.{js,ts}"] + } + } + }, + "tags": [], + "implicitDependencies": ["ui"] +} diff --git a/libs/common/project.json b/libs/common/project.json new file mode 100644 index 000000000..56922fe54 --- /dev/null +++ b/libs/common/project.json @@ -0,0 +1,22 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/common/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/common/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/common"], + "options": { + "jestConfig": "libs/common/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/ui/project.json b/libs/ui/project.json new file mode 100644 index 000000000..ac18acfb1 --- /dev/null +++ b/libs/ui/project.json @@ -0,0 +1,57 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "generators": { + "@schematics/angular:component": { + "style": "scss" + } + }, + "sourceRoot": "libs/ui/src", + "prefix": "gf", + "targets": { + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/ui"], + "options": { + "jestConfig": "libs/ui/jest.config.ts", + "passWithNoTests": true + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/ui/src/**/*.ts", "libs/ui/src/**/*.html"] + } + }, + "storybook": { + "executor": "@storybook/angular:start-storybook", + "options": { + "port": 4400, + "configDir": "libs/ui/.storybook", + "browserTarget": "ui:build-storybook", + "compodoc": false + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "executor": "@storybook/angular:build-storybook", + "outputs": ["{options.outputPath}"], + "options": { + "outputDir": "dist/storybook/ui", + "configDir": "libs/ui/.storybook", + "browserTarget": "ui:build-storybook", + "compodoc": false + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + }, + "tags": [] +} diff --git a/package.json b/package.json index 88f7f9b7e..95b78ecd8 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "database:validate": "prisma validate", "dep-graph": "nx dep-graph", "e2e": "ng e2e", - "extract-locales": "ng extract-i18n client --output-path ./apps/client/src/locales", + "extract-locales": "nx run client:extract-i18n --output-path ./apps/client/src/locales", "format": "nx format:write", "format:check": "nx format:check", "format:write": "nx format:write", @@ -40,15 +40,15 @@ "postinstall": "prisma generate && ngcc --properties es2020 browser module main", "replace-placeholders-in-build": "node ./replace.build.js", "start": "node dist/apps/api/main", - "start:client": "ng serve client --configuration=development-en --hmr -o", + "start:client": "nx run client:serve --configuration=development-en --hmr -o", "start:prod": "yarn database:migrate && yarn database:seed && node main", - "start:server": "nx serve api --watch", + "start:server": "nx run api:serve --watch", "start:storybook": "nx run ui:storybook", "test": "nx test", "test:single": "nx test --test-file portfolio-calculator-novn-buy-and-sell-partially.spec.ts", "ts-node": "ts-node", "update": "nx migrate latest", - "watch:server": "nx build api --watch", + "watch:server": "nx run api:build --watch", "watch:test": "nx test --watch", "workspace-generator": "nx workspace-generator" },