From 42d1040a820fc17e6a6a834e03e147a3c9e78002 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 19 Sep 2018 15:39:40 +0100 Subject: [PATCH] remove obsolete projects from the repository (#648) * use published version of dev tools * remove obsolete projects * fix spellcheck --- .prettierignore | 1 + angular.json | 112 +----- cspell.json | 103 +++-- package-lock.json | 34 +- package.json | 19 +- projects/aca-dev-tools/karma.conf.js | 31 -- projects/aca-dev-tools/ng-package.json | 16 - projects/aca-dev-tools/package.json | 9 - .../src/lib/aca-dev-tools.component.html | 46 --- .../src/lib/aca-dev-tools.component.scss | 23 -- .../src/lib/aca-dev-tools.component.spec.ts | 25 -- .../src/lib/aca-dev-tools.component.ts | 89 ---- .../src/lib/aca-dev-tools.module.ts | 35 -- .../markdown-view.component.scss | 18 - .../markdown-view/markdown-view.component.ts | 78 ---- projects/aca-dev-tools/src/public_api.ts | 6 - projects/aca-dev-tools/src/test.ts | 22 - projects/aca-dev-tools/tsconfig.lib.json | 34 -- projects/aca-dev-tools/tsconfig.spec.json | 17 - projects/aca-dev-tools/tslint.json | 17 - projects/adf-extensions/karma.conf.js | 42 -- projects/adf-extensions/ng-package.json | 9 - projects/adf-extensions/package.json | 10 - .../dynamic-component/dynamic.component.ts | 67 ---- .../dynamic-tab/dynamic-tab.component.ts | 94 ----- .../src/lib/config/action.extensions.ts | 51 --- .../src/lib/config/extension-element.ts | 23 -- .../src/lib/config/extension-utils.ts | 150 ------- .../src/lib/config/extension.config.ts | 35 -- .../src/lib/config/navbar.extensions.ts | 31 -- .../src/lib/config/permission.extensions.ts | 20 - .../src/lib/config/routing.extensions.ts | 26 -- .../src/lib/config/rule.extensions.ts | 44 -- .../src/lib/config/sidebar.extensions.ts | 29 -- .../src/lib/config/viewer.extensions.ts | 23 -- .../lib/evaluators/core.evaluators.spec.ts | 237 ----------- .../src/lib/evaluators/core.evaluators.ts | 66 --- .../src/lib/extensions.module.ts | 42 -- .../lib/services/extension-loader.service.ts | 140 ------- .../lib/services/extension.service.spec.ts | 379 ------------------ .../src/lib/services/extension.service.ts | 148 ------- .../src/lib/store/states/navigation.state.ts | 23 -- .../src/lib/store/states/profile.state.ts | 25 -- .../src/lib/store/states/selection.state.ts | 30 -- projects/adf-extensions/src/public_api.ts | 36 -- projects/adf-extensions/src/test.ts | 22 - projects/adf-extensions/tsconfig.lib.json | 34 -- projects/adf-extensions/tsconfig.spec.json | 17 - projects/adf-extensions/tslint.json | 17 - .../my-extension/assets/my-extension.json | 30 -- projects/my-extension/karma.conf.js | 31 -- projects/my-extension/ng-package.json | 10 - projects/my-extension/package.json | 8 - .../src/lib/my-extension.component.spec.ts | 25 -- .../src/lib/my-extension.component.ts | 19 - .../src/lib/my-extension.module.ts | 18 - .../src/lib/my-extension.service.spec.ts | 12 - .../src/lib/my-extension.service.ts | 9 - projects/my-extension/src/public_api.ts | 7 - projects/my-extension/src/test.ts | 22 - projects/my-extension/tsconfig.lib.json | 32 -- projects/my-extension/tsconfig.spec.json | 17 - projects/my-extension/tslint.json | 17 - src/app/extensions.module.ts | 6 +- src/assets/app.extensions.json | 2 +- src/assets/plugins/dev.tools.json | 46 --- tsconfig.json | 7 +- 67 files changed, 74 insertions(+), 2849 deletions(-) delete mode 100644 projects/aca-dev-tools/karma.conf.js delete mode 100644 projects/aca-dev-tools/ng-package.json delete mode 100644 projects/aca-dev-tools/package.json delete mode 100644 projects/aca-dev-tools/src/lib/aca-dev-tools.component.html delete mode 100644 projects/aca-dev-tools/src/lib/aca-dev-tools.component.scss delete mode 100644 projects/aca-dev-tools/src/lib/aca-dev-tools.component.spec.ts delete mode 100644 projects/aca-dev-tools/src/lib/aca-dev-tools.component.ts delete mode 100644 projects/aca-dev-tools/src/lib/aca-dev-tools.module.ts delete mode 100644 projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.scss delete mode 100644 projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.ts delete mode 100644 projects/aca-dev-tools/src/public_api.ts delete mode 100644 projects/aca-dev-tools/src/test.ts delete mode 100644 projects/aca-dev-tools/tsconfig.lib.json delete mode 100644 projects/aca-dev-tools/tsconfig.spec.json delete mode 100644 projects/aca-dev-tools/tslint.json delete mode 100644 projects/adf-extensions/karma.conf.js delete mode 100644 projects/adf-extensions/ng-package.json delete mode 100644 projects/adf-extensions/package.json delete mode 100644 projects/adf-extensions/src/lib/components/dynamic-component/dynamic.component.ts delete mode 100644 projects/adf-extensions/src/lib/components/dynamic-tab/dynamic-tab.component.ts delete mode 100644 projects/adf-extensions/src/lib/config/action.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/extension-element.ts delete mode 100644 projects/adf-extensions/src/lib/config/extension-utils.ts delete mode 100644 projects/adf-extensions/src/lib/config/extension.config.ts delete mode 100644 projects/adf-extensions/src/lib/config/navbar.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/permission.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/routing.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/rule.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/sidebar.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/config/viewer.extensions.ts delete mode 100644 projects/adf-extensions/src/lib/evaluators/core.evaluators.spec.ts delete mode 100644 projects/adf-extensions/src/lib/evaluators/core.evaluators.ts delete mode 100644 projects/adf-extensions/src/lib/extensions.module.ts delete mode 100644 projects/adf-extensions/src/lib/services/extension-loader.service.ts delete mode 100644 projects/adf-extensions/src/lib/services/extension.service.spec.ts delete mode 100644 projects/adf-extensions/src/lib/services/extension.service.ts delete mode 100644 projects/adf-extensions/src/lib/store/states/navigation.state.ts delete mode 100644 projects/adf-extensions/src/lib/store/states/profile.state.ts delete mode 100644 projects/adf-extensions/src/lib/store/states/selection.state.ts delete mode 100644 projects/adf-extensions/src/public_api.ts delete mode 100644 projects/adf-extensions/src/test.ts delete mode 100644 projects/adf-extensions/tsconfig.lib.json delete mode 100644 projects/adf-extensions/tsconfig.spec.json delete mode 100644 projects/adf-extensions/tslint.json delete mode 100644 projects/my-extension/assets/my-extension.json delete mode 100644 projects/my-extension/karma.conf.js delete mode 100644 projects/my-extension/ng-package.json delete mode 100644 projects/my-extension/package.json delete mode 100644 projects/my-extension/src/lib/my-extension.component.spec.ts delete mode 100644 projects/my-extension/src/lib/my-extension.component.ts delete mode 100644 projects/my-extension/src/lib/my-extension.module.ts delete mode 100644 projects/my-extension/src/lib/my-extension.service.spec.ts delete mode 100644 projects/my-extension/src/lib/my-extension.service.ts delete mode 100644 projects/my-extension/src/public_api.ts delete mode 100644 projects/my-extension/src/test.ts delete mode 100644 projects/my-extension/tsconfig.lib.json delete mode 100644 projects/my-extension/tsconfig.spec.json delete mode 100644 projects/my-extension/tslint.json delete mode 100644 src/assets/plugins/dev.tools.json diff --git a/.prettierignore b/.prettierignore index 8fdfce495..f48cf2972 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ node_modules src/assets/i18n e2e +/angular.json diff --git a/angular.json b/angular.json index a65a26ee6..e0f1e0cbd 100644 --- a/angular.json +++ b/angular.json @@ -57,9 +57,9 @@ "output": "./assets/workers" }, { - "glob": "**/*.json", - "input": "dist/my-extension/assets", - "output": "/assets/plugins" + "glob": "dev.tools.json", + "input": "node_modules/@denysvuika/aca-dev-tools/assets", + "output": "./assets/plugins" } ], "styles": [ @@ -207,112 +207,6 @@ } } } - }, - "aca-dev-tools": { - "root": "projects/aca-dev-tools", - "sourceRoot": "projects/aca-dev-tools/src", - "projectType": "library", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-ng-packagr:build", - "options": { - "tsConfig": "projects/aca-dev-tools/tsconfig.lib.json", - "project": "projects/aca-dev-tools/ng-package.json" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "projects/aca-dev-tools/src/test.ts", - "tsConfig": "projects/aca-dev-tools/tsconfig.spec.json", - "karmaConfig": "projects/aca-dev-tools/karma.conf.js" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/aca-dev-tools/tsconfig.lib.json", - "projects/aca-dev-tools/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - } - } - }, - "adf-extensions": { - "root": "projects/adf-extensions", - "sourceRoot": "projects/adf-extensions/src", - "projectType": "library", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-ng-packagr:build", - "options": { - "tsConfig": "projects/adf-extensions/tsconfig.lib.json", - "project": "projects/adf-extensions/ng-package.json" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "projects/adf-extensions/src/test.ts", - "tsConfig": "projects/adf-extensions/tsconfig.spec.json", - "karmaConfig": "projects/adf-extensions/karma.conf.js", - "sourceMap": true - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/adf-extensions/tsconfig.lib.json", - "projects/adf-extensions/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - } - } - }, - "my-extension": { - "root": "projects/my-extension", - "sourceRoot": "projects/my-extension/src", - "projectType": "library", - "prefix": "lib", - "targets": { - "build": { - "builder": "@angular-devkit/build-ng-packagr:build", - "options": { - "tsConfig": "projects/my-extension/tsconfig.lib.json", - "project": "projects/my-extension/ng-package.json" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "projects/my-extension/src/test.ts", - "tsConfig": "projects/my-extension/tsconfig.spec.json", - "karmaConfig": "projects/my-extension/karma.conf.js" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/my-extension/tsconfig.lib.json", - "projects/my-extension/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - } - } } }, "defaultProject": "app", diff --git a/cspell.json b/cspell.json index 64c56caf6..91a124de3 100644 --- a/cspell.json +++ b/cspell.json @@ -1,57 +1,54 @@ { - "version": "0.1", - "language": "en", - "words": [ - "succes", - "sharedlinks", - "Redistributable", + "version": "0.1", + "language": "en", + "words": [ + "succes", + "sharedlinks", + "Redistributable", - "ngrx", - "ngstack", - "sidenav", - "injectable", - "truthy", - "cryptodoc", - "mysites", - "afts", - "classlist", - "folderlink", - "filelink", - "datatable", - "repo", - "snackbar", - "promisify", - "xdescribe", - "unfavorite", - "devtools", - "gitter", - "jira", - "markdownlint", - "uploader", - "nginx", - "docx", - "SOLR", + "ngrx", + "ngstack", + "sidenav", + "injectable", + "truthy", + "cryptodoc", + "mysites", + "afts", + "classlist", + "folderlink", + "filelink", + "datatable", + "repo", + "snackbar", + "promisify", + "xdescribe", + "unfavorite", + "devtools", + "gitter", + "jira", + "markdownlint", + "uploader", + "nginx", + "docx", + "SOLR", - "unshare", - "validators", - "guid", - "polyfill", - "polyfills", - "jsonp", - "hammerjs", - "pdfjs", - "xpath", - "tooltip", - "tooltips", - "unindent", - "exif", - "cardview", - "webm", - "keycodes" - ], - "dictionaries": [ - "html", - "en-gb", - "en_US" - ] + "unshare", + "validators", + "guid", + "polyfill", + "polyfills", + "jsonp", + "hammerjs", + "pdfjs", + "xpath", + "tooltip", + "tooltips", + "unindent", + "exif", + "cardview", + "webm", + "keycodes", + "denysvuika" + ], + "dictionaries": ["html", "en-gb", "en_US"] } diff --git a/package-lock.json b/package-lock.json index dcf7705fe..194512726 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1621,6 +1621,14 @@ "tslib": "^1.9.0" } }, + "@denysvuika/aca-dev-tools": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@denysvuika/aca-dev-tools/-/aca-dev-tools-0.1.0.tgz", + "integrity": "sha512-gk/Ryeq9T47vpLRSC4FIqbq/Z9YMYvQ6BmUNcgTbT9GfofCsEK8UQM4uBq29bS8k6Cs9X79HfTBOJAfXBDrnUg==", + "requires": { + "tslib": "^1.9.0" + } + }, "@mat-datetimepicker/core": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@mat-datetimepicker/core/-/core-2.0.1.tgz", @@ -2578,12 +2586,6 @@ "integrity": "sha512-ikB0JHv6vCR1KYUQAzTO4gi/lXLElT4Tx+6De2pc/OZwizE9LRNiTa+U8TBFKBD/nntPnr/MPSHSnOTybjhqNA==", "dev": true }, - "@types/showdown": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-1.7.5.tgz", - "integrity": "sha512-uUSUP6XtyTclRzTH0NLkEIiEowxYXOWDeulpngrPltEceOmsGdhfrl8xr3D4QfJA7FuUUyHwFQuWWURLFg3hgg==", - "dev": true - }, "@types/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz", @@ -4526,26 +4528,6 @@ } } }, - "cpr": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cpr/-/cpr-3.0.1.tgz", - "integrity": "sha1-uaVQOLfNgaNcF7l2GJW9hJau8eU=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.5", - "minimist": "^1.2.0", - "mkdirp": "~0.5.1", - "rimraf": "^2.5.4" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, "create-ecdh": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", diff --git a/package.json b/package.json index 80e6092eb..cd9084fe4 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,12 @@ "license": "LGPL-3.0", "scripts": { "ng": "ng", - "start": "npm run server-versions && npm run build.libs && ng serve --open", - "start:prod": "npm run server-versions && npm run build.libs && ng serve --prod --open", - "build.libs": "ng build adf-extensions && ng build aca-dev-tools && npm run build:my-extension", - "build": "npm run server-versions && npm run build.libs && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app --prod", - "build:dev": "npm run server-versions && npm run build.libs && ng build", - "build:my-extension": "ng build my-extension && cpr projects/my-extension/assets dist/my-extension/assets --deleteFirst", - "test": "npm run build.libs && ng test app --code-coverage", - "test:ci": "npm run build.libs && ng test app --code-coverage --watch=false", + "start": "npm run server-versions && ng serve --open", + "start:prod": "npm run server-versions && ng serve --prod --open", + "build": "npm run server-versions && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app --prod", + "build:dev": "npm run server-versions && ng build", + "test": "ng test app --code-coverage", + "test:ci": "ng test app --code-coverage --watch=false", "lint": "ng lint", "server-versions": "rimraf ./src/versions.json && npm list --depth=0 --json=true --prod=true > ./src/versions.json || exit 0", "__e2e": "ng e2e", @@ -43,6 +41,7 @@ "@angular/platform-browser": "6.1.7", "@angular/platform-browser-dynamic": "6.1.7", "@angular/router": "6.1.7", + "@denysvuika/aca-dev-tools": "^0.1.0", "@mat-datetimepicker/core": "^2.0.1", "@mat-datetimepicker/moment": "^2.0.1", "@ngrx/effects": "^6.1.0", @@ -51,8 +50,8 @@ "@ngrx/store-devtools": "^6.1.0", "@ngstack/code-editor": "^0.4.3", "@ngx-translate/core": "^10.0.2", - "chrome-remote-interface": "^0.26.1", "alfresco-js-api": "2.6.0-e0035744611f12f4f0067495615fa37ce392c810", + "chrome-remote-interface": "^0.26.1", "core-js": "^2.5.7", "hammerjs": "2.0.8", "minimatch-browser": "^1.0.0", @@ -75,10 +74,8 @@ "@types/jasminewd2": "^2.0.2", "@types/node": "9.3.0", "@types/selenium-webdriver": "^3.0.8", - "@types/showdown": "^1.7.5", "alfresco-js-api-node": "^2.5.0", "codelyzer": "^4.4.4", - "cpr": "^3.0.1", "cspell": "^3.1.3", "jasmine-core": "~2.8.0", "jasmine-reporters": "^2.2.1", diff --git a/projects/aca-dev-tools/karma.conf.js b/projects/aca-dev-tools/karma.conf.js deleted file mode 100644 index 4c5f8d03f..000000000 --- a/projects/aca-dev-tools/karma.conf.js +++ /dev/null @@ -1,31 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); -}; diff --git a/projects/aca-dev-tools/ng-package.json b/projects/aca-dev-tools/ng-package.json deleted file mode 100644 index f0400e62e..000000000 --- a/projects/aca-dev-tools/ng-package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/aca-dev-tools", - "deleteDestPath": false, - "lib": { - "entryFile": "src/public_api.ts", - "flatModuleFile": "aca-dev-tools", - "umdModuleIds": { - "showdown": "showdown", - "@alfresco/adf-core": "@alfresco/adf-core", - "@ngstack/code-editor": "@ngstack/code-editor", - "@alfresco/adf-content-services": "@alfresco/adf-content-services", - "@alfresco/adf-extensions": "@alfresco/adf-extensions" - } - } -} diff --git a/projects/aca-dev-tools/package.json b/projects/aca-dev-tools/package.json deleted file mode 100644 index a7518fce6..000000000 --- a/projects/aca-dev-tools/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "aca-dev-tools", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^6.0.0", - "@angular/core": "^6.0.0", - "@ngstack/code-editor": "^0.4.1" - } -} diff --git a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.html b/projects/aca-dev-tools/src/lib/aca-dev-tools.component.html deleted file mode 100644 index e2ca89233..000000000 --- a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.html +++ /dev/null @@ -1,46 +0,0 @@ -
-
- - - - - - -
-
-
- -
-
-
- - - - -
-
-
- -
-
-
diff --git a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.scss b/projects/aca-dev-tools/src/lib/aca-dev-tools.component.scss deleted file mode 100644 index 6da4015d2..000000000 --- a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -.lib-aca-dev-tools { - display: flex; - flex-direction: column; - flex: 1; - height: 100%; - overflow: hidden; - min-height: 0; -} - -.ngs-code-editor { - display: flex; - flex-direction: column; - flex: 1; - height: 100%; - max-height: 100%; - overflow: hidden; - min-height: 0; - - .editor { - // border: 1px solid grey; - // min-height: 400px; - } -} diff --git a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.spec.ts b/projects/aca-dev-tools/src/lib/aca-dev-tools.component.spec.ts deleted file mode 100644 index e177ada50..000000000 --- a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AcaDevToolsComponent } from './aca-dev-tools.component'; - -describe('AcaDevToolsComponent', () => { - let component: AcaDevToolsComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AcaDevToolsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AcaDevToolsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.ts b/projects/aca-dev-tools/src/lib/aca-dev-tools.component.ts deleted file mode 100644 index 6d5b3254d..000000000 --- a/projects/aca-dev-tools/src/lib/aca-dev-tools.component.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; -import { CodeModel } from '@ngstack/code-editor'; -import { ActivatedRoute } from '@angular/router'; -import { HttpClient } from '@angular/common/http'; -import { forkJoin } from 'rxjs'; - -@Component({ - selector: 'aca-dev-tools-main', - encapsulation: ViewEncapsulation.None, - host: { class: 'lib-aca-dev-tools' }, - templateUrl: './aca-dev-tools.component.html', - styleUrls: ['./aca-dev-tools.component.scss'] -}) -export class AcaDevToolsComponent implements OnInit { - model: CodeModel = null; - - private code: string; - - constructor(private route: ActivatedRoute, private http: HttpClient) {} - - ngOnInit() { - const routeData = this.route.snapshot.data; - if (!routeData) { - return; - } - - const schemaUri = routeData.schemaUri; - const getSchema = this.http.get(routeData.schemaPath); - const getConfig = this.http.get(routeData.configPath, { - responseType: 'text' - }); - - forkJoin([getSchema, getConfig]).subscribe( - ([schema, config]) => { - let code = config; - - const override = sessionStorage.getItem('aca.extension.config'); - if (override) { - code = override; - } - - this.model = { - language: 'json', - uri: 'app.extensions.json', - value: code, - schemas: [ - { - uri: schemaUri, - schema - } - ] - }; - this.code = code; - }, - err => { - console.log(err); - } - ); - } - - onCodeChanged(value: string) { - this.code = value; - } - - saveChanges() { - sessionStorage.setItem('aca.extension.config', this.code); - // window.location.reload(true); - } - - revertChanges() { - sessionStorage.removeItem('aca.extension.config'); - window.location.reload(true); - } - - download() { - const element = document.createElement('a'); - element.setAttribute( - 'href', - 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.code) - ); - element.setAttribute('download', 'plugin.json'); - element.style.display = 'none'; - document.body.appendChild(element); - - element.click(); - - document.body.removeChild(element); - } -} diff --git a/projects/aca-dev-tools/src/lib/aca-dev-tools.module.ts b/projects/aca-dev-tools/src/lib/aca-dev-tools.module.ts deleted file mode 100644 index b52895ad3..000000000 --- a/projects/aca-dev-tools/src/lib/aca-dev-tools.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CodeEditorModule } from '@ngstack/code-editor'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { AcaDevToolsComponent } from './aca-dev-tools.component'; -import { CoreModule } from '@alfresco/adf-core'; -import { ContentModule } from '@alfresco/adf-content-services'; -import { ExtensionService } from '@alfresco/adf-extensions'; -import { MarkdownViewComponent } from './viewer/markdown-view/markdown-view.component'; - -export function components() { - return [ - AcaDevToolsComponent, - MarkdownViewComponent - ]; -} - -@NgModule({ - imports: [ - FlexLayoutModule, - CodeEditorModule.forChild(), - CoreModule.forChild(), - ContentModule.forChild() - ], - declarations: components(), - exports: components(), - entryComponents: components() -}) -export class AcaDevToolsModule { - constructor(extensions: ExtensionService) { - extensions.setComponents({ - 'dev.tools.component': AcaDevToolsComponent, - 'dev.tools.viewer.markdown': MarkdownViewComponent - }); - } -} diff --git a/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.scss b/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.scss deleted file mode 100644 index 8ca01ec06..000000000 --- a/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.scss +++ /dev/null @@ -1,18 +0,0 @@ -.aca-markdown-view { - display: flex; - flex-direction: column; - - .content { - display: flex; - flex-direction: column; - } -} - -.adf-viewer-content-container { - height: 100%; -} - -.adf-viewer-custom-content { - overflow: scroll; - height: 100%; -} diff --git a/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.ts b/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.ts deleted file mode 100644 index e982c9868..000000000 --- a/projects/aca-dev-tools/src/lib/viewer/markdown-view/markdown-view.component.ts +++ /dev/null @@ -1,78 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2018 Alfresco Software Limited - * - * 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 - * along with Alfresco. If not, see . - */ - -import { - Component, - Input, - OnInit, - ViewEncapsulation -} from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; -import { AlfrescoApiService } from '@alfresco/adf-core'; -// import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; -import { Converter } from 'showdown'; - -@Component({ - selector: 'aca-markdown-view', - template: `
`, - styleUrls: ['./markdown-view.component.scss'], - encapsulation: ViewEncapsulation.None, - host: { 'class': 'aca-markdown-view' } -}) -export class MarkdownViewComponent implements OnInit { - @Input() - url: string; - - @Input() - node: MinimalNodeEntryEntity; - - // content: SafeHtml = null; - content: string = null; - - constructor( - private apiService: AlfrescoApiService - // private sanitizer: DomSanitizer - ) {} - - ngOnInit() { - this.apiService.nodesApi.getFileContent(this.node.id).then( - result => { - const converter = new Converter({ - tables: true, - ghCodeBlocks: true, - ghCompatibleHeaderId: true, - simplifiedAutoLink: true - }); - converter.setOption('metadata', true); - converter.setFlavor('github'); - - const html = converter.makeHtml(result); - // this.content = this.sanitizer.bypassSecurityTrustHtml(html); - this.content = html; - }, - err => console.log(err) - ); - } -} diff --git a/projects/aca-dev-tools/src/public_api.ts b/projects/aca-dev-tools/src/public_api.ts deleted file mode 100644 index bd347a693..000000000 --- a/projects/aca-dev-tools/src/public_api.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Public API Surface of aca-dev-tools - */ - -export * from './lib/aca-dev-tools.component'; -export * from './lib/aca-dev-tools.module'; diff --git a/projects/aca-dev-tools/src/test.ts b/projects/aca-dev-tools/src/test.ts deleted file mode 100644 index e11ff1c97..000000000 --- a/projects/aca-dev-tools/src/test.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// 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-dev-tools/tsconfig.lib.json b/projects/aca-dev-tools/tsconfig.lib.json deleted file mode 100644 index bd8c4dab3..000000000 --- a/projects/aca-dev-tools/tsconfig.lib.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2015" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "flatModuleId": "AUTOGENERATED", - "flatModuleOutFile": "AUTOGENERATED", - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] -} diff --git a/projects/aca-dev-tools/tsconfig.spec.json b/projects/aca-dev-tools/tsconfig.spec.json deleted file mode 100644 index 16da33db0..000000000 --- a/projects/aca-dev-tools/tsconfig.spec.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/projects/aca-dev-tools/tslint.json b/projects/aca-dev-tools/tslint.json deleted file mode 100644 index eba040add..000000000 --- a/projects/aca-dev-tools/tslint.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "aca", - "camelCase" - ], - "component-selector": [ - true, - "element", - "aca", - "kebab-case" - ] - } -} diff --git a/projects/adf-extensions/karma.conf.js b/projects/adf-extensions/karma.conf.js deleted file mode 100644 index f43d65fff..000000000 --- a/projects/adf-extensions/karma.conf.js +++ /dev/null @@ -1,42 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: [/*'Chrome',*/ 'ChromeHeadless'], - customLaunchers: { - ChromeHeadless: { - base: 'Chrome', - flags: [ - '--no-sandbox', - '--headless', - '--disable-gpu', - '--remote-debugging-port=9222' - ] - } - }, - singleRun: false - }); -}; diff --git a/projects/adf-extensions/ng-package.json b/projects/adf-extensions/ng-package.json deleted file mode 100644 index 122553cbc..000000000 --- a/projects/adf-extensions/ng-package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/@alfresco/adf-extensions", - "deleteDestPath": false, - "lib": { - "languageLevel": ["dom", "es2017"], - "entryFile": "src/public_api.ts" - } -} diff --git a/projects/adf-extensions/package.json b/projects/adf-extensions/package.json deleted file mode 100644 index 8dd32ef33..000000000 --- a/projects/adf-extensions/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@alfresco/adf-extensions", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^6.0.0", - "@angular/core": "^6.0.0", - "@angular/http": "^6.1.4", - "alfresco-js-api": "^2.5.0" - } -} diff --git a/projects/adf-extensions/src/lib/components/dynamic-component/dynamic.component.ts b/projects/adf-extensions/src/lib/components/dynamic-component/dynamic.component.ts deleted file mode 100644 index 8314d3096..000000000 --- a/projects/adf-extensions/src/lib/components/dynamic-component/dynamic.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - Component, - Input, - ComponentRef, - OnInit, - ComponentFactoryResolver, - ViewChild, - ViewContainerRef, - OnDestroy -} from '@angular/core'; -import { ExtensionService } from '../../services/extension.service'; - -@Component({ - selector: 'adf-dynamic-component', - template: `
` -}) -export class DynamicExtensionComponent implements OnInit, OnDestroy { - @ViewChild('content', { read: ViewContainerRef }) - content: ViewContainerRef; - - @Input() id: string; - - private componentRef: ComponentRef; - - constructor( - private extensions: ExtensionService, - private componentFactoryResolver: ComponentFactoryResolver - ) {} - - ngOnInit() { - const componentType = this.extensions.getComponentById(this.id); - if (componentType) { - const factory = this.componentFactoryResolver.resolveComponentFactory( - componentType - ); - if (factory) { - this.content.clear(); - this.componentRef = this.content.createComponent(factory, 0); - // this.setupWidget(this.componentRef); - } - } - } - - ngOnDestroy() { - if (this.componentRef) { - this.componentRef.destroy(); - this.componentRef = null; - } - } -} diff --git a/projects/adf-extensions/src/lib/components/dynamic-tab/dynamic-tab.component.ts b/projects/adf-extensions/src/lib/components/dynamic-tab/dynamic-tab.component.ts deleted file mode 100644 index bbd3e0c9f..000000000 --- a/projects/adf-extensions/src/lib/components/dynamic-tab/dynamic-tab.component.ts +++ /dev/null @@ -1,94 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2018 Alfresco Software Limited - * - * 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 - * along with Alfresco. If not, see . - */ - -import { - Component, - Input, - OnInit, - OnDestroy, - ViewChild, - ViewContainerRef, - ComponentRef, - ComponentFactoryResolver, - OnChanges, - SimpleChanges -} from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; -import { ExtensionService } from '../../services/extension.service'; - -@Component({ - selector: 'adf-dynamic-tab', - template: `
` -}) -export class DynamicTabComponent implements OnInit, OnChanges, OnDestroy { - @ViewChild('content', { read: ViewContainerRef }) - content: ViewContainerRef; - - @Input() - id: string; - - @Input() - node: MinimalNodeEntryEntity; - - private componentRef: ComponentRef; - - constructor( - private extensions: ExtensionService, - private componentFactoryResolver: ComponentFactoryResolver - ) {} - - ngOnInit() { - const componentType = this.extensions.getComponentById(this.id); - if (componentType) { - const factory = this.componentFactoryResolver.resolveComponentFactory( - componentType - ); - if (factory) { - this.content.clear(); - this.componentRef = this.content.createComponent(factory, 0); - this.updateInstance(); - } - } - } - - ngOnChanges(changes: SimpleChanges) { - if (changes.node) { - this.updateInstance(); - } - } - - ngOnDestroy() { - if (this.componentRef) { - this.componentRef.destroy(); - this.componentRef = null; - } - } - - private updateInstance() { - if (this.componentRef && this.componentRef.instance) { - this.componentRef.instance.node = this.node; - } - } -} diff --git a/projects/adf-extensions/src/lib/config/action.extensions.ts b/projects/adf-extensions/src/lib/config/action.extensions.ts deleted file mode 100644 index 0906c1c24..000000000 --- a/projects/adf-extensions/src/lib/config/action.extensions.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExtensionElement } from './extension-element'; - -export enum ContentActionType { - default = 'default', - button = 'button', - separator = 'separator', - menu = 'menu', - custom = 'custom' -} - -export interface ContentActionRef extends ExtensionElement { - type: ContentActionType; - - title?: string; - description?: string; - icon?: string; - children?: Array; - component?: string; - actions?: { - click?: string; - [key: string]: string; - }; - rules?: { - enabled?: string; - visible?: string; - [key: string]: string; - }; -} - -export interface ActionRef { - id: string; - type: string; - payload?: string; -} diff --git a/projects/adf-extensions/src/lib/config/extension-element.ts b/projects/adf-extensions/src/lib/config/extension-element.ts deleted file mode 100644 index be0c02a63..000000000 --- a/projects/adf-extensions/src/lib/config/extension-element.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface ExtensionElement { - id: string; - - order?: number; - disabled?: boolean; -} diff --git a/projects/adf-extensions/src/lib/config/extension-utils.ts b/projects/adf-extensions/src/lib/config/extension-utils.ts deleted file mode 100644 index 511e61e7b..000000000 --- a/projects/adf-extensions/src/lib/config/extension-utils.ts +++ /dev/null @@ -1,150 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ContentActionRef, ContentActionType } from './action.extensions'; - -export function getValue(target: any, key: string): any { - if (!target) { - return undefined; - } - - const keys = key.split('.'); - key = ''; - - do { - key += keys.shift(); - const value = target[key]; - if ( - value !== undefined && - (typeof value === 'object' || !keys.length) - ) { - target = value; - key = ''; - } else if (!keys.length) { - target = undefined; - } else { - key += '.'; - } - } while (keys.length); - - return target; -} - -export function filterEnabled(entry: { disabled?: boolean }): boolean { - return !entry.disabled; -} - -export function sortByOrder( - a: { order?: number | undefined }, - b: { order?: number | undefined } -) { - const left = a.order === undefined ? Number.MAX_SAFE_INTEGER : a.order; - const right = b.order === undefined ? Number.MAX_SAFE_INTEGER : b.order; - return left - right; -} - -export function reduceSeparators( - acc: ContentActionRef[], - el: ContentActionRef, - i: number, - arr: ContentActionRef[] -): ContentActionRef[] { - // remove leading separator - if (i === 0) { - if (arr[i].type === ContentActionType.separator) { - return acc; - } - } - // remove duplicate separators - if (i > 0) { - const prev = arr[i - 1]; - if ( - prev.type === ContentActionType.separator && - el.type === ContentActionType.separator - ) { - return acc; - } - - // remove trailing separator - if (i === arr.length - 1) { - if (el.type === ContentActionType.separator) { - return acc; - } - } - } - - return acc.concat(el); -} - -export function reduceEmptyMenus( - acc: ContentActionRef[], - el: ContentActionRef -): ContentActionRef[] { - if (el.type === ContentActionType.menu) { - if ((el.children || []).length === 0) { - return acc; - } - } - return acc.concat(el); -} - -export function mergeObjects(...objects): any { - const result = {}; - - objects.forEach(source => { - Object.keys(source).forEach(prop => { - if (!prop.startsWith('$')) { - if (prop in result && Array.isArray(result[prop])) { - // result[prop] = result[prop].concat(source[prop]); - result[prop] = mergeArrays(result[prop], source[prop]); - } else if (prop in result && typeof result[prop] === 'object') { - result[prop] = mergeObjects(result[prop], source[prop]); - } else { - result[prop] = source[prop]; - } - } - }); - }); - - return result; -} - -export function mergeArrays(left: any[], right: any[]): any[] { - const result = []; - const map = {}; - - (left || []).forEach(entry => { - const element = entry; - if (element && element.hasOwnProperty('id')) { - map[element.id] = element; - } else { - result.push(element); - } - }); - - (right || []).forEach(entry => { - const element = entry; - if (element && element.hasOwnProperty('id') && map[element.id]) { - const merged = mergeObjects(map[element.id], element); - map[element.id] = merged; - } else { - result.push(element); - } - }); - - return Object.values(map).concat(result); -} diff --git a/projects/adf-extensions/src/lib/config/extension.config.ts b/projects/adf-extensions/src/lib/config/extension.config.ts deleted file mode 100644 index 201c36000..000000000 --- a/projects/adf-extensions/src/lib/config/extension.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { RouteRef } from './routing.extensions'; -import { RuleRef } from './rule.extensions'; -import { ActionRef } from './action.extensions'; - -export interface ExtensionConfig { - $name: string; - $version: string; - $description?: string; - $references?: Array; - - rules?: Array; - routes?: Array; - actions?: Array; - - features?: { - [key: string]: any; - }; -} diff --git a/projects/adf-extensions/src/lib/config/navbar.extensions.ts b/projects/adf-extensions/src/lib/config/navbar.extensions.ts deleted file mode 100644 index ed797da68..000000000 --- a/projects/adf-extensions/src/lib/config/navbar.extensions.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExtensionElement } from './extension-element'; - -export interface NavBarGroupRef extends ExtensionElement { - items: Array; -} - -export interface NavBarLinkRef extends ExtensionElement { - icon: string; - title: string; - route: string; - - url?: string; // evaluated at runtime based on route ref - description?: string; -} diff --git a/projects/adf-extensions/src/lib/config/permission.extensions.ts b/projects/adf-extensions/src/lib/config/permission.extensions.ts deleted file mode 100644 index 09e6ab4e8..000000000 --- a/projects/adf-extensions/src/lib/config/permission.extensions.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface NodePermissions { - check(source: any, permissions: string[], options?: any): boolean; -} diff --git a/projects/adf-extensions/src/lib/config/routing.extensions.ts b/projects/adf-extensions/src/lib/config/routing.extensions.ts deleted file mode 100644 index e9cff64cd..000000000 --- a/projects/adf-extensions/src/lib/config/routing.extensions.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface RouteRef { - id: string; - path: string; - component: string; - - layout?: string; - auth?: string[]; - data?: { [key: string]: string }; -} diff --git a/projects/adf-extensions/src/lib/config/rule.extensions.ts b/projects/adf-extensions/src/lib/config/rule.extensions.ts deleted file mode 100644 index 44c871490..000000000 --- a/projects/adf-extensions/src/lib/config/rule.extensions.ts +++ /dev/null @@ -1,44 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { SelectionState } from '../store/states/selection.state'; -import { NavigationState } from '../store/states/navigation.state'; -import { NodePermissions } from './permission.extensions'; -import { ProfileState } from '../store/states/profile.state'; - -export type RuleEvaluator = (context: RuleContext, ...args: any[]) => boolean; - -export interface RuleContext { - selection: SelectionState; - navigation: NavigationState; - profile: ProfileState; - permissions: NodePermissions; - - getEvaluator(key: string): RuleEvaluator; -} - -export class RuleRef { - type: string; - id?: string; - parameters?: Array; -} - -export interface RuleParameter { - type: string; - value: any; - parameters?: Array; -} diff --git a/projects/adf-extensions/src/lib/config/sidebar.extensions.ts b/projects/adf-extensions/src/lib/config/sidebar.extensions.ts deleted file mode 100644 index a654c3a08..000000000 --- a/projects/adf-extensions/src/lib/config/sidebar.extensions.ts +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExtensionElement } from './extension-element'; - -export interface SidebarTabRef extends ExtensionElement { - title: string; - component: string; - - icon?: string; - rules?: { - visible?: string; - [key: string]: string; - }; -} diff --git a/projects/adf-extensions/src/lib/config/viewer.extensions.ts b/projects/adf-extensions/src/lib/config/viewer.extensions.ts deleted file mode 100644 index 22c6d95b3..000000000 --- a/projects/adf-extensions/src/lib/config/viewer.extensions.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExtensionElement } from './extension-element'; - -export interface ViewerExtensionRef extends ExtensionElement { - fileExtension: string; - component: string; -} diff --git a/projects/adf-extensions/src/lib/evaluators/core.evaluators.spec.ts b/projects/adf-extensions/src/lib/evaluators/core.evaluators.spec.ts deleted file mode 100644 index 304be9919..000000000 --- a/projects/adf-extensions/src/lib/evaluators/core.evaluators.spec.ts +++ /dev/null @@ -1,237 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { every, not, some } from './core.evaluators'; -import { RuleParameter } from '../config/rule.extensions'; - -describe('Core Evaluators', () => { - - const context: any = { - getEvaluator(key: string) { - switch (key) { - case 'positive': - return () => true; - case 'negative': - return () => false; - default: - return null; - } - } - }; - - describe('not', () => { - it('should evaluate a single rule to [true]', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const result = not(context, parameter); - expect(result).toBeTruthy(); - }); - - it('should evaluate to [false] when no parameters provided', () => { - const result = not(context); - expect(result).toBeFalsy(); - }); - - it('should evaluate to [false] when evaluator not available', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'missing' - }; - - const result = not(context, parameter); - expect(result).toBeFalsy(); - }); - - it('should evaluate a single rule to [false]', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const result = not(context, parameter); - expect(result).toBeFalsy(); - }); - - it('should evaluate multiple rules to [true]', () => { - const parameter1: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const parameter2: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const parameter3: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const result = not(context, parameter1, parameter2, parameter3); - expect(result).toBeTruthy(); - }); - - it('should evaluate to [false] when one of the rules fails', () => { - const parameter1: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const parameter2: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const parameter3: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const result = not(context, parameter1, parameter2, parameter3); - expect(result).toBeFalsy(); - }); - }); - - describe('every', () => { - it('should evaluate a single rule to [true]', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const result = every(context, parameter); - expect(result).toBeTruthy(); - }); - - it('should evaluate to [false] when no parameters provided', () => { - const result = every(context); - expect(result).toBeFalsy(); - }); - - it('should evaluate to [false] when evaluator not available', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'missing' - }; - - const result = every(context, parameter); - expect(result).toBeFalsy(); - }); - - it('should evaluate a single rule to [false]', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const result = every(context, parameter); - expect(result).toBeFalsy(); - }); - - it('should evaluate multiple rules to [true]', () => { - const parameter1: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const parameter2: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const parameter3: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const result = every(context, parameter1, parameter2, parameter3); - expect(result).toBeTruthy(); - }); - - it('should evaluate to [false] when one of the rules fails', () => { - const parameter1: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const parameter2: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const parameter3: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const result = every(context, parameter1, parameter2, parameter3); - expect(result).toBeFalsy(); - }); - }); - - describe('some', () => { - it('should evaluate a single rule to [true]', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const result = some(context, parameter); - expect(result).toBeTruthy(); - }); - - it('should evaluate to [false] when no parameters provided', () => { - const result = some(context); - expect(result).toBeFalsy(); - }); - - it('should evaluate to [false] when evaluator not available', () => { - const parameter: RuleParameter = { - type: 'primitive', - value: 'missing' - }; - - const result = some(context, parameter); - expect(result).toBeFalsy(); - }); - - it('should evaluate to [true] if any rule succeeds', () => { - const parameter1: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const parameter2: RuleParameter = { - type: 'primitive', - value: 'positive' - }; - - const parameter3: RuleParameter = { - type: 'primitive', - value: 'negative' - }; - - const result = some(context, parameter1, parameter2, parameter3); - expect(result).toBeTruthy(); - }); - }); - -}); diff --git a/projects/adf-extensions/src/lib/evaluators/core.evaluators.ts b/projects/adf-extensions/src/lib/evaluators/core.evaluators.ts deleted file mode 100644 index b6ce7748a..000000000 --- a/projects/adf-extensions/src/lib/evaluators/core.evaluators.ts +++ /dev/null @@ -1,66 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { RuleContext, RuleParameter } from '../config/rule.extensions'; - -export function not(context: RuleContext, ...args: RuleParameter[]): boolean { - if (!args || args.length === 0) { - return false; - } - - return args - .every(arg => { - const evaluator = context.getEvaluator(arg.value); - if (!evaluator) { - console.warn('evaluator not found: ' + arg.value); - return false; - } - return !evaluator(context, ...(arg.parameters || [])); - }); -} - -export function every(context: RuleContext, ...args: RuleParameter[]): boolean { - if (!args || args.length === 0) { - return false; - } - - return args - .every(arg => { - const evaluator = context.getEvaluator(arg.value); - if (!evaluator) { - console.warn('evaluator not found: ' + arg.value); - return false; - } - return evaluator(context, ...(arg.parameters || [])); - }); -} - -export function some(context: RuleContext, ...args: RuleParameter[]): boolean { - if (!args || args.length === 0) { - return false; - } - - return args - .some(arg => { - const evaluator = context.getEvaluator(arg.value); - if (!evaluator) { - console.warn('evaluator not found: ' + arg.value); - return false; - } - return evaluator(context, ...(arg.parameters || [])); - }); -} diff --git a/projects/adf-extensions/src/lib/extensions.module.ts b/projects/adf-extensions/src/lib/extensions.module.ts deleted file mode 100644 index e4950e5c0..000000000 --- a/projects/adf-extensions/src/lib/extensions.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { NgModule, ModuleWithProviders } from '@angular/core'; -import { ExtensionLoaderService } from './services/extension-loader.service'; -import { ExtensionService } from './services/extension.service'; -import { DynamicExtensionComponent } from './components/dynamic-component/dynamic.component'; -import { DynamicTabComponent } from './components/dynamic-tab/dynamic-tab.component'; - -@NgModule({ - imports: [], - declarations: [DynamicExtensionComponent, DynamicTabComponent], - exports: [DynamicExtensionComponent, DynamicTabComponent] -}) -export class ExtensionsModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: ExtensionsModule, - providers: [ExtensionLoaderService, ExtensionService] - }; - } - - static forChild(): ModuleWithProviders { - return { - ngModule: ExtensionsModule - }; - } -} diff --git a/projects/adf-extensions/src/lib/services/extension-loader.service.ts b/projects/adf-extensions/src/lib/services/extension-loader.service.ts deleted file mode 100644 index 2cf2e4d64..000000000 --- a/projects/adf-extensions/src/lib/services/extension-loader.service.ts +++ /dev/null @@ -1,140 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { ActionRef, ContentActionRef, ContentActionType } from '../config/action.extensions'; -import { ExtensionElement } from '../config/extension-element'; -import { filterEnabled, getValue, mergeObjects, sortByOrder } from '../config/extension-utils'; -import { ExtensionConfig } from '../config/extension.config'; -import { RouteRef } from '../config/routing.extensions'; -import { RuleRef } from '../config/rule.extensions'; - -@Injectable({ - providedIn: 'root' -}) -export class ExtensionLoaderService { - constructor(private http: HttpClient) {} - - load(configPath: string, pluginsPath: string): Promise { - return new Promise(resolve => { - this.loadConfig(configPath, 0).then(result => { - let config = result.config; - - const override = sessionStorage.getItem('aca.extension.config'); - if (override) { - console.log('overriding extension config'); - config = JSON.parse(override); - } - - const externalPlugins = - localStorage.getItem('experimental.external-plugins') === - 'true'; - - if ( - externalPlugins && - config.$references && - config.$references.length > 0 - ) { - const plugins = config.$references.map((name, idx) => - this.loadConfig(`${pluginsPath}/${name}`, idx) - ); - - Promise.all(plugins).then(results => { - const configs = results - .filter(entry => entry) - .sort(sortByOrder) - .map(entry => entry.config); - - if (configs.length > 0) { - config = mergeObjects(config, ...configs); - } - - resolve(config); - }); - } else { - resolve(config); - } - }); - }); - } - - protected loadConfig( - url: string, - order: number - ): Promise<{ order: number; config: ExtensionConfig }> { - return new Promise(resolve => { - this.http.get(url).subscribe( - config => { - resolve({ - order, - config - }); - }, - error => { - console.log(error); - resolve(null); - } - ); - }); - } - - getElements( - config: ExtensionConfig, - key: string, - fallback: Array = [] - ): Array { - const values = getValue(config, key) || fallback || []; - return values.filter(filterEnabled).sort(sortByOrder); - } - - getContentActions( - config: ExtensionConfig, - key: string - ): Array { - return this.getElements(config, key).map(this.setActionDefaults); - } - - getRules(config: ExtensionConfig): Array { - if (config && config.rules) { - return config.rules; - } - return []; - } - - getRoutes(config: ExtensionConfig): Array { - if (config) { - return config.routes || []; - } - return []; - } - - getActions(config: ExtensionConfig): Array { - if (config) { - return config.actions || []; - } - return []; - } - - protected setActionDefaults(action: ContentActionRef): ContentActionRef { - if (action) { - action.type = action.type || ContentActionType.default; - action.icon = action.icon || 'extension'; - } - return action; - } -} diff --git a/projects/adf-extensions/src/lib/services/extension.service.spec.ts b/projects/adf-extensions/src/lib/services/extension.service.spec.ts deleted file mode 100644 index 701c68f95..000000000 --- a/projects/adf-extensions/src/lib/services/extension.service.spec.ts +++ /dev/null @@ -1,379 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExtensionService } from './extension.service'; -import { ExtensionLoaderService } from './extension-loader.service'; -import { ExtensionConfig } from '../config/extension.config'; -import { RuleRef } from '../config/rule.extensions'; -import { RouteRef } from '../config/routing.extensions'; -import { ActionRef } from '../config/action.extensions'; - -describe('ExtensionService', () => { - const blankConfig: ExtensionConfig = { - $name: 'test.config', - $version: '1.0.0' - }; - - let loader: ExtensionLoaderService; - let service: ExtensionService; - - beforeEach(() => { - loader = new ExtensionLoaderService(null); - service = new ExtensionService(loader); - }); - - it('should load and setup a config', async () => { - spyOn(loader, 'load').and.callFake(() => { - return Promise.resolve(blankConfig); - }); - - spyOn(service, 'setup').and.stub(); - - await service.load(); - - expect(loader.load).toHaveBeenCalled(); - expect(service.setup).toHaveBeenCalledWith(blankConfig); - }); - - it('should raise warning if setting up with missing config', () => { - spyOn(console, 'warn').and.stub(); - - service.setup(null); - - expect(console.warn).toHaveBeenCalledWith('Extension configuration not found'); - }); - - it('should setup default evaluators', () => { - service.setup(blankConfig); - - const evaluators = ['core.every', 'core.some', 'core.not']; - evaluators.forEach(key => { - expect(service.getEvaluator(key)).toBeDefined(`Evaluator ${key} is missing`); - }); - }); - - it('should set custom evaluators', () => { - const evaluator1 = () => true; - const evaluator2 = () => false; - - service.setEvaluators({ - 'eval1': evaluator1, - 'eval2': evaluator2 - }); - - expect(service.getEvaluator('eval1')).toBe(evaluator1); - expect(service.getEvaluator('eval2')).toBe(evaluator2); - }); - - it('should override existing evaluators', () => { - const evaluator1 = () => true; - const evaluator2 = () => false; - - service.setup(blankConfig); - expect(service.getEvaluator('core.every')).toBeDefined(); - expect(service.getEvaluator('core.every')).not.toBe(evaluator1); - - service.setEvaluators({ - 'core.every': evaluator1, - 'eval2': evaluator2 - }); - - expect(service.getEvaluator('core.every')).toBe(evaluator1); - expect(service.getEvaluator('eval2')).toBe(evaluator2); - }); - - it('should negate existing evaluator', () => { - const positive = () => true; - - service.setEvaluators({ - 'positive': positive - }); - - let evaluator = service.getEvaluator('positive'); - expect(evaluator(null)).toBe(true); - - evaluator = service.getEvaluator('!positive'); - expect(evaluator(null, 'param1', 'param2')).toBe(false); - }); - - it('should not update evaluators with null value', () => { - service.setup(blankConfig); - service.setEvaluators(null); - - expect(service.getEvaluator('core.every')).toBeDefined(); - }); - - it('should set authentication guards', () => { - let registered = service.getAuthGuards(['guard1']); - expect(registered.length).toBe(0); - - const guard1: any = {}; - const guard2: any = {}; - - service.setAuthGuards({ - 'auth1': guard1, - 'auth2': guard2 - }); - - registered = service.getAuthGuards(['auth1', 'auth2']); - expect(registered.length).toBe(2); - expect(registered[0]).toBe(guard1); - expect(registered[1]).toBe(guard2); - }); - - it('should overwrite authentication guards', () => { - const guard1: any = {}; - const guard2: any = {}; - - service.setAuthGuards({ - 'auth': guard1 - }); - - expect(service.getAuthGuards(['auth'])).toEqual([guard1]); - - service.setAuthGuards({ - 'auth': guard2 - }); - - expect(service.getAuthGuards(['auth'])).toEqual([guard2]); - }); - - it('should not set authentication guards with null value', () => { - const guard1: any = {}; - - service.setAuthGuards({ - 'auth': guard1 - }); - - service.setAuthGuards(null); - - expect(service.getAuthGuards(['auth'])).toEqual([guard1]); - }); - - it('should not fetch auth guards for missing ids', () => { - const guards = service.getAuthGuards(null); - expect(guards).toEqual([]); - }); - - it('should set components', () => { - const component: any = {}; - - service.setComponents({ - 'component1': component - }); - - expect(service.getComponentById('component1')).toBe(component); - }); - - it('should overwrite components', () => { - const component1: any = {}; - const component2: any = {}; - - service.setComponents({ - 'component': component1 - }); - - expect(service.getComponentById('component')).toBe(component1); - - service.setComponents({ - 'component': component2 - }); - - expect(service.getComponentById('component')).toBe(component2); - }); - - it('should not set components with null value', () => { - const component: any = {}; - - service.setComponents({ - 'component1': component - }); - - expect(service.getComponentById('component1')).toBe(component); - - service.setComponents(null); - - expect(service.getComponentById('component1')).toBe(component); - }); - - it('should fetch route by id', () => { - const route: RouteRef = { - id: 'test.route', - component: 'component', - path: '/ext/route1' - }; - - spyOn(loader, 'getRoutes').and.returnValue([route]); - service.setup(blankConfig); - - expect(service.getRouteById('test.route')).toBe(route); - }); - - it('should fetch action by id', () => { - const action: ActionRef = { - id: 'test.action', - type: 'action' - }; - - spyOn(loader, 'getActions').and.returnValue([action]); - service.setup(blankConfig); - - expect(service.getActionById('test.action')).toBe(action); - }); - - it('should fetch rule by id', () => { - const rule: RuleRef = { - id: 'test.rule', - type: 'core.every' - }; - - spyOn(loader, 'getRules').and.returnValue([rule]); - service.setup(blankConfig); - - expect(service.getRuleById('test.rule')).toBe(rule); - }); - - it('should evaluate condition', () => { - const condition = () => true; - - service.setEvaluators({ - 'test.condition': condition - }); - - const context: any = { - getEvaluator(key: string) { - return service.getEvaluator(key); - } - }; - - const result = service.evaluateRule('test.condition', context); - expect(result).toBe(true); - }); - - it('should evaluate missing condition as [false]', () => { - const context: any = { - getEvaluator(key: string) { - return service.getEvaluator(key); - } - }; - - const result = service.evaluateRule('missing.condition', context); - expect(result).toBe(false); - }); - - it('should evaluate rule by reference', () => { - const ruleRef: RuleRef = { - id: 'test.rule', - type: 'core.every', - parameters: [ - { - type: 'rule', - value: 'test.condition' - } - ] - }; - - spyOn(loader, 'getRules').and.returnValue([ruleRef]); - service.setup(blankConfig); - - const condition = () => true; - - service.setEvaluators({ - 'test.condition': condition - }); - - const context: any = { - getEvaluator(key: string) { - return service.getEvaluator(key); - } - }; - - const result = service.evaluateRule('test.rule', context); - expect(result).toBe(true); - }); - - it('should evaluate rule ref with missing condition as [false]', () => { - const ruleRef: RuleRef = { - id: 'test.rule', - type: 'missing.evaluator' - }; - - spyOn(loader, 'getRules').and.returnValue([ruleRef]); - service.setup(blankConfig); - - const context: any = { - getEvaluator(key: string) { - return service.getEvaluator(key); - } - }; - - const result = service.evaluateRule('test.rule', context); - expect(result).toBe(false); - }); - - it('should evaluate rule ref with missing evaluator as [false]', () => { - const ruleRef: RuleRef = { - id: 'test.rule', - type: 'core.every', - parameters: [ - { - type: 'rule', - value: 'missing.condition' - } - ] - }; - - spyOn(loader, 'getRules').and.returnValue([ruleRef]); - service.setup(blankConfig); - - const context: any = { - getEvaluator(key: string) { - return service.getEvaluator(key); - } - }; - - const result = service.evaluateRule('test.rule', context); - expect(result).toBe(false); - }); - - describe('expressions', () => { - it('should eval static value', () => { - const value = service.runExpression('hello world'); - expect(value).toBe('hello world'); - }); - - it('should eval string as an expression', () => { - const value = service.runExpression('$( "hello world" )'); - expect(value).toBe('hello world'); - }); - - it('should eval expression with no context', () => { - const value = service.runExpression('$( 1 + 1 )'); - expect(value).toBe(2); - }); - - it('should eval expression with context', () => { - const context = { - a: 'hey', - b: 'there' - }; - const expression = '$( context.a + " " + context.b + "!" )'; - const value = service.runExpression(expression, context); - expect(value).toBe('hey there!'); - }); - }); -}); diff --git a/projects/adf-extensions/src/lib/services/extension.service.ts b/projects/adf-extensions/src/lib/services/extension.service.ts deleted file mode 100644 index 2f78199a3..000000000 --- a/projects/adf-extensions/src/lib/services/extension.service.ts +++ /dev/null @@ -1,148 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable, Type } from '@angular/core'; -import { RuleEvaluator, RuleRef, RuleContext, RuleParameter } from '../config/rule.extensions'; -import { ExtensionConfig } from '../config/extension.config'; -import { ExtensionLoaderService } from './extension-loader.service'; -import { RouteRef } from '../config/routing.extensions'; -import { ActionRef } from '../config/action.extensions'; -import * as core from '../evaluators/core.evaluators'; - -@Injectable() -export class ExtensionService { - configPath = 'assets/app.extensions.json'; - pluginsPath = 'assets/plugins'; - - rules: Array = []; - routes: Array = []; - actions: Array = []; - - authGuards: { [key: string]: Type<{}> } = {}; - components: { [key: string]: Type<{}> } = {}; - evaluators: { [key: string]: RuleEvaluator } = {}; - - constructor(private loader: ExtensionLoaderService) {} - - async load(): Promise { - const config = await this.loader.load( - this.configPath, - this.pluginsPath - ); - this.setup(config); - return config; - } - - setup(config: ExtensionConfig) { - if (!config) { - console.warn('Extension configuration not found'); - return; - } - - this.setEvaluators({ - 'core.every': core.every, - 'core.some': core.some, - 'core.not': core.not - }); - - this.rules = this.loader.getRules(config); - this.actions = this.loader.getActions(config); - this.routes = this.loader.getRoutes(config); - } - - setEvaluators(values: { [key: string]: RuleEvaluator }) { - if (values) { - this.evaluators = Object.assign({}, this.evaluators, values); - } - } - - setAuthGuards(values: { [key: string]: Type<{}> }) { - if (values) { - this.authGuards = Object.assign({}, this.authGuards, values); - } - } - - setComponents(values: { [key: string]: Type<{}> }) { - if (values) { - this.components = Object.assign({}, this.components, values); - } - } - - getRouteById(id: string): RouteRef { - return this.routes.find(route => route.id === id); - } - - getAuthGuards(ids: string[]): Array> { - return (ids || []) - .map(id => this.authGuards[id]) - .filter(guard => guard); - } - - getActionById(id: string): ActionRef { - return this.actions.find(action => action.id === id); - } - - getEvaluator(key: string): RuleEvaluator { - if (key && key.startsWith('!')) { - const fn = this.evaluators[key.substring(1)]; - return (context: RuleContext, ...args: RuleParameter[]): boolean => { - return !fn(context, ...args); - }; - } - return this.evaluators[key]; - } - - evaluateRule(ruleId: string, context: RuleContext): boolean { - const ruleRef = this.getRuleById(ruleId); - - if (ruleRef) { - const evaluator = this.getEvaluator(ruleRef.type); - if (evaluator) { - return evaluator(context, ...ruleRef.parameters); - } - } else { - const evaluator = this.getEvaluator(ruleId); - if (evaluator) { - return evaluator(context); - } - } - return false; - } - - getComponentById(id: string): Type<{}> { - return this.components[id]; - } - - getRuleById(id: string): RuleRef { - return this.rules.find(ref => ref.id === id); - } - - runExpression(value: string, context?: any) { - const pattern = new RegExp(/\$\((.*\)?)\)/g); - const matches = pattern.exec(value); - - if (matches && matches.length > 1) { - const expression = matches[1]; - const fn = new Function('context', `return ${expression}`); - const result = fn(context); - - return result; - } - - return value; - } -} diff --git a/projects/adf-extensions/src/lib/store/states/navigation.state.ts b/projects/adf-extensions/src/lib/store/states/navigation.state.ts deleted file mode 100644 index f3897e3f8..000000000 --- a/projects/adf-extensions/src/lib/store/states/navigation.state.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Node } from 'alfresco-js-api'; - -export interface NavigationState { - currentFolder?: Node; - url?: string; -} diff --git a/projects/adf-extensions/src/lib/store/states/profile.state.ts b/projects/adf-extensions/src/lib/store/states/profile.state.ts deleted file mode 100644 index 3cd4e67a8..000000000 --- a/projects/adf-extensions/src/lib/store/states/profile.state.ts +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface ProfileState { - id: string; - isAdmin: boolean; - firstName: string; - lastName: string; - userName?: string; - initials?: string; -} diff --git a/projects/adf-extensions/src/lib/store/states/selection.state.ts b/projects/adf-extensions/src/lib/store/states/selection.state.ts deleted file mode 100644 index 8baa38d4b..000000000 --- a/projects/adf-extensions/src/lib/store/states/selection.state.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { MinimalNodeEntity, SiteEntry } from 'alfresco-js-api'; - -export interface SelectionState { - count: number; - nodes: MinimalNodeEntity[]; - libraries: SiteEntry[]; - isEmpty: boolean; - first?: MinimalNodeEntity; - last?: MinimalNodeEntity; - folder?: MinimalNodeEntity; - file?: MinimalNodeEntity; - library?: SiteEntry; -} diff --git a/projects/adf-extensions/src/public_api.ts b/projects/adf-extensions/src/public_api.ts deleted file mode 100644 index 4001b6ccd..000000000 --- a/projects/adf-extensions/src/public_api.ts +++ /dev/null @@ -1,36 +0,0 @@ -/*! - * @license - * Copyright 2016 - 2018 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export * from './lib/config/action.extensions'; -export * from './lib/config/extension-element'; -export * from './lib/config/extension-utils'; -export * from './lib/config/extension.config'; -export * from './lib/config/navbar.extensions'; -export * from './lib/config/permission.extensions'; -export * from './lib/config/routing.extensions'; -export * from './lib/config/rule.extensions'; -export * from './lib/config/sidebar.extensions'; -export * from './lib/config/viewer.extensions'; - -export * from './lib/services/extension-loader.service'; -export * from './lib/services/extension.service'; - -export * from './lib/store/states/navigation.state'; -export * from './lib/store/states/profile.state'; -export * from './lib/store/states/selection.state'; - -export * from './lib/extensions.module'; diff --git a/projects/adf-extensions/src/test.ts b/projects/adf-extensions/src/test.ts deleted file mode 100644 index e11ff1c97..000000000 --- a/projects/adf-extensions/src/test.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// 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/adf-extensions/tsconfig.lib.json b/projects/adf-extensions/tsconfig.lib.json deleted file mode 100644 index bd8c4dab3..000000000 --- a/projects/adf-extensions/tsconfig.lib.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2015" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "flatModuleId": "AUTOGENERATED", - "flatModuleOutFile": "AUTOGENERATED", - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] -} diff --git a/projects/adf-extensions/tsconfig.spec.json b/projects/adf-extensions/tsconfig.spec.json deleted file mode 100644 index 16da33db0..000000000 --- a/projects/adf-extensions/tsconfig.spec.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/projects/adf-extensions/tslint.json b/projects/adf-extensions/tslint.json deleted file mode 100644 index 65bb2a595..000000000 --- a/projects/adf-extensions/tslint.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "adf", - "camelCase" - ], - "component-selector": [ - true, - "element", - "adf", - "kebab-case" - ] - } -} diff --git a/projects/my-extension/assets/my-extension.json b/projects/my-extension/assets/my-extension.json deleted file mode 100644 index 3e492a708..000000000 --- a/projects/my-extension/assets/my-extension.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "../../../extension.schema.json", - "$version": "1.0.0", - "$name": "plugin1", - "$description": "demo plugin", - - "routes": [ - { - "id": "my.extension.route", - "path": "ext/my/route", - "component": "my-extension.main.component" - } - ], - - "features": { - "navbar": [ - { - "id": "my.extension.nav", - "items": [ - { - "id": "my.extension.main", - "icon": "extension", - "title": "My Extension", - "route": "my.extension.route" - } - ] - } - ] - } -} diff --git a/projects/my-extension/karma.conf.js b/projects/my-extension/karma.conf.js deleted file mode 100644 index 4c5f8d03f..000000000 --- a/projects/my-extension/karma.conf.js +++ /dev/null @@ -1,31 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); -}; diff --git a/projects/my-extension/ng-package.json b/projects/my-extension/ng-package.json deleted file mode 100644 index d754b4f90..000000000 --- a/projects/my-extension/ng-package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/my-extension", - "lib": { - "entryFile": "src/public_api.ts", - "umdModuleIds": { - "@alfresco/adf-extensions": "@alfresco/adf-extensions" - } - } -} diff --git a/projects/my-extension/package.json b/projects/my-extension/package.json deleted file mode 100644 index 261671ec8..000000000 --- a/projects/my-extension/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "my-extension", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^6.0.0-rc.0 || ^6.0.0", - "@angular/core": "^6.0.0-rc.0 || ^6.0.0" - } -} \ No newline at end of file diff --git a/projects/my-extension/src/lib/my-extension.component.spec.ts b/projects/my-extension/src/lib/my-extension.component.spec.ts deleted file mode 100644 index 349674994..000000000 --- a/projects/my-extension/src/lib/my-extension.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { MyExtensionComponent } from './my-extension.component'; - -describe('MyExtensionComponent', () => { - let component: MyExtensionComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ MyExtensionComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MyExtensionComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/my-extension/src/lib/my-extension.component.ts b/projects/my-extension/src/lib/my-extension.component.ts deleted file mode 100644 index 64ac67f20..000000000 --- a/projects/my-extension/src/lib/my-extension.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'lib-my-extension', - template: ` -

- my-extension works! -

- `, - styles: [] -}) -export class MyExtensionComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/projects/my-extension/src/lib/my-extension.module.ts b/projects/my-extension/src/lib/my-extension.module.ts deleted file mode 100644 index ff56075f2..000000000 --- a/projects/my-extension/src/lib/my-extension.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule } from '@angular/core'; -import { MyExtensionComponent } from './my-extension.component'; -import { ExtensionService } from '@alfresco/adf-extensions'; - -@NgModule({ - imports: [ - ], - declarations: [MyExtensionComponent], - exports: [MyExtensionComponent], - entryComponents: [MyExtensionComponent] -}) -export class MyExtensionModule { - constructor(extensions: ExtensionService) { - extensions.setComponents({ - 'my-extension.main.component': MyExtensionComponent, - }); - } -} diff --git a/projects/my-extension/src/lib/my-extension.service.spec.ts b/projects/my-extension/src/lib/my-extension.service.spec.ts deleted file mode 100644 index 02efff0f8..000000000 --- a/projects/my-extension/src/lib/my-extension.service.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { MyExtensionService } from './my-extension.service'; - -describe('MyExtensionService', () => { - beforeEach(() => TestBed.configureTestingModule({})); - - it('should be created', () => { - const service: MyExtensionService = TestBed.get(MyExtensionService); - expect(service).toBeTruthy(); - }); -}); diff --git a/projects/my-extension/src/lib/my-extension.service.ts b/projects/my-extension/src/lib/my-extension.service.ts deleted file mode 100644 index d67ac35e5..000000000 --- a/projects/my-extension/src/lib/my-extension.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class MyExtensionService { - - constructor() { } -} diff --git a/projects/my-extension/src/public_api.ts b/projects/my-extension/src/public_api.ts deleted file mode 100644 index e53c40142..000000000 --- a/projects/my-extension/src/public_api.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Public API Surface of my-extension - */ - -export * from './lib/my-extension.service'; -export * from './lib/my-extension.component'; -export * from './lib/my-extension.module'; diff --git a/projects/my-extension/src/test.ts b/projects/my-extension/src/test.ts deleted file mode 100644 index e11ff1c97..000000000 --- a/projects/my-extension/src/test.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// 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/my-extension/tsconfig.lib.json b/projects/my-extension/tsconfig.lib.json deleted file mode 100644 index 89a9991c0..000000000 --- a/projects/my-extension/tsconfig.lib.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2015" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] -} diff --git a/projects/my-extension/tsconfig.spec.json b/projects/my-extension/tsconfig.spec.json deleted file mode 100644 index 16da33db0..000000000 --- a/projects/my-extension/tsconfig.spec.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/projects/my-extension/tslint.json b/projects/my-extension/tslint.json deleted file mode 100644 index 73f120b7e..000000000 --- a/projects/my-extension/tslint.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "lib", - "camelCase" - ], - "component-selector": [ - true, - "element", - "lib", - "kebab-case" - ] - } -} diff --git a/src/app/extensions.module.ts b/src/app/extensions.module.ts index 40e017432..675b1aa9e 100644 --- a/src/app/extensions.module.ts +++ b/src/app/extensions.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; -import { AcaDevToolsModule } from 'aca-dev-tools'; +import { AcaDevToolsModule } from '@denysvuika/aca-dev-tools'; import { CodeEditorModule } from '@ngstack/code-editor'; -import { MyExtensionModule } from 'my-extension'; // Main entry point for external extensions only. // For any application-specific code use CoreExtensionsModule instead. @@ -14,8 +13,7 @@ import { MyExtensionModule } from 'my-extension'; // use local Typings Worker typingsWorkerUrl: 'assets/workers/typings-worker.js' }), - AcaDevToolsModule, - MyExtensionModule + AcaDevToolsModule ] }) export class AppExtensionsModule {} diff --git a/src/assets/app.extensions.json b/src/assets/app.extensions.json index d998252de..914da8170 100644 --- a/src/assets/app.extensions.json +++ b/src/assets/app.extensions.json @@ -2,7 +2,7 @@ "$schema": "../../extension.schema.json", "$name": "app", "$version": "1.0.0", - "$references": ["plugin1.json", "dev.tools.json", "my-extension.json"], + "$references": ["plugin1.json", "dev.tools.json"], "rules": [ { diff --git a/src/assets/plugins/dev.tools.json b/src/assets/plugins/dev.tools.json deleted file mode 100644 index ec9a9d69d..000000000 --- a/src/assets/plugins/dev.tools.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "$schema": "../../../extension.schema.json", - "$version": "1.0.0", - "$name": "dev.tools", - "$description": "ACA dev tools", - - "routes": [ - { - "id": "dev.tools", - "component": "dev.tools.component", - "path": "dev-tools", - "data": { - "configPath": "assets/app.extensions.json", - "pluginsPath": "assets/plugins", - "schemaUri": "../../extension.schema.json", - "schemaPath": "assets/extension.schema.json" - } - } - ], - - "features": { - "navbar": [ - { - "id": "app.navbar.dev.tools", - "items": [ - { - "id": "app.navbar.dev.tools.main", - "icon": "build", - "title": "dev tools", - "route": "dev.tools" - } - ] - } - ], - - "viewer": { - "content": [ - { - "id": "dev.tools.viewer.markdown", - "fileExtension": "md", - "component": "dev.tools.viewer.markdown" - } - ] - } - } -} diff --git a/tsconfig.json b/tsconfig.json index 1348a810d..ebc286434 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,12 +13,7 @@ "lib": ["es2017", "dom"], "module": "es2015", "baseUrl": "./", - "paths": { - "aca-dev-tools": ["dist/aca-dev-tools"], - "aca-dev-tools/*": ["dist/aca-dev-tools/*"], - "my-extension": ["dist/my-extension"], - "my-extension/*": ["dist/my-extension/*"] - } + "paths": {} }, "exclude": ["node_modules"], "angularCompilerOptions": {