[AAE-11496] Publish aca-viewer and aca-preview (#2945)

* [AAE-11496] Publish aca-viewer and aca-preview

* fix tests
This commit is contained in:
Bartosz Sekula
2023-01-31 15:35:51 +01:00
committed by GitHub
parent d9014795c1
commit c8e861907d
37 changed files with 832 additions and 74 deletions

View File

@@ -0,0 +1,121 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"projects/aca-viewer/tsconfig.lib.json",
"projects/aca-viewer/tsconfig.spec.json"
],
"createDefaultProgram": true
},
"plugins": [
"eslint-plugin-rxjs",
"eslint-plugin-unicorn"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": [
"lib",
"aca",
"app",
"adf"
],
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": [
"lib",
"aca",
"app",
"adf"
],
"style": "camelCase"
}
],
"@angular-eslint/no-host-metadata-property": "off",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/member-delimiter-style": [
"off",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/semi": [
"off",
null
],
"@typescript-eslint/type-annotation-spacing": "off",
"arrow-parens": [
"off",
"always"
],
"brace-style": [
"off",
"off"
],
"eol-last": "off",
"id-blacklist": "off",
"id-match": "off",
"linebreak-style": "off",
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-duplicate-imports": "error",
"no-extra-semi": "off",
"no-irregular-whitespace": "off",
"no-return-await": "error",
"no-underscore-dangle": "off",
"quote-props": "off",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"space-before-function-paren": "off",
"space-in-parens": [
"off",
"never"
],
"unicorn/filename-case": "error"
}
},
{
"files": [
"*.html"
],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-negated-async": "off",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/eqeqeq": "error"
}
}
]
}

View File

