From df33a411f4d8391a959d2b54b12428bce3301047 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 5 May 2023 21:24:50 +0100 Subject: [PATCH] Revert "[ACS-4537] Make aca-about secondary entry of aca-content (#3170)" (#3172) This reverts commit 222f487e70842b0ba83209c6b8dd47c0da9b0e80. --- .github/actions/publish-libs/npm-publish.sh | 1 + .../update-lib-versions.sh | 1 + app/project.json | 2 +- app/src/app/extensions.module.ts | 2 +- projects/aca-about/.eslintrc.js | 23 +++++++ projects/aca-about/README.md | 68 +++++++++++++++++++ .../assets/about.plugin.json | 2 +- projects/aca-about/karma.conf.js | 15 ++++ projects/aca-about/ng-package.json | 11 +++ projects/aca-about/package.json | 19 ++++++ projects/aca-about/project.json | 49 +++++++++++++ .../src/lib}/about.component.html | 0 .../src/lib}/about.component.ts | 0 .../src/lib}/aca-about.module.ts | 5 +- .../src/lib}/dev-mode.tokens.ts | 0 .../src/lib}/package-json.token.ts | 0 .../about => aca-about}/src/public-api.ts | 7 +- projects/aca-about/src/test.ts | 50 ++++++++++++++ projects/aca-about/tsconfig.lib.json | 25 +++++++ projects/aca-about/tsconfig.lib.prod.json | 15 ++++ projects/aca-about/tsconfig.spec.json | 17 +++++ projects/aca-content/about/ng-package.json | 5 -- .../about/src/about.component.scss | 4 -- scripts/gh/update/update-project.sh | 1 + tsconfig.adf.json | 2 +- tsconfig.json | 3 +- 26 files changed, 306 insertions(+), 21 deletions(-) create mode 100644 projects/aca-about/.eslintrc.js create mode 100644 projects/aca-about/README.md rename projects/{aca-content/about => aca-about}/assets/about.plugin.json (94%) create mode 100644 projects/aca-about/karma.conf.js create mode 100644 projects/aca-about/ng-package.json create mode 100644 projects/aca-about/package.json create mode 100644 projects/aca-about/project.json rename projects/{aca-content/about/src => aca-about/src/lib}/about.component.html (100%) rename projects/{aca-content/about/src => aca-about/src/lib}/about.component.ts (100%) rename projects/{aca-content/about/src => aca-about/src/lib}/aca-about.module.ts (91%) rename projects/{aca-content/about/src => aca-about/src/lib}/dev-mode.tokens.ts (100%) rename projects/{aca-content/about/src => aca-about/src/lib}/package-json.token.ts (100%) rename projects/{aca-content/about => aca-about}/src/public-api.ts (88%) create mode 100644 projects/aca-about/src/test.ts create mode 100644 projects/aca-about/tsconfig.lib.json create mode 100644 projects/aca-about/tsconfig.lib.prod.json create mode 100644 projects/aca-about/tsconfig.spec.json delete mode 100644 projects/aca-content/about/ng-package.json delete mode 100644 projects/aca-content/about/src/about.component.scss diff --git a/.github/actions/publish-libs/npm-publish.sh b/.github/actions/publish-libs/npm-publish.sh index b527664fd4..6b16ec0eba 100755 --- a/.github/actions/publish-libs/npm-publish.sh +++ b/.github/actions/publish-libs/npm-publish.sh @@ -11,6 +11,7 @@ if [[ -z "$TAG" ]]; then fi export PROJECTS=( + 'aca-about' 'aca-content' 'aca-folder-rules' 'adf-office-services-ext' diff --git a/.github/actions/update-library-versions/update-lib-versions.sh b/.github/actions/update-library-versions/update-lib-versions.sh index f50ad82596..6f5b89b501 100755 --- a/.github/actions/update-library-versions/update-lib-versions.sh +++ b/.github/actions/update-library-versions/update-lib-versions.sh @@ -10,6 +10,7 @@ if [[ -z "$VERSION" ]]; then fi export PROJECTS=( + 'aca-about' 'aca-content' 'aca-folder-rules' 'adf-office-services-ext' diff --git a/app/project.json b/app/project.json index 6b60536826..7701356abb 100644 --- a/app/project.json +++ b/app/project.json @@ -74,7 +74,7 @@ }, { "glob": "about.plugin.json", - "input": "projects/aca-content/about/assets", + "input": "projects/aca-about/assets", "output": "./assets/plugins" }, { diff --git a/app/src/app/extensions.module.ts b/app/src/app/extensions.module.ts index 6ff2f9c234..ade935c82b 100644 --- a/app/src/app/extensions.module.ts +++ b/app/src/app/extensions.module.ts @@ -24,7 +24,7 @@ import { NgModule } from '@angular/core'; import { AosExtensionModule } from '@alfresco/adf-office-services-ext'; -import { AcaAboutModule } from '@alfresco/aca-content/about'; +import { AcaAboutModule } from '@alfresco/aca-about'; import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules'; import { environment } from '../environments/environment'; import packageJson from 'package.json'; diff --git a/projects/aca-about/.eslintrc.js b/projects/aca-about/.eslintrc.js new file mode 100644 index 0000000000..9e780e164b --- /dev/null +++ b/projects/aca-about/.eslintrc.js @@ -0,0 +1,23 @@ +path = require("path"); +module.exports = { + "extends": "../../.eslintrc.json", + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + path.join(__dirname, "tsconfig.lib.json"), + path.join(__dirname, "tsconfig.spec.json") + ], + "createDefaultProgram": true + }, + "rules": { + } + } + ] +} diff --git a/projects/aca-about/README.md b/projects/aca-about/README.md new file mode 100644 index 0000000000..f934f5e0aa --- /dev/null +++ b/projects/aca-about/README.md @@ -0,0 +1,68 @@ +# About Plugin for Alfresco Content App + +Provides the "About" page for ACA and ACA-based apps. + +## Installing + +Import the module into the application: + +```ts +// src/app/extensions.module.ts + +import { AcaAboutModule } from '@alfresco/aca-about'; + +@NgModule({ + imports: [ + // other modules + AcaAboutModule + ] +}) +export class AcaAboutModule {} +``` + +Update the `app.extensions.json` extension configuration to enable extra routes and components: + +```json +{ + "actions": [ + { + "id": "app.actions.about", + "type": "NAVIGATE_URL", + "payload": "/about" + } + ], + + "routes": [ + { + "id": "app.about", + "path": "about", + "layout": "app.layout.main", + "component": "app.about.component" + } + ], + + "features": { + "header": [ + { + "id": "app.header.more", + "children": [ + { + "id": "app.header.about", + "order": 100, + "title": "APP.BROWSE.ABOUT.TITLE", + "description": "APP.BROWSE.ABOUT.TITLE", + "icon": "info", + "actions": { + "click": "app.actions.about" + } + } + ] + } + ] + } +} +``` + +Alternatively, you can use the `assets/about.plugin.json` file. + +Compile and distribute/run the application. diff --git a/projects/aca-content/about/assets/about.plugin.json b/projects/aca-about/assets/about.plugin.json similarity index 94% rename from projects/aca-content/about/assets/about.plugin.json rename to projects/aca-about/assets/about.plugin.json index eb236cd91e..3a8e4b7f0e 100644 --- a/projects/aca-content/about/assets/about.plugin.json +++ b/projects/aca-about/assets/about.plugin.json @@ -1,5 +1,5 @@ { - "$schema": "../../../../extension.schema.json", + "$schema": "../../../extension.schema.json", "$id": "14157f82-6489-4187-9b68-1a5e38fadeca", "$name": "About Plugin", "$version": "0.0.1", diff --git a/projects/aca-about/karma.conf.js b/projects/aca-about/karma.conf.js new file mode 100644 index 0000000000..ad0765065f --- /dev/null +++ b/projects/aca-about/karma.conf.js @@ -0,0 +1,15 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html +const { join } = require('path'); +const getBaseKarmaConfig = require('../../karma.conf'); + +module.exports = function (config) { + const baseConfig = getBaseKarmaConfig(); + config.set({ + ...baseConfig, + coverageReporter: { + ...baseConfig.coverageReporter, + dir: join(__dirname, '../../coverage/aca-about'), + }, + }); +}; diff --git a/projects/aca-about/ng-package.json b/projects/aca-about/ng-package.json new file mode 100644 index 0000000000..8926e6c1ba --- /dev/null +++ b/projects/aca-about/ng-package.json @@ -0,0 +1,11 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/@alfresco/aca-about", + + "lib": { + "entryFile": "src/public-api.ts" + }, + "assets": [ + "assets" + ] +} diff --git a/projects/aca-about/package.json b/projects/aca-about/package.json new file mode 100644 index 0000000000..5b9795fd17 --- /dev/null +++ b/projects/aca-about/package.json @@ -0,0 +1,19 @@ +{ + "name": "@alfresco/aca-about", + "version": "0.0.1", + "license": "LGPL-3.0", + "peerDependencies": { + "@angular/common": "^14.1.0", + "@angular/core": "^14.1.0" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/Alfresco/alfresco-content-app.git" + } +} diff --git a/projects/aca-about/project.json b/projects/aca-about/project.json new file mode 100644 index 0000000000..e3b1998f4f --- /dev/null +++ b/projects/aca-about/project.json @@ -0,0 +1,49 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "name": "aca-about", + "projectType": "library", + "sourceRoot": "projects/aca-about/src", + "prefix": "lib", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:ng-packagr", + "options": { + "tsConfig": "projects/aca-about/tsconfig.lib.json", + "project": "projects/aca-about/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/aca-about/tsconfig.lib.prod.json" + } + }, + "defaultConfiguration": "production", + "outputs": [ + "{workspaceRoot}/dist/@alfresco/aca-about" + ] + }, + "test": { + "executor": "@angular-devkit/build-angular:karma", + "options": { + "codeCoverage": true, + "main": "projects/aca-about/src/test.ts", + "tsConfig": "projects/aca-about/tsconfig.spec.json", + "karmaConfig": "projects/aca-about/karma.conf.js" + } + }, + "lint": { + "executor": "@angular-eslint/builder:lint", + "options": { + "lintFilePatterns": [ + "projects/aca-about/**/*.ts", + "projects/aca-about/**/*.html" + ], + "cache": true, + "cacheLocation": ".eslintcache", + "ignorePath": ".eslintignore" + }, + "outputs": [ + "{options.outputFile}" + ] + } + } +} diff --git a/projects/aca-content/about/src/about.component.html b/projects/aca-about/src/lib/about.component.html similarity index 100% rename from projects/aca-content/about/src/about.component.html rename to projects/aca-about/src/lib/about.component.html diff --git a/projects/aca-content/about/src/about.component.ts b/projects/aca-about/src/lib/about.component.ts similarity index 100% rename from projects/aca-content/about/src/about.component.ts rename to projects/aca-about/src/lib/about.component.ts diff --git a/projects/aca-content/about/src/aca-about.module.ts b/projects/aca-about/src/lib/aca-about.module.ts similarity index 91% rename from projects/aca-content/about/src/aca-about.module.ts rename to projects/aca-about/src/lib/aca-about.module.ts index 48699d90ff..7d192b2ace 100644 --- a/projects/aca-content/about/src/aca-about.module.ts +++ b/projects/aca-about/src/lib/aca-about.module.ts @@ -25,17 +25,16 @@ import { ModuleWithProviders, NgModule, Provider } from '@angular/core'; import { AboutComponent } from './about.component'; import { CommonModule } from '@angular/common'; +import { CoreModule } from '@alfresco/adf-core'; import { SharedModule, PageLayoutModule } from '@alfresco/aca-shared'; import { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions'; import { DEV_MODE_TOKEN } from './dev-mode.tokens'; import { PACKAGE_JSON } from './package-json.token'; -import { AboutModule } from '@alfresco/adf-core'; -import { TranslateModule } from '@ngx-translate/core'; import { RouterModule } from '@angular/router'; @NgModule({ - imports: [CommonModule, RouterModule, TranslateModule, SharedModule, PageLayoutModule, AboutModule], + imports: [CommonModule, RouterModule, CoreModule.forChild(), SharedModule, PageLayoutModule], declarations: [AboutComponent], providers: [provideExtensionConfig(['about.plugin.json'])] }) diff --git a/projects/aca-content/about/src/dev-mode.tokens.ts b/projects/aca-about/src/lib/dev-mode.tokens.ts similarity index 100% rename from projects/aca-content/about/src/dev-mode.tokens.ts rename to projects/aca-about/src/lib/dev-mode.tokens.ts diff --git a/projects/aca-content/about/src/package-json.token.ts b/projects/aca-about/src/lib/package-json.token.ts similarity index 100% rename from projects/aca-content/about/src/package-json.token.ts rename to projects/aca-about/src/lib/package-json.token.ts diff --git a/projects/aca-content/about/src/public-api.ts b/projects/aca-about/src/public-api.ts similarity index 88% rename from projects/aca-content/about/src/public-api.ts rename to projects/aca-about/src/public-api.ts index ce1a6b6bdb..bddee86ca4 100644 --- a/projects/aca-content/about/src/public-api.ts +++ b/projects/aca-about/src/public-api.ts @@ -22,7 +22,6 @@ * from Hyland Software. If not, see . */ -export * from './about.component'; -export * from './aca-about.module'; -export * from './dev-mode.tokens'; -export * from './package-json.token'; +export * from './lib/about.component'; +export * from './lib/aca-about.module'; +export * from './lib/package-json.token'; diff --git a/projects/aca-about/src/test.ts b/projects/aca-about/src/test.ts new file mode 100644 index 0000000000..9c181d86a7 --- /dev/null +++ b/projects/aca-about/src/test.ts @@ -0,0 +1,50 @@ +/*! + * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . + */ + +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js'; +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context( + path: string, + deep?: boolean, + filter?: RegExp + ): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), { + teardown: { destroyAfterEach: false } +}); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/projects/aca-about/tsconfig.lib.json b/projects/aca-about/tsconfig.lib.json new file mode 100644 index 0000000000..94f9199961 --- /dev/null +++ b/projects/aca-about/tsconfig.lib.json @@ -0,0 +1,25 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "declarationMap": true, + "target": "es2020", + "declaration": true, + "inlineSources": true, + "types": [], + "lib": [ + "dom", + "es2018" + ] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" + ] +} diff --git a/projects/aca-about/tsconfig.lib.prod.json b/projects/aca-about/tsconfig.lib.prod.json new file mode 100644 index 0000000000..1715cbee80 --- /dev/null +++ b/projects/aca-about/tsconfig.lib.prod.json @@ -0,0 +1,15 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false, + "paths": { + "@alfresco/aca-shared": ["dist/@alfresco/aca-shared"], + "@alfresco/aca-shared/store": ["dist/@alfresco/aca-shared/store"], + "@alfresco/aca-shared/rules": ["dist/@alfresco/aca-shared/rules"] + } + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/projects/aca-about/tsconfig.spec.json b/projects/aca-about/tsconfig.spec.json new file mode 100644 index 0000000000..715dd0a5d2 --- /dev/null +++ b/projects/aca-about/tsconfig.spec.json @@ -0,0 +1,17 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/projects/aca-content/about/ng-package.json b/projects/aca-content/about/ng-package.json deleted file mode 100644 index fbafcc4448..0000000000 --- a/projects/aca-content/about/ng-package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "lib": { - "entryFile": "src/public-api.ts" - } -} diff --git a/projects/aca-content/about/src/about.component.scss b/projects/aca-content/about/src/about.component.scss deleted file mode 100644 index caf329f4a9..0000000000 --- a/projects/aca-content/about/src/about.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -adf-about { - padding: 10px; - width: 100%; -} diff --git a/scripts/gh/update/update-project.sh b/scripts/gh/update/update-project.sh index 0f4839fb7d..b5fe20fcc3 100755 --- a/scripts/gh/update/update-project.sh +++ b/scripts/gh/update/update-project.sh @@ -80,6 +80,7 @@ update() { update_dependency "@alfresco/aca-shared" update_dependency "@alfresco/aca-content" + update_dependency "@alfresco/aca-about" update_dependency "@alfresco/aca-preview" update_dependency "@alfresco/aca-viewer" update_dependency "@alfresco/aca-folder-rules" diff --git a/tsconfig.adf.json b/tsconfig.adf.json index 6030e59378..07f3ade872 100644 --- a/tsconfig.adf.json +++ b/tsconfig.adf.json @@ -38,9 +38,9 @@ "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public-api.ts"], "@alfresco/adf-office-services-ext": ["projects/adf-office-services-ext/src/public-api.ts"], "@alfresco/aca-testing-shared": ["projects/aca-testing-shared/src/index.ts"], + "@alfresco/aca-about": ["projects/aca-about/src/public-api.ts"], "@alfresco/aca-folder-rules": ["projects/aca-folder-rules/src/public-api.ts"], "@alfresco/aca-content": ["projects/aca-content/src/public-api.ts"], - "@alfresco/aca-content/about": ["projects/aca-content/about/src/public-api.ts"], "@alfresco/aca-viewer": ["projects/aca-viewer/src/public-api.ts"], "@alfresco/aca-preview": ["projects/aca-preview/src/public-api.ts"], "package.json": ["package.json"], diff --git a/tsconfig.json b/tsconfig.json index 016b30dd68..8a3ba78ed6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,7 @@ "experimentalDecorators": true, "skipLibCheck": true, "noUnusedLocals": true, + "skipLibCheck": true, "noUnusedParameters": true, "noImplicitReturns": true, "target": "es2020", @@ -26,9 +27,9 @@ "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public-api.ts"], "@alfresco/adf-office-services-ext": ["projects/adf-office-services-ext/src/public-api.ts"], "@alfresco/aca-testing-shared": ["projects/aca-testing-shared/src/index.ts"], + "@alfresco/aca-about": ["projects/aca-about/src/public-api.ts"], "@alfresco/aca-folder-rules": ["projects/aca-folder-rules/src/public-api.ts"], "@alfresco/aca-content": ["projects/aca-content/src/public-api.ts"], - "@alfresco/aca-content/about": ["projects/aca-content/about/src/public-api.ts"], "@alfresco/aca-viewer": ["projects/aca-viewer/src/public-api.ts"], "@alfresco/aca-preview": ["projects/aca-preview/src/public-api.ts"], "@alfresco/playwright-shared": ["e2e/playwright/shared/index.ts"],