From c71b367159e899d5844756c9d844fc5258ca838a Mon Sep 17 00:00:00 2001 From: CSimoesJr Date: Fri, 24 Nov 2023 11:19:21 -0300 Subject: [PATCH 1/2] build: atualiza para o Angular 17@next Atualiza projeto para o angular 17@next. fixes DTHFUI-8041 --- .eslintrc.json | 13 +- .github/workflows/ci.yml | 14 +- .github/workflows/publish_po_angular_ci.yml | 12 +- .husky/commit-msg | 4 + .husky/pre-commit | 5 + .huskyrc | 6 - .lintstagedrc | 3 + README.md | 32 ++--- angular.json | 12 +- docs/guides/development-flow.md | 2 +- docs/guides/getting-started.md | 40 +++--- docs/guides/migration-poui.md | 6 +- docs/guides/releases.md | 9 +- docs/guides/schematics.md | 6 +- docs/guides/sync-fundamentals.md | 2 +- docs/guides/sync-get-started.md | 56 ++++---- package.json | 126 +++++++++--------- projects/code-editor/package.json | 16 +-- projects/code-editor/tsconfig.schematics.json | 2 +- .../docs/processors/helpers/file-writer.js | 7 +- .../docs/templates/api/class.template.html | 2 +- .../api/componentGroup.template.html | 12 +- .../docs/templates/api/enum.template.html | 2 +- .../templates/api/interface.template.html | 4 +- .../docs/templates/api/method.template.html | 10 +- .../templates/api/property-enum.template.html | 2 +- .../api/property-interface.template.html | 4 +- .../docs/templates/api/property.template.html | 6 +- .../templates/samples/index.template.html | 12 +- projects/portal/gulpfile.js | 3 +- .../documentation-list.component.html | 2 +- .../app/documentation/documentation.module.ts | 4 +- projects/schematics/package.json | 8 +- projects/schematics/src/module/module.ts | 14 +- projects/schematics/src/project/project.ts | 10 +- projects/storage/package.json | 16 +-- .../src/lib/services/po-storage.service.ts | 2 +- projects/storage/tsconfig.schematics.json | 2 +- projects/sync/package.json | 20 +-- projects/sync/tsconfig.schematics.json | 3 +- projects/templates/package.json | 22 +-- .../po-page-login-popover.component.spec.ts | 1 - projects/templates/tsconfig.schematics.json | 2 +- projects/ui/.eslintrc.json | 12 +- projects/ui/package.json | 26 ++-- .../ui/schematics/ng-add/setup-project.ts | 48 +++++++ .../app.component.__style__.template | 0 .../app.component.html.template | 9 ++ .../app.component.spec.ts.template | 18 +++ .../app.component.ts.template | 35 +++++ .../files/app.component.spec.ts.template | 26 ++-- .../schematics/ng-generate/sidemenu/index.ts | 5 +- ...mple-po-container-dashboard.component.html | 2 +- ...sample-po-container-dashboard.component.ts | 2 +- .../po-dynamic-form-field.interface.ts | 4 +- .../po-gauge-path/po-gauge-path.component.ts | 6 +- .../po-menu-panel/po-menu-panel.component.ts | 2 +- .../components/po-menu/po-menu.component.ts | 2 +- .../sample-po-menu-labs.component.ts | 2 +- ...e-po-page-default-dashboard.component.html | 2 +- .../po-progress/po-progress.component.ts | 4 +- .../input-required.decorator.spec.ts | 4 +- .../sample-po-i18n-pipe.component.html | 6 +- projects/ui/src/lib/utils/util.spec.ts | 4 +- projects/ui/tsconfig.schematics.json | 2 +- 65 files changed, 451 insertions(+), 306 deletions(-) create mode 100644 .husky/commit-msg create mode 100644 .husky/pre-commit delete mode 100644 .huskyrc create mode 100644 .lintstagedrc create mode 100644 projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.__style__.template create mode 100644 projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.html.template create mode 100644 projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.spec.ts.template create mode 100644 projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.ts.template diff --git a/.eslintrc.json b/.eslintrc.json index 9308c785f..6521fcec9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,12 +9,16 @@ "createDefaultProgram": true }, "extends": [ - "plugin:@angular-eslint/ng-cli-compat", - "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", + "plugin:@typescript-eslint/recommended", + "plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates" ], "plugins": ["sonarjs", "eslint-plugin-react"], "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-array-constructor": "off", "@angular-eslint/component-selector": [ "error", { @@ -126,6 +130,11 @@ "format": ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"], "leadingUnderscore": "allow" }, + { + "selector": "import", + "format": ["camelCase", "PascalCase"], + "leadingUnderscore": "allow" + }, { "selector": "classProperty", "format": ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e34f2d89e..f32eef3e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 # Executa um comando do projeto na máquina virtual - run: npm i @@ -51,7 +51,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run build @@ -74,7 +74,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run test:ui @@ -91,7 +91,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run build:ui:lite @@ -109,7 +109,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run test:code-editor @@ -126,7 +126,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run test:storage @@ -143,7 +143,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm i - run: npm run build:storage:lite diff --git a/.github/workflows/publish_po_angular_ci.yml b/.github/workflows/publish_po_angular_ci.yml index 0f17735cd..c9584aed3 100644 --- a/.github/workflows/publish_po_angular_ci.yml +++ b/.github/workflows/publish_po_angular_ci.yml @@ -62,7 +62,7 @@ jobs: #if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --ignore-scripts env: @@ -82,7 +82,7 @@ jobs: if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --ignore-scripts env: @@ -102,7 +102,7 @@ jobs: if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --ignore-scripts env: @@ -122,7 +122,7 @@ jobs: if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --ignore-scripts env: @@ -142,7 +142,7 @@ jobs: if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --ignore-scripts env: @@ -162,7 +162,7 @@ jobs: if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION)) uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --ignore-scripts env: diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 000000000..b56767669 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no -- commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..1c0ffde05 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +# npm test +npx lint-staged diff --git a/.huskyrc b/.huskyrc deleted file mode 100644 index e44702bc1..000000000 --- a/.huskyrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "hooks": { - "pre-commit": "npm run format:fix", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } -} diff --git a/.lintstagedrc b/.lintstagedrc new file mode 100644 index 000000000..64b1dda53 --- /dev/null +++ b/.lintstagedrc @@ -0,0 +1,3 @@ +{ + "*.{ts,js,json,css,scss,html}": ["prettier --write"] +} diff --git a/README.md b/README.md index 2cee1ce71..47075a6e5 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Biblioteca de componentes de UI para Angular. ### Pré-requisitos -Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 16.14.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. +Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 18.13.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. Instalando com npm: ``` @@ -53,25 +53,25 @@ Veja abaixo a lista de dependências e as versões compatíveis, elas devem ser ``` "dependencies": { - "@angular/animations": "~16.2.0", - "@angular/common": "~16.2.0", - "@angular/compiler": "~16.2.0", - "@angular/core": "~16.2.0", - "@angular/forms": "~16.2.0", - "@angular/platform-browser": "~16.2.0", - "@angular/platform-browser-dynamic": "~16.2.0", - "@angular/router": "~16.2.0", - "rxjs": "~7.5.5", - "tslib": "^2.3.0", - "zone.js": "~0.13.1" + "@angular/animations": "~17.0.4", + "@angular/common": "~17.0.4", + "@angular/compiler": "~17.0.4", + "@angular/core": "~17.0.4", + "@angular/forms": "~17.0.4", + "@angular/platform-browser": "~17.0.4", + "@angular/platform-browser-dynamic": "~17.0.4", + "@angular/router": "~17.0.4", + "rxjs": "~7.8.1", + "tslib": "^2.6.2", + "zone.js": "~0.14.2" ... }, "devDependencies": { - "@angular-devkit/build-angular": "~16.2.0", - "@angular/cli": "~16.2.0", - "@angular/compiler-cli": "~16.2.0", + "@angular-devkit/build-angular": "~17.0.3", + "@angular/cli": "~17.0.3", + "@angular/compiler-cli": "~17.0.4", ... - "typescript": "~5.1.6" + "typescript": "~5.2.2" } ``` diff --git a/angular.json b/angular.json index 37af45eff..c7edec6a5 100644 --- a/angular.json +++ b/angular.json @@ -116,13 +116,13 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "app:build:es5", "open": true, - "host": "0.0.0.0" + "host": "0.0.0.0", + "buildTarget": "app:build:es5" }, "configurations": { "production": { - "browserTarget": "app:build:production" + "buildTarget": "app:build:production" } } }, @@ -356,18 +356,18 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "portal:build" + "buildTarget": "portal:build" }, "configurations": { "production": { - "browserTarget": "portal:build:production" + "buildTarget": "portal:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "portal:build" + "buildTarget": "portal:build" } }, "lint": { diff --git a/docs/guides/development-flow.md b/docs/guides/development-flow.md index 6d14f691f..567b9ed03 100644 --- a/docs/guides/development-flow.md +++ b/docs/guides/development-flow.md @@ -82,7 +82,7 @@ Este guia tem por objetivo definir as regras para criação de *Issues* relacion
Para seguir o guia é fundamental o conhecimento da ferramenta Git.