@@ -0,0 +1,24 @@
# AcaViewer
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.1.0.
## Code scaffolding
Run `ng generate component component-name --project aca-viewer` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project aca-viewer`.
> Note: Don't forget to add `--project aca-viewer` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build aca-viewer` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build aca-viewer`, go to the dist folder `cd dist/aca-viewer` and run `npm publish`.
## Running unit tests
Run `ng test aca-viewer` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

View File

@@ -0,0 +1,32 @@
// 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/aca-settings'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: true,
restartOnFileChange: true
});
};

View File

@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@alfresco/aca-viewer",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@@ -0,0 +1,14 @@
{
"name": "@alfresco/aca-viewer",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^14.1.0",
"@angular/core": "^14.1.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,39 @@
<ng-container *ngIf="nodeId">
<adf-viewer
[ngClass]="{
'right_side--hide': !showRightSide
}"
[fileName]="fileName"
[maxRetries]="'viewer.maxRetries' | adfAppConfig"
[nodeId]="nodeId"
[versionId]="versionId"
[allowNavigate]="navigateMultiple"
[allowRightSidebar]="true"
[allowPrint]="false"
[showRightSidebar]="true"
[allowDownload]="false"
[allowFullScreen]="false"
[overlayMode]="true"
(showViewerChange)="onViewerVisibilityChanged()"
[canNavigateBefore]="!!previousNodeId"
[canNavigateNext]="!!nextNodeId"
(navigateBefore)="onNavigateBefore($event)"
(navigateNext)="onNavigateNext($event)"
>
<adf-viewer-sidebar *ngIf="infoDrawerOpened$ | async">
<aca-info-drawer [node]="selection.file"></aca-info-drawer>
</adf-viewer-sidebar>
<adf-viewer-open-with *ngIf="openWith.length">
<ng-container *ngFor="let action of openWith; trackBy: trackByActionId">
<app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item>
</ng-container>
</adf-viewer-open-with>
<adf-viewer-toolbar-actions>
<ng-container *ngFor="let action of toolbarActions; trackBy: trackByActionId">
<aca-toolbar-action [actionRef]="action"></aca-toolbar-action>
</ng-container>
</adf-viewer-toolbar-actions>
</adf-viewer>
</ng-container>

View File

@@ -0,0 +1,27 @@
.app-viewer {
width: 100%;
height: 100%;
.adf-viewer-toolbar .adf-toolbar-divider {
display: none;
}
.adf-viewer-toolbar-actions {
display: flex;
flex-direction: row;
align-items: center;
.adf-toolbar-divider {
display: inline;
}
}
// todo: remove this when viewer supports extensions
.adf-viewer-toolbar .mat-toolbar > button:last-child {
display: none;
}
.adf-viewer.right_side--hide .adf-viewer__sidebar__right {
width: 0;
}
}

View File

@@ -0,0 +1,471 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 <http://www.gnu.org/licenses/>.
*/
import { AppExtensionService, AppHookService, ContentApiService } from '@alfresco/aca-shared';
import {
AppStore,
ClosePreviewAction,
getAppSelection,
isInfoDrawerOpened,
RefreshPreviewAction,
ReloadDocumentListAction,
SetCurrentNodeVersionAction,
SetSelectedNodesAction,
ViewerActionTypes,
ViewNodeAction
} from '@alfresco/aca-shared/store';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { MinimalNodeEntryEntity, SearchRequest, VersionEntry, VersionsApi } from '@alfresco/js-api';
import { Component, HostListener, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router';
import { AlfrescoApiService, ObjectUtils, UploadService, UserPreferencesService, NodesApiService } from '@alfresco/adf-core';
import { Store } from '@ngrx/store';
import { from, Observable, Subject } from 'rxjs';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { Actions, ofType } from '@ngrx/effects';
@Component({
selector: 'aca-viewer',
templateUrl: './viewer.component.html',
styleUrls: ['./viewer.component.scss'],
encapsulation: ViewEncapsulation.None,
host: { class: 'app-viewer' }
})
export class AcaViewerComponent implements OnInit, OnDestroy {
_versionsApi: VersionsApi;
get versionsApi(): VersionsApi {
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
return this._versionsApi;
}
onDestroy$ = new Subject<boolean>();
fileName: string;
folderId: string = null;
nodeId: string = null;
versionId: string = null;
node: MinimalNodeEntryEntity;
selection: SelectionState;
infoDrawerOpened$: Observable<boolean>;
showRightSide = false;
openWith: ContentActionRef[] = [];
toolbarActions: ContentActionRef[] = [];
navigateSource: string = null;
previousNodeId: string;
nextNodeId: string;
navigateMultiple = true;
routesSkipNavigation = ['shared', 'recent-files', 'favorites'];
navigationSources = ['favorites', 'libraries', 'personal-files', 'recent-files', 'shared'];
recentFileFilters = [
'TYPE:"content"',
'-PNAME:"0/wiki"',
'-TYPE:"app:filelink"',
'-TYPE:"fm:post"',
'-TYPE:"cm:thumbnail"',
'-TYPE:"cm:failedThumbnail"',
'-TYPE:"cm:rating"',
'-TYPE:"dl:dataList"',
'-TYPE:"dl:todoList"',
'-TYPE:"dl:issue"',
'-TYPE:"dl:contact"',
'-TYPE:"dl:eventAgenda"',
'-TYPE:"dl:event"',
'-TYPE:"dl:task"',
'-TYPE:"dl:simpletask"',
'-TYPE:"dl:meetingAgenda"',
'-TYPE:"dl:location"',
'-TYPE:"fm:topic"',
'-TYPE:"fm:post"',
'-TYPE:"ia:calendarEvent"',
'-TYPE:"lnk:link"'
];
private navigationPath: string;
private previewLocation: string;
private containersSkipNavigation = ['adf-viewer__sidebar', 'cdk-overlay-container', 'adf-image-viewer'];
constructor(
private router: Router,
private route: ActivatedRoute,
private store: Store<AppStore>,
private extensions: AppExtensionService,
private contentApi: ContentApiService,
private actions$: Actions,
private preferences: UserPreferencesService,
private apiService: AlfrescoApiService,
private nodesApiService: NodesApiService,
private uploadService: UploadService,
private appHookService: AppHookService
) {}
ngOnInit() {
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
from(this.infoDrawerOpened$)
.pipe(takeUntil(this.onDestroy$))
.subscribe((val) => {
this.showRightSide = val;
});
this.store
.select(getAppSelection)
.pipe(takeUntil(this.onDestroy$))
.subscribe((selection) => {
this.selection = selection;
});
this.extensions
.getViewerToolbarActions()
.pipe(takeUntil(this.onDestroy$))
.subscribe((actions) => {
this.toolbarActions = actions;
});
this.extensions
.getOpenWithActions()
.pipe(takeUntil(this.onDestroy$))
.subscribe((actions) => {
this.openWith = actions;
});
this.route.params.subscribe((params) => {
this.folderId = params.folderId;
const { nodeId } = params;
this.versionId = params.versionId;
if (this.versionId) {
this.versionsApi.getVersion(nodeId, this.versionId).then((version: VersionEntry) => {
if (version) {
this.store.dispatch(new SetCurrentNodeVersionAction(version));
}
});
}
if (nodeId) {
this.displayNode(nodeId);
}
});
this.route.queryParams.subscribe((params) => {
this.navigationPath = params.path || params.location;
});
if (this.route.snapshot.data && this.route.snapshot.data.navigateSource) {
const source = this.route.snapshot.data.navigateSource.toLowerCase();
if (this.navigationSources.includes(source)) {
this.navigateSource = this.route.snapshot.data.navigateSource;
}
}
this.actions$.pipe(ofType<ClosePreviewAction>(ViewerActionTypes.ClosePreview), takeUntil(this.onDestroy$)).subscribe(() => {
this.store.dispatch(new SetCurrentNodeVersionAction(null));
this.navigateToFileLocation();
});
this.actions$
.pipe(ofType<RefreshPreviewAction>(ViewerActionTypes.RefreshPreview), takeUntil(this.onDestroy$))
.subscribe((action: RefreshPreviewAction) => {
this.displayNode(action?.payload?.entry?.id);
});
this.appHookService.nodesDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
this.uploadService.fileUploadDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
this.uploadService.fileUploadComplete.pipe(debounceTime(300), takeUntil(this.onDestroy$)).subscribe((file) => {
this.nodesApiService.nodeUpdated.next(file.data.entry);
this.displayNode(file.data.entry.id);
});
this.previewLocation = this.router.url.substr(0, this.router.url.indexOf('/', 1)).replace(/\//g, '');
}
onViewerVisibilityChanged() {
this.store.dispatch(new ReloadDocumentListAction());
this.navigateToFileLocation();
}
ngOnDestroy() {
this.store.dispatch(new SetCurrentNodeVersionAction(null));
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id;
}
async displayNode(nodeId: string) {
if (nodeId) {
try {
this.node = await this.contentApi.getNodeInfo(nodeId).toPromise();
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
this.navigateMultiple = this.extensions.canShowViewerNavigation({ entry: this.node });
if (!this.navigateMultiple) {
this.nodeId = this.node.id;
this.fileName = this.node.name + this.node?.properties?.['cm:versionLabel'];
return;
}
if (this.node && this.node.isFile) {
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
this.nodeId = this.node.id;
this.previousNodeId = nearest.left;
this.nextNodeId = nearest.right;
this.fileName = this.node.name + this.node?.properties?.['cm:versionLabel'];
return;
}
} catch (error) {
const statusCode = JSON.parse(error.message).error.statusCode;
if (statusCode !== 401) {
this.router.navigate([this.previewLocation, { outlets: { viewer: null } }]).then(() => {
this.router.navigate([this.previewLocation, nodeId]);
});
}
}
}
}
onNavigateBefore(event: MouseEvent | KeyboardEvent): void {
if (event.type !== 'click' && this.shouldNavigate(event.target as HTMLElement)) {
return;
}
const location = this.getFileLocation();
this.store.dispatch(new ViewNodeAction(this.previousNodeId, { location }));
}
onNavigateNext(event: MouseEvent | KeyboardEvent): void {
if (event.type !== 'click' && this.shouldNavigate(event.target as HTMLElement)) {
return;
}
const location = this.getFileLocation();
this.store.dispatch(new ViewNodeAction(this.nextNodeId, { location }));
}
/**
* Retrieves nearest node information for the given node and folder.
*
* @param nodeId Unique identifier of the document node
* @param folderId Unique identifier of the containing folder node.
*/
async getNearestNodes(nodeId: string, folderId: string): Promise<{ left: string; right: string }> {
const empty = {
left: null,
right: null
};
if (nodeId && folderId) {
try {
const ids = await this.getFileIds(this.navigateSource, folderId);
const idx = ids.indexOf(nodeId);
if (idx >= 0) {
return {
left: ids[idx - 1] || null,
right: ids[idx + 1] || null
};
} else {
return empty;
}
} catch {
return empty;
}
} else {
return empty;
}
}
/**
* Retrieves a list of node identifiers for the folder and data source.
*
* @param source Data source name. Allowed values are: personal-files, libraries, favorites, shared, recent-files.
* @param folderId Containing folder node identifier for 'personal-files' and 'libraries' sources.
*/
async getFileIds(source: string, folderId?: string): Promise<string[]> {
if ((source === 'personal-files' || source === 'libraries') && folderId) {
const sortKey = this.preferences.get('personal-files.sorting.key') || 'modifiedAt';
const sortDirection = this.preferences.get('personal-files.sorting.direction') || 'desc';
const nodes = await this.contentApi
.getNodeChildren(folderId, {
// orderBy: `${sortKey} ${sortDirection}`,
fields: ['id', this.getRootField(sortKey)],
where: '(isFile=true)'
})
.toPromise();
const entries = nodes.list.entries.map((obj) => obj.entry);
this.sort(entries, sortKey, sortDirection);
return entries.map((obj) => obj.id);
}
if (source === 'favorites') {
const nodes = await this.contentApi
.getFavorites('-me-', {
where: '(EXISTS(target/file))',
fields: ['target']
})
.toPromise();
const sortKey = this.preferences.get('favorites.sorting.key') || 'modifiedAt';
const sortDirection = this.preferences.get('favorites.sorting.direction') || 'desc';
const files = nodes.list.entries.map((obj) => obj.entry.target.file);
this.sort(files, sortKey, sortDirection);
return files.map((f) => f.id);
}
if (source === 'shared') {
const sortingKey = this.preferences.get('shared.sorting.key') || 'modifiedAt';
const sortingDirection = this.preferences.get('shared.sorting.direction') || 'desc';
const nodes = await this.contentApi
.findSharedLinks({
fields: ['nodeId', this.getRootField(sortingKey)]
})
.toPromise();
const entries = nodes.list.entries.map((obj) => obj.entry);
this.sort(entries, sortingKey, sortingDirection);
return entries.map((obj) => obj.nodeId);
}
if (source === 'recent-files') {
const person = await this.contentApi.getPerson('-me-').toPromise();
const username = person.entry.id;
const sortingKey = this.preferences.get('recent-files.sorting.key') || 'modifiedAt';
const sortingDirection = this.preferences.get('recent-files.sorting.direction') || 'desc';
const query: SearchRequest = {
query: {
query: '*',
language: 'afts'
},
filterQueries: [
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
{
query: this.recentFileFilters.join(' AND ')
}
],
fields: ['id', this.getRootField(sortingKey)],
include: ['path', 'properties', 'allowableOperations'],
sort: [
{
type: 'FIELD',
field: 'cm:modified',
ascending: false
}
]
};
const nodes = await this.contentApi.search(query).toPromise();
const entries = nodes.list.entries.map((obj) => obj.entry);
this.sort(entries, sortingKey, sortingDirection);
return entries.map((obj) => obj.id);
}
return [];
}
/**
* Get the root field name from the property path.
* Example: 'property1.some.child.property' => 'property1'
*
* @param path Property path
*/
getRootField(path: string) {
if (path) {
return path.split('.')[0];
}
return path;
}
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
const key = event.keyCode;
const rightArrow = 39;
const leftArrow = 37;
if (key === rightArrow || key === leftArrow) {
event.preventDefault();
event.stopImmediatePropagation();
}
}
private sort(items: any[], key: string, direction: string) {
const options: Intl.CollatorOptions = {};
if (key.includes('sizeInBytes') || key === 'name') {
options.numeric = true;
}
items.sort((a: any, b: any) => {
let left = ObjectUtils.getValue(a, key);
if (left) {
left = left instanceof Date ? left.valueOf().toString() : left.toString();
} else {
left = '';
}
let right = ObjectUtils.getValue(b, key);
if (right) {
right = right instanceof Date ? right.valueOf().toString() : right.toString();
} else {
right = '';
}
return direction === 'asc' ? left.localeCompare(right, undefined, options) : right.localeCompare(left, undefined, options);
});
}
private navigateToFileLocation() {
const location = this.getFileLocation();
this.router.navigateByUrl(location);
}
private getFileLocation(): string {
return this.navigationPath || this.router.parseUrl(this.router.url).root.children[PRIMARY_OUTLET].toString();
}
private shouldNavigate(element: HTMLElement): boolean {
let currentElement = element.parentElement;
while (currentElement && !this.isChild(currentElement.classList)) {
currentElement = currentElement.parentElement;
}
return !!currentElement;
}
private isChild(list: DOMTokenList): boolean {
return Array.from(list).some((className: string) => this.containersSkipNavigation.includes(className));
}
}

View File

@@ -0,0 +1,60 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 <http://www.gnu.org/licenses/>.
*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { ContentDirectiveModule } from '@alfresco/adf-content-services';
import { SharedDirectivesModule, SharedInfoDrawerModule, SharedToolbarModule } from '@alfresco/aca-shared';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { AcaViewerComponent } from './components/viewer/viewer.component';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
data: {
title: 'APP.PREVIEW.TITLE',
navigateMultiple: true
},
component: AcaViewerComponent
}
];
@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes),
ExtensionsModule.forChild(),
ContentDirectiveModule,
SharedDirectivesModule,
SharedInfoDrawerModule,
SharedToolbarModule
],
declarations: [AcaViewerComponent],
exports: [AcaViewerComponent]
})
export class AcaViewerModule {}

View File

@@ -0,0 +1,6 @@
/*
* Public API Surface of aca-viewer
*/
export * from './lib/components/viewer/viewer.component';
export * from './lib/viewer.module';

View File

@@ -0,0 +1,25 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(
path: string,
deep?: boolean,
filter?: RegExp
): {
<T>(id: string): T;
keys(): string[];
};
};
// 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().forEach(context);

View File

@@ -0,0 +1,15 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@@ -0,0 +1,14 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false,
"paths": {
"@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
"@alfresco/aca-shared/store": ["dist/@alfresco/aca-shared/store"],
}
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View File

@@ -0,0 +1,17 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}