[ADF-2645] move the service use in the upload in the right place (#3189)

[ADF-2645] move the service use in the upload in the right place 
[ADF-2687] No message is displayed when deleting a file/folder from content action
[ADF-2714] [demo shell] Not able to download a version of a file

* add spaces tslint fix
This commit is contained in:
Eugenio Romano
2018-04-14 10:39:24 +01:00
committed by GitHub
parent 66d8935624
commit 6cd0e9f5bb
23 changed files with 122 additions and 282 deletions

View File

@@ -51,7 +51,7 @@ script:
fi fi
- if ([ "$MODULE" == "packaging" ]); then - if ([ "$MODULE" == "packaging" ]); then
(cd lib && npm run new-build || exit 1;); (cd lib && npm run build || exit 1;);
fi fi
- if ([ "$MODULE" == "demo-shell" ]); then - if ([ "$MODULE" == "demo-shell" ]); then

View File

@@ -15,7 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, Input, OnInit, OnChanges, OnDestroy, import {
Component, Input, OnInit, OnChanges, OnDestroy,
EventEmitter, ViewChild, SimpleChanges, Output EventEmitter, ViewChild, SimpleChanges, Output
} from '@angular/core'; } from '@angular/core';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
@@ -336,7 +337,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
if (this.contentService.hasPermission(contentEntry, 'update')) { if (this.contentService.hasPermission(contentEntry, 'update')) {
this.dialog.open(VersionManagerDialogAdapterComponent, { this.dialog.open(VersionManagerDialogAdapterComponent, {
data: { contentEntry, showComments, allowDownload }, data: { contentEntry: contentEntry, showComments: showComments, allowDownload: allowDownload },
panelClass: 'adf-version-manager-dialog', panelClass: 'adf-version-manager-dialog',
width: '630px' width: '630px'
}); });

View File

@@ -1,25 +0,0 @@
var Bundler = require('scss-bundle').Bundler;
var writeFileSync = require('fs-extra').writeFileSync;
var mkdirpSync = require('fs-extra').mkdirpSync;
new Bundler().Bundle('./core/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('core');
writeFileSync('dist/core/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./insights/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('insights');
writeFileSync('dist/insights/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./process-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('process-services');
writeFileSync('dist/process-services/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./content-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('content-services');
writeFileSync('dist/content-services/_theming.scss', result.bundledContent);
});

View File

@@ -4,22 +4,22 @@ var mkdirpSync = require('fs-extra').mkdirpSync;
new Bundler().Bundle('./core/styles/_index.scss', '**/*.scss').then(result => { new Bundler().Bundle('./core/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('core'); mkdirpSync('core');
writeFileSync('core/_theming.scss', result.bundledContent); writeFileSync('dist/core/_theming.scss', result.bundledContent);
}); });
new Bundler().Bundle('./insights/styles/_index.scss', '**/*.scss').then(result => { new Bundler().Bundle('./insights/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('insights'); mkdirpSync('insights');
writeFileSync('insights/_theming.scss', result.bundledContent); writeFileSync('dist/insights/_theming.scss', result.bundledContent);
}); });
new Bundler().Bundle('./process-services/styles/_index.scss', '**/*.scss').then(result => { new Bundler().Bundle('./process-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('process-services'); mkdirpSync('process-services');
writeFileSync('process-services/_theming.scss', result.bundledContent); writeFileSync('dist/process-services/_theming.scss', result.bundledContent);
}); });
new Bundler().Bundle('./content-services/styles/_index.scss', '**/*.scss').then(result => { new Bundler().Bundle('./content-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('content-services'); mkdirpSync('content-services');
writeFileSync('content-services/_theming.scss', result.bundledContent); writeFileSync('dist/content-services/_theming.scss', result.bundledContent);
}); });

View File

