From c46d0b05a46898abbb15576482c76db19af6300b Mon Sep 17 00:00:00 2001 From: anliben Date: Wed, 17 Jan 2024 16:58:07 -0300 Subject: [PATCH 1/3] fix(table): ajusta propriedade width Ajusta propriedade width das colunas Fixes DTHFUI-7754 --- .../interfaces/po-table-column.interface.ts | 9 +++++++-- .../components/po-table/po-table-base.component.ts | 1 + .../lib/components/po-table/po-table.component.html | 11 ++++++----- .../components/po-table/po-table.component.spec.ts | 11 ++++++----- .../lib/components/po-table/po-table.component.ts | 13 ++++++++++--- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts b/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts index 9022d185b2..8781e4bd2b 100644 --- a/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts +++ b/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts @@ -257,8 +257,13 @@ export interface PoTableColumn { visible?: boolean; /** - * A largura da coluna pode ser informada em pixels ou porcentagem. - * > Exemplo: '100px' ou '20%'. + * + * hoje o tamanho mínimo das colunas é de 32px, respeitando o padding lateral. + * Boas Práticas: + * Indicamos: + * - para colunas com 2 das propriedades (property, [p-draggable] e [p-sort]) : 96px + * - para colunas com 3 propriedades (property, [p-draggable] e [p-sort]) : 144px + * */ width?: string; diff --git a/projects/ui/src/lib/components/po-table/po-table-base.component.ts b/projects/ui/src/lib/components/po-table/po-table-base.component.ts index 293ca324b4..5db2a6ffd1 100644 --- a/projects/ui/src/lib/components/po-table/po-table-base.component.ts +++ b/projects/ui/src/lib/components/po-table/po-table-base.component.ts @@ -452,6 +452,7 @@ export abstract class PoTableBaseComponent implements OnChanges, OnDestroy { paramsFilter: {}; filteredItems: Array = []; initialized = false; + fixedLayout: boolean = false; private initialVisibleColumns: boolean = false; private _spacing: PoTableColumnSpacing = PoTableColumnSpacing.Medium; private _filteredColumns: Array; diff --git a/projects/ui/src/lib/components/po-table/po-table.component.html b/projects/ui/src/lib/components/po-table/po-table.component.html index a4904f0c81..ecd5dc01ba 100644 --- a/projects/ui/src/lib/components/po-table/po-table.component.html +++ b/projects/ui/src/lib/components/po-table/po-table.component.html @@ -103,7 +103,8 @@ [ngClass]="{ 'po-table-interactive': selectable || sort, 'po-table-selectable': selectable, - 'po-table-striped': striped + 'po-table-striped': striped, + 'po-table-data-fixed-columns': applyFixedColumns() }" [attr.p-spacing]="spacing" > @@ -440,9 +441,9 @@ [ngClass]="{ 'po-table-interactive': selectable || sort, 'po-table-selectable': selectable, - 'po-table-striped': striped + 'po-table-striped': striped, + 'po-table-data-fixed-columns': applyFixedColumns() }" - [ngStyle]="{ 'table-layout': !hasItems ? 'fixed' : 'auto' }" [attr.p-spacing]="spacing" > @@ -507,7 +508,7 @@ JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && (sortedColumn.ascending || !sortedColumn.ascending) }" - [ngStyle]="{ 'width': !hasItems ? '100%' : 'auto' }" + [ngStyle]="{ 'width': !hasItems ? '100%' : applyFixedColumns() ? column.width : 'auto' }" [class.po-table-header-subtitle]="column.type === 'subtitle'" [class.po-table-column-drag-box]="this.isDraggable" (click)="sortColumn(column)" @@ -558,7 +559,7 @@ JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && (sortedColumn.ascending || !sortedColumn.ascending) }" - [ngStyle]="{ 'width': !hasItems ? '100%' : 'auto' }" + [ngStyle]="{ 'width': !hasItems ? '100%' : applyFixedColumns() ? column.width : 'auto' }" [class.po-table-header-subtitle]="column.type === 'subtitle'" (click)="sortColumn(column)" [pFrozenColumn]="column.fixed" diff --git a/projects/ui/src/lib/components/po-table/po-table.component.spec.ts b/projects/ui/src/lib/components/po-table/po-table.component.spec.ts index e786a72fd1..7ec2c00d21 100644 --- a/projects/ui/src/lib/components/po-table/po-table.component.spec.ts +++ b/projects/ui/src/lib/components/po-table/po-table.component.spec.ts @@ -210,7 +210,8 @@ describe('PoTableComponent:', () => { verifyCalculateHeightTableContainer: () => {}, checkChangesItems: () => {}, debounceResize: () => true, - checkInfiniteScroll: () => {} + checkInfiniteScroll: () => {}, + applyFixedColumns: () => {} }; } @@ -2803,18 +2804,18 @@ describe('PoTableComponent:', () => { expect(component.columnCountForMasterDetail).toBe(countColumns); }); - it('columnCountForMasterDetail: should return 7 columnCount if actions is empty and has 5 columns', () => { + it('columnCountForMasterDetail: should return 6 columnCount if actions is empty and has 5 columns', () => { component.actions = []; component.columns = [...columns]; const columnCountColumnManager = 1; - const countColumns = columns.length + 1 + columnCountColumnManager; + const countColumns = columns.length + columnCountColumnManager; expect(component.columnCountForMasterDetail).toBe(countColumns); }); - it('columnCountForMasterDetail: should return 8 columnCount if actions is empty, has 5 columns and is selectable', () => { + it('columnCountForMasterDetail: should return 7 columnCount if actions is empty, has 5 columns and is selectable', () => { component.actions = []; component.columns = [...columns]; component.selectable = true; @@ -2822,7 +2823,7 @@ describe('PoTableComponent:', () => { const columnCountColumnManager = 1; const columnCountCheckbox = 1; - const countColumns = columns.length + 1 + columnCountColumnManager + columnCountCheckbox; + const countColumns = columns.length + columnCountColumnManager + columnCountCheckbox; expect(component.columnCountForMasterDetail).toBe(countColumns); }); diff --git a/projects/ui/src/lib/components/po-table/po-table.component.ts b/projects/ui/src/lib/components/po-table/po-table.component.ts index 520429e3f3..86843f28bf 100644 --- a/projects/ui/src/lib/components/po-table/po-table.component.ts +++ b/projects/ui/src/lib/components/po-table/po-table.component.ts @@ -230,9 +230,7 @@ export class PoTableComponent extends PoTableBaseComponent implements AfterViewI get columnCountForMasterDetail() { // caso tiver ações será utilizado a sua coluna para exibir o columnManager - const columnManager = this.actions.length ? 0 : 1; - - return this.mainColumns.length + 1 + (this.actions.length > 0 ? 1 : 0) + (this.selectable ? 1 : 0) + columnManager; + return this.mainColumns.length + 1 + (this.actions.length > 0 ? 1 : 0) + (this.selectable ? 1 : 0); } get detailHideSelect() { @@ -307,6 +305,7 @@ export class PoTableComponent extends PoTableBaseComponent implements AfterViewI this.initialized = true; this.changeHeaderWidth(); this.changeSizeLoading(); + this.applyFixedColumns(); } showMoreInfiniteScroll({ target }): void { @@ -317,6 +316,7 @@ export class PoTableComponent extends PoTableBaseComponent implements AfterViewI } ngDoCheck() { + this.applyFixedColumns(); this.checkChangesItems(); this.verifyCalculateHeightTableContainer(); @@ -356,6 +356,13 @@ export class PoTableComponent extends PoTableBaseComponent implements AfterViewI this.initializeData(queryParams); } + /** + * Verifica se columns possuem a propriedade width. + */ + applyFixedColumns(): boolean { + return !this.columns.some(column => !column.width); + } + /** * Método que colapsa uma linha com detalhe quando executada. * From f737eefb2829eb71dff6a217b480aa52e1159458 Mon Sep 17 00:00:00 2001 From: "BH01\\CARLOS.ALMEIDA" Date: Fri, 19 Jan 2024 21:01:00 -0300 Subject: [PATCH 2/3] feat(po-dynamic-view): adicionado a propriedade params --- .../po-dynamic-view-base.component.ts | 2 +- .../po-dynamic-view-field.interface.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-base.component.ts b/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-base.component.ts index 03c934252f..c28bd66378 100644 --- a/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-base.component.ts +++ b/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-base.component.ts @@ -249,7 +249,7 @@ export class PoDynamicViewBaseComponent { if (value !== '') { return this.service - .getObjectByValue(value) + .getObjectByValue(value, field.params) .pipe(map(res => this.transformArrayValue(res, field))) .pipe(catchError(() => of(null))); } else { diff --git a/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-field.interface.ts b/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-field.interface.ts index 77544219a3..b0928b9573 100644 --- a/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-field.interface.ts +++ b/projects/ui/src/lib/components/po-dynamic/po-dynamic-view/po-dynamic-view-field.interface.ts @@ -241,4 +241,16 @@ export interface PoDynamicViewField extends PoDynamicField { /** Texto exibido quando o valor do componente for *false*. */ booleanFalse?: string; + + /** + * Objeto que será enviado como parâmetro nas requisições de busca `searchService` + * utilizadas pelos campos que dependem de serviços para carregar seus dados. + * + * Por exemplo, para o parâmetro `{ age: 23 }` a URL da requisição ficaria: + * + * `` + * url + /1?age=23 + * `` + */ + params?: any; } From 0dd269975c4386ed62d7d601311b62bc1a1d24e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Greg=C3=B3rio?= Date: Wed, 24 Jan 2024 17:25:26 -0300 Subject: [PATCH 3/3] ci: permite publicar no npm com tag especifica Permite publicar no NPM com as tag's: next, latest e beta Fixes DTHFUI-807 --- .../workflows/publish_po_angular_ci-beta.yml | 122 ++++++++++------ .../publish_po_angular_ci-latest.yml | 132 ++++++++++-------- .../workflows/publish_po_angular_ci-next.yml | 122 ++++++++++------ projects/code-editor/package.json | 1 - projects/schematics/package.json | 1 - projects/storage/package.json | 1 - projects/sync/package.json | 1 - projects/templates/package.json | 1 - projects/ui/package.json | 1 - 9 files changed, 232 insertions(+), 150 deletions(-) diff --git a/.github/workflows/publish_po_angular_ci-beta.yml b/.github/workflows/publish_po_angular_ci-beta.yml index 18bff0b408..3aaed1da31 100644 --- a/.github/workflows/publish_po_angular_ci-beta.yml +++ b/.github/workflows/publish_po_angular_ci-beta.yml @@ -17,6 +17,10 @@ jobs: build-and-publish: runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' - name: Check out po-angular uses: actions/checkout@v4 @@ -39,13 +43,9 @@ jobs: run: npm install && npm run build working-directory: ${{env.WORKING_DIR}} - # Pega a última versão dos pacotes publicados no npm e armazena em variáveis - - run: echo "SCHEMATICS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SCHEMATICS_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV - - run: echo "STORAGE_LAST_PUBLISHED_VERSION=$(npm view @${{ env.STORAGE_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV - - run: echo "SYNC_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SYNC_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV - - run: echo "COMPONENTS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.COMPONENTS_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV - - run: echo "TEMPLATES_LAST_PUBLISHED_VERSION=$(npm view @${{ env.TEMPLATES_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV - - run: echo "CODE_EDITOR_LAST_PUBLISHED_VERSION=$(npm view @${{ env.CODE_EDITOR_NPM_PATH }} dist-tags.beta)" >> $GITHUB_ENV + # Pega as versões publicadas no NPM e salva no arquivo versions.json + - name: Obter todas as versões publicadas + run: npm show @${{ env.COMPONENTS_NPM_PATH }} versions --json > versions.json # Pega a versão no package.json - name: Get package.json version. @@ -54,75 +54,109 @@ jobs: with: path: po-angular + # Verifica se a versão a ser publicada já existe no NPM + - name: Verificar se a versão existe + id: version + run: | + VERSION_TO_CHECK=${{ steps.package-version.outputs.current-version }} + if jq -e --arg version "$VERSION_TO_CHECK" '.[] | select(. == $version)' versions.json; then + echo "publish=no" >> "$GITHUB_OUTPUT" + else + echo "publish=yes" >> "$GITHUB_OUTPUT" + fi + # PUBLISH NG-SCHEMATICS - name: ng-schematics - publish - # Se a versão remota for igual à versão que será publicada então ele pula o publish deste pacote e tenta publicar os demais pacotes - if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-schematics - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-STORAGE - name: ng-storage - publish - if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-storage - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-SYNC - name: ng-sync - publish - if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-sync - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-COMPONENTS - name: ng-components - publish - if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-components - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-TEMPLATES - name: ng-templates - publish - if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-templates - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-CODE-EDITOR - name: ng-code-editor - publish - if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag beta --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag beta --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-code-editor - add "beta" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_po_angular_ci-latest.yml b/.github/workflows/publish_po_angular_ci-latest.yml index 693064d629..511a7eefbe 100644 --- a/.github/workflows/publish_po_angular_ci-latest.yml +++ b/.github/workflows/publish_po_angular_ci-latest.yml @@ -8,8 +8,6 @@ env: COMPONENTS_NPM_PATH: po-ui/ng-components TEMPLATES_NPM_PATH: po-ui/ng-templates CODE_EDITOR_NPM_PATH: po-ui/ng-code-editor - AZURE_WEBAPP_NAME: wa-po-ui - AZURE_WEBAPP_PACKAGE_PATH: /home/runner/work/po-angular/po-angular/po-angular/dist/portal WORKING_DIR: /home/runner/work/po-angular/po-angular/po-angular on: @@ -19,6 +17,10 @@ jobs: build-and-publish: runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' - name: Check out po-angular uses: actions/checkout@v4 @@ -41,13 +43,9 @@ jobs: run: npm install && npm run build working-directory: ${{env.WORKING_DIR}} - # Pega a última versão dos pacotes publicados no npm e armazena em variáveis - - run: echo "SCHEMATICS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SCHEMATICS_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV - - run: echo "STORAGE_LAST_PUBLISHED_VERSION=$(npm view @${{ env.STORAGE_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV - - run: echo "SYNC_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SYNC_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV - - run: echo "COMPONENTS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.COMPONENTS_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV - - run: echo "TEMPLATES_LAST_PUBLISHED_VERSION=$(npm view @${{ env.TEMPLATES_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV - - run: echo "CODE_EDITOR_LAST_PUBLISHED_VERSION=$(npm view @${{ env.CODE_EDITOR_NPM_PATH }} dist-tags.latest)" >> $GITHUB_ENV + # Pega as versões publicadas no NPM e salva no arquivo versions.json + - name: Obter todas as versões publicadas + run: npm show @${{ env.COMPONENTS_NPM_PATH }} versions --json > versions.json # Pega a versão no package.json - name: Get package.json version. @@ -56,87 +54,109 @@ jobs: with: path: po-angular + # Verifica se a versão a ser publicada já existe no NPM + - name: Verificar se a versão existe + id: version + run: | + VERSION_TO_CHECK=${{ steps.package-version.outputs.current-version }} + if jq -e --arg version "$VERSION_TO_CHECK" '.[] | select(. == $version)' versions.json; then + echo "publish=no" >> "$GITHUB_OUTPUT" + else + echo "publish=yes" >> "$GITHUB_OUTPUT" + fi + # PUBLISH NG-SCHEMATICS - name: ng-schematics - publish - # Se a versão remota for igual à versão que será publicada então ele pula o publish deste pacote e tenta publicar os demais pacotes - if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag latest --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-schematics - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-STORAGE - name: ng-storage - publish - if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag latest --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-storage - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-SYNC - name: ng-sync - publish - if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag latest --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-sync - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-COMPONENTS - name: ng-components - publish - if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag latest --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-components - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-TEMPLATES - name: ng-templates - publish - if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag latest --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-templates - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-CODE-EDITOR - name: ng-code-editor - publish - if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag latest --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag latest --ignore-scripts env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # PUBLISH PORTAL - - name: portal build - run: npm run build:portal:docs && npm run build:portal:prod + - name: ng-code-editor - add "latest" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "latest" working-directory: ${{env.WORKING_DIR}} - - - name: 'Deploy to Azure Web App' - uses: azure/webapps-deploy@v2 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.AZURE_TOKEN }} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_po_angular_ci-next.yml b/.github/workflows/publish_po_angular_ci-next.yml index 7d383f4fee..c41dbbb232 100644 --- a/.github/workflows/publish_po_angular_ci-next.yml +++ b/.github/workflows/publish_po_angular_ci-next.yml @@ -17,6 +17,10 @@ jobs: build-and-publish: runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' - name: Check out po-angular uses: actions/checkout@v4 @@ -39,13 +43,9 @@ jobs: run: npm install && npm run build working-directory: ${{env.WORKING_DIR}} - # Pega a última versão dos pacotes publicados no npm e armazena em variáveis - - run: echo "SCHEMATICS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SCHEMATICS_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV - - run: echo "STORAGE_LAST_PUBLISHED_VERSION=$(npm view @${{ env.STORAGE_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV - - run: echo "SYNC_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SYNC_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV - - run: echo "COMPONENTS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.COMPONENTS_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV - - run: echo "TEMPLATES_LAST_PUBLISHED_VERSION=$(npm view @${{ env.TEMPLATES_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV - - run: echo "CODE_EDITOR_LAST_PUBLISHED_VERSION=$(npm view @${{ env.CODE_EDITOR_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV + # Pega as versões publicadas no NPM e salva no arquivo versions.json + - name: Obter todas as versões publicadas + run: npm show @${{ env.COMPONENTS_NPM_PATH }} versions --json > versions.json # Pega a versão no package.json - name: Get package.json version. @@ -54,75 +54,109 @@ jobs: with: path: po-angular + # Verifica se a versão a ser publicada já existe no NPM + - name: Verificar se a versão existe + id: version + run: | + VERSION_TO_CHECK=${{ steps.package-version.outputs.current-version }} + if jq -e --arg version "$VERSION_TO_CHECK" '.[] | select(. == $version)' versions.json; then + echo "publish=no" >> "$GITHUB_OUTPUT" + else + echo "publish=yes" >> "$GITHUB_OUTPUT" + fi + # PUBLISH NG-SCHEMATICS - name: ng-schematics - publish - # Se a versão remota for igual à versão que será publicada então ele pula o publish deste pacote e tenta publicar os demais pacotes - if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-schematics - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-STORAGE - name: ng-storage - publish - if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-storage - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-SYNC - name: ng-sync - publish - if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-sync - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-COMPONENTS - name: ng-components - publish - if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-components - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-TEMPLATES - name: ng-templates - publish - if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-templates - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # PUBLISH NG-CODE-EDITOR - name: ng-code-editor - publish - if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION)) - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag next --ignore-scripts + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag next --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-code-editor - add "next" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "next" + working-directory: ${{env.WORKING_DIR}} env: PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/projects/code-editor/package.json b/projects/code-editor/package.json index c4caa927cd..1831db4cd4 100644 --- a/projects/code-editor/package.json +++ b/projects/code-editor/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-code-editor", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Code Editor", "author": "PO UI", "license": "MIT", diff --git a/projects/schematics/package.json b/projects/schematics/package.json index 3b7dda9d8d..e1c8f9eaa4 100644 --- a/projects/schematics/package.json +++ b/projects/schematics/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-schematics", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Schematics", "author": "PO UI", "license": "MIT", diff --git a/projects/storage/package.json b/projects/storage/package.json index e8b7d7549d..9df5743e98 100644 --- a/projects/storage/package.json +++ b/projects/storage/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-storage", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Storage", "author": "PO UI", "license": "MIT", diff --git a/projects/sync/package.json b/projects/sync/package.json index 4a93d6c40f..19a6e1c608 100644 --- a/projects/sync/package.json +++ b/projects/sync/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-sync", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Sync", "author": "PO UI", "license": "MIT", diff --git a/projects/templates/package.json b/projects/templates/package.json index 34e69a1483..5f3e9148ad 100644 --- a/projects/templates/package.json +++ b/projects/templates/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-templates", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Templates", "author": "PO UI", "license": "MIT", diff --git a/projects/ui/package.json b/projects/ui/package.json index ba762863a7..9c8a19c040 100644 --- a/projects/ui/package.json +++ b/projects/ui/package.json @@ -1,7 +1,6 @@ { "name": "@po-ui/ng-components", "version": "0.0.0-PLACEHOLDER", - "tag": "next", "description": "PO UI - Components", "author": "PO UI", "license": "MIT",