@@ -24,7 +24,7 @@ module.exports = webpackMerge(commonConfig, {
], ],
output: { output: {
filename: '[name]/bundles/adf-[name].js', filename: 'dist-webpack/[name]/bundles/adf-[name].js',
library: '[name]', library: '[name]',
libraryTarget: 'umd', libraryTarget: 'umd',
chunkFilename: '[id].chunk.js' chunkFilename: '[id].chunk.js'

View File

@@ -63,7 +63,7 @@ describe('ContentAction', () => {
beforeEach(() => { beforeEach(() => {
contentService = TestBed.get(ContentService); contentService = TestBed.get(ContentService);
nodeActionsService = new NodeActionsService(null, null, null); nodeActionsService = new NodeActionsService(null, null, null);
documentActions = new DocumentActionsService(nodeActionsService, null); documentActions = new DocumentActionsService(nodeActionsService, null, null);
folderActions = new FolderActionsService(nodeActionsService, null, contentService); folderActions = new FolderActionsService(nodeActionsService, null, contentService);
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent); documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);

View File

@@ -15,7 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService } from '@alfresco/adf-core'; import {
AlfrescoApiServiceMock,
AppConfigService,
ContentService,
StorageService,
TranslationMock
} from '@alfresco/adf-core';
import { FileNode, FolderNode } from '../../mock'; import { FileNode, FolderNode } from '../../mock';
import { ContentActionHandler } from '../models/content-action.model'; import { ContentActionHandler } from '../models/content-action.model';
import { DocumentActionsService } from './document-actions.service'; import { DocumentActionsService } from './document-actions.service';
@@ -34,8 +40,7 @@ describe('DocumentActionsService', () => {
let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null); documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService);
service = new DocumentActionsService(null, null, documentListService, contentService);
}); });
it('should register default download action', () => { it('should register default download action', () => {
@@ -47,7 +52,8 @@ describe('DocumentActionsService', () => {
}); });
it('should register custom action handler', () => { it('should register custom action handler', () => {
let handler: ContentActionHandler = function (obj: any) {}; let handler: ContentActionHandler = function (obj: any) {
};
service.setHandler('<key>', handler); service.setHandler('<key>', handler);
expect(service.getHandler('<key>')).toBe(handler); expect(service.getHandler('<key>')).toBe(handler);
}); });
@@ -57,7 +63,8 @@ describe('DocumentActionsService', () => {
}); });
it('should be case insensitive for keys', () => { it('should be case insensitive for keys', () => {
let handler: ContentActionHandler = function (obj: any) {}; let handler: ContentActionHandler = function (obj: any) {
};
service.setHandler('<key>', handler); service.setHandler('<key>', handler);
expect(service.getHandler('<KEY>')).toBe(handler); expect(service.getHandler('<KEY>')).toBe(handler);
}); });
@@ -71,7 +78,7 @@ describe('DocumentActionsService', () => {
let file = new FileNode(); let file = new FileNode();
expect(service.canExecuteAction(file)).toBeTruthy(); expect(service.canExecuteAction(file)).toBeTruthy();
service = new DocumentActionsService(nodeActionsService, null); service = new DocumentActionsService(nodeActionsService, null, null);
expect(service.canExecuteAction(file)).toBeFalsy(); expect(service.canExecuteAction(file)).toBeFalsy();
}); });
@@ -82,7 +89,8 @@ describe('DocumentActionsService', () => {
}); });
it('should set new handler only by key', () => { it('should set new handler only by key', () => {
let handler: ContentActionHandler = function (obj: any) {}; let handler: ContentActionHandler = function (obj: any) {
};
expect(service.setHandler(null, handler)).toBeFalsy(); expect(service.setHandler(null, handler)).toBeFalsy();
expect(service.setHandler('', handler)).toBeFalsy(); expect(service.setHandler('', handler)).toBeFalsy();
expect(service.setHandler('my-handler', handler)).toBeTruthy(); expect(service.setHandler('my-handler', handler)).toBeTruthy();
@@ -205,8 +213,8 @@ describe('DocumentActionsService', () => {
}); });
it('should emit success event upon node deletion', (done) => { it('should emit success event upon node deletion', (done) => {
service.success.subscribe((nodeId) => { service.success.subscribe((message) => {
expect(nodeId).not.toBeNull(); expect(message).toEqual('CORE.DELETE_NODE.SINGULAR');
done(); done();
}); });
spyOn(documentListService, 'deleteNode').and.returnValue(Observable.of(true)); spyOn(documentListService, 'deleteNode').and.returnValue(Observable.of(true));

View File

@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { ContentService } from '@alfresco/adf-core'; import { ContentService, TranslationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MinimalNodeEntity } from 'alfresco-js-api'; import { MinimalNodeEntity } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
@@ -38,6 +38,7 @@ export class DocumentActionsService {
constructor(private nodeActionsService: NodeActionsService, constructor(private nodeActionsService: NodeActionsService,
private contentNodeDialogService: ContentNodeDialogService, private contentNodeDialogService: ContentNodeDialogService,
private translation: TranslationService,
private documentListService?: DocumentListService, private documentListService?: DocumentListService,
private contentService?: ContentService) { private contentService?: ContentService) {
this.setupActionHandlers(); this.setupActionHandlers();
@@ -124,11 +125,19 @@ export class DocumentActionsService {
if (this.contentService.hasPermission(node.entry, permission)) { if (this.contentService.hasPermission(node.entry, permission)) {
handlerObservable = this.documentListService.deleteNode(node.entry.id); handlerObservable = this.documentListService.deleteNode(node.entry.id);
handlerObservable.subscribe(() => { handlerObservable.subscribe(() => {
this.success.next(node.entry.id); let message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
this.success.next(message);
}, () => {
let message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name });
this.error.next(message);
}); });
return handlerObservable; return handlerObservable;
} else { } else {
this.permissionEvent.next(new PermissionModel({type: 'content', action: 'delete', permission: permission})); this.permissionEvent.next(new PermissionModel({
type: 'content',
action: 'delete',
permission: permission
}));
return Observable.throw(new Error('No permission to delete')); return Observable.throw(new Error('No permission to delete'));
} }
} }

View File

@@ -21,7 +21,7 @@ import {
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from 'alfresco-js-api'; import { MinimalNodeEntity, MinimalNodeEntryEntity, NodeEntry, NodePaging } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/throw'; import 'rxjs/add/observable/throw';
@@ -127,6 +127,26 @@ export class DocumentListService {
} }
/** /**
* Gets a node via its node ID.
* @param nodeId
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
* @returns Details of the folder
*/
getNode(nodeId: string, includeFields: string[] = []): Observable<NodeEntry> {
let includeFieldsRequest = ['path', 'properties', 'allowableOperations', 'permissions', ...includeFields]
.filter((element, index, array) => index === array.indexOf(element));
let opts: any = {
includeSource: true,
include: includeFieldsRequest
};
return this.contentService.getNode(nodeId, opts);
}
/**
* @deprecated 2.3.0
* Gets a folder node via its node ID. * Gets a folder node via its node ID.
* @param nodeId ID of the folder node * @param nodeId ID of the folder node
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association") * @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
@@ -144,7 +164,6 @@ export class DocumentListService {
return Observable.fromPromise(this.apiService.getInstance().nodes.getNodeInfo(nodeId, opts)); return Observable.fromPromise(this.apiService.getInstance().nodes.getNodeInfo(nodeId, opts));
} }
/** /**
* Get thumbnail URL for the given document node. * Get thumbnail URL for the given document node.
* @param node Node to get URL for. * @param node Node to get URL for.

View File

@@ -20,7 +20,6 @@
"baseUrl" : "./", "baseUrl" : "./",
"paths": { "paths": {
"@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-process-services": ["../process-services"],
"@alfresco/adf-content-services": ["../content-services"],
"@alfresco/adf-core": ["../core"], "@alfresco/adf-core": ["../core"],
"@angular/*": ["../node_modules/@angular/*"] "@angular/*": ["../node_modules/@angular/*"]
}, },

View File

@@ -33,6 +33,7 @@ describe('UploadButtonComponent', () => {
}; };
let fakeFolderNodeWithPermission = { let fakeFolderNodeWithPermission = {
entry: {
allowableOperations: [ allowableOperations: [
'create', 'create',
'update' 'update'
@@ -40,6 +41,7 @@ describe('UploadButtonComponent', () => {
isFolder: true, isFolder: true,
name: 'Folder Fake Name', name: 'Folder Fake Name',
nodeType: 'cm:folder' nodeType: 'cm:folder'
}
}; };
let component: UploadButtonComponent; let component: UploadButtonComponent;
@@ -54,6 +56,7 @@ describe('UploadButtonComponent', () => {
], ],
providers: [ providers: [
UploadService, UploadService,
ContentService,
{ provide: TranslationService, useClass: TranslationMock } { provide: TranslationService, useClass: TranslationMock }
] ]
}).compileComponents(); }).compileComponents();
@@ -98,7 +101,7 @@ describe('UploadButtonComponent', () => {
component.rootFolderId = '-root-'; component.rootFolderId = '-root-';
component.success = null; component.success = null;
spyOn(component, 'getFolderNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission)); spyOn(contentService, 'getNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission));
component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) });
uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue'); uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue');
@@ -113,7 +116,7 @@ describe('UploadButtonComponent', () => {
component.rootFolderId = '-my-'; component.rootFolderId = '-my-';
component.success = null; component.success = null;
spyOn(component, 'getFolderNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission)); spyOn(contentService, 'getNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission));
component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) });
uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue'); uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue');
@@ -128,7 +131,7 @@ describe('UploadButtonComponent', () => {
component.rootFolderId = '-my-'; component.rootFolderId = '-my-';
spyOn(contentService, 'createFolder').and.returnValue(Observable.of(true)); spyOn(contentService, 'createFolder').and.returnValue(Observable.of(true));
spyOn(component, 'getFolderNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission)); spyOn(contentService, 'getNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission));
component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) });
fixture.detectChanges(); fixture.detectChanges();

View File

@@ -15,29 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { import { ContentService, EXTENDIBLE_COMPONENT, FileModel, FileUtils,
AlfrescoApiService, LogService, NodePermissionSubject, TranslationService, UploadService
EXTENDIBLE_COMPONENT,
FileModel,
FileUtils,
LogService,
NodePermissionSubject,
TranslationService,
UploadService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { import { Component, EventEmitter, forwardRef, Input,
Component, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
EventEmitter,
forwardRef,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
ViewEncapsulation
} from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
import { PermissionModel } from '../../document-list/models/permissions.model'; import { PermissionModel } from '../../document-list/models/permissions.model';
import 'rxjs/add/observable/throw'; import 'rxjs/add/observable/throw';
@@ -111,7 +93,7 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang
private permissionValue: Subject<boolean> = new Subject<boolean>(); private permissionValue: Subject<boolean> = new Subject<boolean>();
constructor(private uploadService: UploadService, constructor(private uploadService: UploadService,
private apiService: AlfrescoApiService, private contentService: ContentService,
protected translateService: TranslationService, protected translateService: TranslationService,
protected logService: LogService protected logService: LogService
) { ) {
@@ -221,29 +203,16 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang
checkPermission() { checkPermission() {
if (this.rootFolderId) { if (this.rootFolderId) {
this.getFolderNode(this.rootFolderId).subscribe(
res => this.permissionValue.next(this.hasCreatePermission(res)),
error => this.error.emit(error)
);
}
}
// TODO: move to ContentService
getFolderNode(nodeId: string): Observable<MinimalNodeEntryEntity> {
let opts: any = { let opts: any = {
includeSource: true, includeSource: true,
include: ['allowableOperations'] include: ['allowableOperations']
}; };
return Observable.fromPromise(this.apiService.getInstance().nodes.getNodeInfo(nodeId, opts)) this.contentService.getNode(this.rootFolderId, opts).subscribe(
.catch(err => this.handleError(err)); res => this.permissionValue.next(this.hasCreatePermission(res.entry)),
error => this.error.emit(error)
);
} }
private handleError(error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
this.logService.error(error);
return Observable.throw(error || 'Server error');
} }
private hasCreatePermission(node: any): boolean { private hasCreatePermission(node: any): boolean {

View File

@@ -22,6 +22,8 @@ import { MaterialModule } from '../material.module';
import { AccordionGroupComponent } from './accordion-group.component'; import { AccordionGroupComponent } from './accordion-group.component';
import { AccordionComponent } from './accordion.component'; import { AccordionComponent } from './accordion.component';
// @deprecated 2.3.0 use the material accodrdion
@NgModule({ @NgModule({
imports: [ imports: [
MaterialModule, MaterialModule,

View File

@@ -25,12 +25,25 @@ export interface LangChangeEvent {
export class TranslationMock { export class TranslationMock {
defaultLang: string = 'en';
userLang: string;
customLoader: any;
translate: any;
onLangChange: EventEmitter<LangChangeEvent> = new EventEmitter<LangChangeEvent>(); onLangChange: EventEmitter<LangChangeEvent> = new EventEmitter<LangChangeEvent>();
addTranslationFolder() { addTranslationFolder() {
} }
onTranslationChanged() {
}
use(): any {
}
get(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> { get(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> {
return Observable.of(key); return Observable.of(key);
} }
@@ -38,4 +51,5 @@ export class TranslationMock {
instant(key: string | Array<string>, interpolateParams?: Object): string | any { instant(key: string | Array<string>, interpolateParams?: Object): string | any {
return key; return key;
} }
} }

View File

@@ -17,7 +17,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { ContentApi, MinimalNodeEntryEntity, Node } from 'alfresco-js-api'; import { ContentApi, MinimalNodeEntryEntity, Node, NodeEntry } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
import { FolderCreatedEvent } from '../events/folder-created.event'; import { FolderCreatedEvent } from '../events/folder-created.event';
@@ -191,6 +191,16 @@ export class ContentService {
.catch(err => this.handleError(err)); .catch(err => this.handleError(err));
} }
/**
* Gets a Node via its node ID.
* @param nodeId
* @param opts
* @returns Details of the folder
*/
getNode(nodeId: string, opts?: any): Observable<NodeEntry> {
return Observable.fromPromise(this.apiService.getInstance().nodes.getNode(nodeId, opts));
}
/** /**
* Check if the user has permissions on that node * Check if the user has permissions on that node
* @param node Node to check allowableOperations * @param node Node to check allowableOperations

View File

@@ -43,7 +43,7 @@ export class TranslationService {
customLoader: TranslateLoaderService; customLoader: TranslateLoaderService;
constructor(public translate: TranslateService, constructor(public translate: TranslateService,
private userPreference: UserPreferencesService, userPreference: UserPreferencesService,
@Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) { @Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) {
this.customLoader = <TranslateLoaderService> this.translate.currentLoader; this.customLoader = <TranslateLoaderService> this.translate.currentLoader;
@@ -56,7 +56,7 @@ export class TranslationService {
} }
} }
this.userPreference.locale$.subscribe( (locale) => { userPreference.locale$.subscribe( (locale) => {
this.userLang = locale; this.userLang = locale;
this.use(this.userLang); this.use(this.userLang);
}); });
@@ -90,7 +90,7 @@ export class TranslationService {
} }
} }
private onTranslationChanged(lang: string): void { onTranslationChanged(lang: string): void {
this.translate.onTranslationChange.next({ this.translate.onTranslationChange.next({
lang: lang, lang: lang,
translations: this.customLoader.getFullTranslationJSON(lang) translations: this.customLoader.getFullTranslationJSON(lang)

View File

@@ -22,7 +22,6 @@
"paths": { "paths": {
"@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-process-services": ["../process-services"],
"@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-content-services": ["../content-services"],
"@alfresco/adf-core": ["../core"],
"@angular/*": ["../node_modules/@angular/*"] "@angular/*": ["../node_modules/@angular/*"]
}, },
"lib": [ "lib": [

View File

@@ -22,7 +22,6 @@
"@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-process-services": ["../process-services"],
"@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-content-services": ["../content-services"],
"@alfresco/adf-core": ["../core"], "@alfresco/adf-core": ["../core"],
"@alfresco/adf-insights": ["../analytics"],
"@angular/*": ["../node_modules/@angular/*"] "@angular/*": ["../node_modules/@angular/*"]
}, },
"lib": [ "lib": [

View File

@@ -7,12 +7,10 @@
"clean": "rimraf node_modules", "clean": "rimraf node_modules",
"clean-lock": "rimraf package-lock.json", "clean-lock": "rimraf package-lock.json",
"rimraf": "rimraf", "rimraf": "rimraf",
"build": "npm run webpack -- --config config/webpack.build.js --progress --profile --bail && npm run build-style", "build-webpack": "npm run webpack -- --config config/webpack.build.js --progress --profile --bail",
"test": "node node_modules/karma/bin/karma start --reporters mocha,coverage --single-run --component .", "test": "node node_modules/karma/bin/karma start --reporters mocha,coverage --single-run --component .",
"build-style": "npm run bundle-scss && npm run webpack -- --config config/webpack.style.js --progress --profile --bail", "build-style": "npm run bundle-scss && npm run webpack -- --config config/webpack.style.js --progress --profile --bail",
"build-style-new": "npm run bundle-scss-new && npm run webpack -- --config config/webpack.style.js --progress --profile --bail",
"bundle-scss": "node ./config/bundle-scss.js", "bundle-scss": "node ./config/bundle-scss.js",
"bundle-scss-new": "node ./config/bundle-scss-new.js",
"test-browser": "node node_modules/karma/bin/karma start karma.conf.js --reporters kjhtml", "test-browser": "node node_modules/karma/bin/karma start karma.conf.js --reporters kjhtml",
"coverage": "", "coverage": "",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",
@@ -24,7 +22,7 @@
"copy-i18n": "mkdir -p dist/core/bundles/assets/adf-core/i18n && cp -R core/i18n/* dist/core/bundles/assets/adf-core/i18n && mkdir -p dist/content-services/bundles/assets/adf-content-services/i18n && cp -R content-services/i18n/* dist/content-services/bundles/assets/adf-content-services/i18n && mkdir -p dist/process-services/bundles/assets/adf-process-services/i18n && cp -R process-services/i18n/* dist/process-services/bundles/assets/adf-process-services/i18n && mkdir -p dist/insights/bundles/assets/adf-insights/i18n && cp -R insights/i18n/* dist/insights/bundles/assets/adf-insights/i18n", "copy-i18n": "mkdir -p dist/core/bundles/assets/adf-core/i18n && cp -R core/i18n/* dist/core/bundles/assets/adf-core/i18n && mkdir -p dist/content-services/bundles/assets/adf-content-services/i18n && cp -R content-services/i18n/* dist/content-services/bundles/assets/adf-content-services/i18n && mkdir -p dist/process-services/bundles/assets/adf-process-services/i18n && cp -R process-services/i18n/* dist/process-services/bundles/assets/adf-process-services/i18n && mkdir -p dist/insights/bundles/assets/adf-insights/i18n && cp -R insights/i18n/* dist/insights/bundles/assets/adf-insights/i18n",
"copy-assets": "cp -R core/assets/* dist/core/bundles/assets && cp -R content-services/assets/* dist/content-services/bundles/assets && cp -R process-services/assets/* dist/process-services/bundles/assets", "copy-assets": "cp -R core/assets/* dist/core/bundles/assets && cp -R content-services/assets/* dist/content-services/bundles/assets && cp -R process-services/assets/* dist/process-services/bundles/assets",
"copy-app-schema": "cp core/app-config/schema.json dist/core/app.config.schema.json", "copy-app-schema": "cp core/app-config/schema.json dist/core/app.config.schema.json",
"new-build": "rm -rf node_modules/@alfresco && npm run build-bundles && npm run build-style-new && npm run copy-i18n && npm run copy-assets && npm run copy-app-schema && npm run bundlesize-check", "build": "rm -rf node_modules/@alfresco && npm run build-bundles && npm run build-style && npm run copy-i18n && npm run copy-assets && npm run copy-app-schema && npm run bundlesize-check",
"build-bundles": "npm run build-core && npm run link-core && npm run build-content && npm run link-content && npm run build-process && npm run build-insights", "build-bundles": "npm run build-core && npm run link-core && npm run build-content && npm run link-content && npm run build-process && npm run build-insights",
"link-core": "mkdir -p ./node_modules/@alfresco/adf-core/ && cp -R ./dist/core/* ./node_modules/@alfresco/adf-core/", "link-core": "mkdir -p ./node_modules/@alfresco/adf-core/ && cp -R ./dist/core/* ./node_modules/@alfresco/adf-core/",
"link-content": "mkdir -p ./node_modules/@alfresco/adf-content-services/ && cp -R ./dist/content-services/* ./node_modules/@alfresco/adf-content-services/", "link-content": "mkdir -p ./node_modules/@alfresco/adf-content-services/ && cp -R ./dist/content-services/* ./node_modules/@alfresco/adf-content-services/",

View File

@@ -19,7 +19,6 @@
"outDir": "../dist/process-services/", "outDir": "../dist/process-services/",
"baseUrl" : "./", "baseUrl" : "./",
"paths": { "paths": {
"@alfresco/adf-process-services": ["../process-services"],
"@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-content-services": ["../content-services"],
"@alfresco/adf-insights": ["../analytics"], "@alfresco/adf-insights": ["../analytics"],
"@alfresco/adf-core": ["../core"], "@alfresco/adf-core": ["../core"],

View File

@@ -1,164 +0,0 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval FORCE_PUBLISH=false
eval EXEC_CHANGE_REGISTRY=false
eval NPM_REGISTRY=false
eval TOKEN_REGISTRY=""
eval OPTIONS=""
eval EXEC_GIT_NPM_INSTALL_JSAPI=false
eval GIT_ISH=""
eval EXEC_SLEEP=false
eval SLEEP_TIME="0"
eval EXEC_VERSION_JSAPI=false
eval JSAPI_VERSION=""
eval projects=( "core"
"insights"
"content-services"
"process-services" )
cd "$DIR/../lib"
show_help() {
echo "Usage: npm-publish.sh"
echo ""
echo "-f or --force publish the package with force"
echo "-r or --registry to publish in an alternative npm registry -registry 'http://npm.local.me:8080/' "
echo "-token auth token for publish in the npm registry"
echo "-t or --tag to add a tag when publish a package"
echo "--sleep add a sleep before any publish"
echo "-gitjsapi to build all the components against a commit-ish version of the JS-API"
echo "-vjsapi <commit-ish> Install different version from npm of JS-API defined in the package.json"
}
enable_force(){
OPTIONS="$OPTIONS -force"
}
enable_change_registry(){
NPM_REGISTRY=$1
EXEC_CHANGE_REGISTRY=true
}
set_sleep(){
SLEEP_TIME=$1
EXEC_SLEEP=true
}
get_token_registry(){
TOKEN_REGISTRY=$1
if [[ "${TOKEN_REGISTRY}" == "" ]]
then
echo "token missing -token"
exit 0
fi
}
enable_js_api_git_link() {
GIT_ISH='git://github.com/Alfresco/alfresco-js-api.git#'$1
EXEC_GIT_NPM_INSTALL_JSAPI=true
}
add_tag(){
eval TAG=$1
if [[ "${TAG}" == "" ]]
then
echo "tag missing -t | -tag"
exit 0
fi
echo "====== TAG WILL BE ADDED DURING THE PUBLISH: ${TAG} ====="
OPTIONS="$OPTIONS --tag $1"
}
version_js_api() {
JSAPI_VERSION=$1
if [[ "${JSAPI_VERSION}" == "" ]]
then
echo "JSAPI version required with -vJSApi"
exit 0
fi
EXEC_VERSION_JSAPI=true
}
change_registry(){
if [[ "${NPM_REGISTRY}" == "" ]]
then
echo "NPM registry required WITH OPTION -r | -registry"
exit 0
fi
echo "====== CHANGE REGISTRY: ${NPM_REGISTRY} ====="
touch .npmrc
echo 'strict-ssl=false' >> .npmrc
echo 'registry=http://'${NPM_REGISTRY} >> .npmrc
echo '//'${NPM_REGISTRY}'/:_authToken="'${TOKEN_REGISTRY}'"' >> .npmrc
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--tag) add_tag $2; shift 2;;
-f|--force) enable_force; shift;;
-token) get_token_registry $2; shift 2;;
--sleep) set_sleep $2; shift 2;;
-r|--registry) enable_change_registry $2; shift 2;;
-gitjsapi) enable_js_api_git_link $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac
done
echo "====== INSTALL AND CLEAN ${PACKAGE} ===== "
npm install rimraf
npm run clean
npm install
if $EXEC_GIT_NPM_INSTALL_JSAPI == true; then
echo "====== Use the alfresco JS-API '$GIT_ISH'====="
npm install $GIT_ISH
cd "${DESTDIR}/node_modules/alfresco-js-api"
npm install
cd ${DESTDIR}
fi
if $EXEC_VERSION_JSAPI == true; then
echo "====== Use the alfresco JS-API '$JSAPI_VERSION'====="
npm install alfresco-js-api@${JSAPI_VERSION} --no-save
fi
echo "====== Build ADF ===== "
npm run build
for PACKAGE in ${projects[@]}
do
DESTDIR="$DIR/../lib/${PACKAGE}"
echo "====== MOVE DIR: ${DESTDIR} ===== "
cd ${DESTDIR}
if $EXEC_CHANGE_REGISTRY == true; then
change_registry
fi
echo "====== PUBLISHING: ${DESTDIR} ===== npm publish ${OPTIONS}"
npm publish ${OPTIONS} --access=public || exit 1
if $EXEC_CHANGE_REGISTRY == true; then
rm .npmrc
fi
if $EXEC_SLEEP == true; then
echo "====== SLEEP ${SLEEP_TIME}"
sleep ${SLEEP_TIME}
fi
cd ${DIR}
done

View File

@@ -146,7 +146,7 @@ fi
if $EXEC_BUILD == true; then if $EXEC_BUILD == true; then
echo "====== Build ADF ===== " echo "====== Build ADF ===== "
npm run new-build npm run build
fi fi
for PACKAGE in ${projects[@]} for PACKAGE in ${projects[@]}

View File

@@ -18,7 +18,7 @@ npm install alfresco-js-api@alpha
echo "====== Build ADF ===== " echo "====== Build ADF ===== "
npm run new-build npm run build
echo "====== COPY new build in demo shell node_modules ===== " echo "====== COPY new build in demo shell node_modules ===== "