From 6cd0e9f5bb1316b6b2ed57fd4b9ee708fd0c71e0 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Sat, 14 Apr 2018 10:39:24 +0100 Subject: [PATCH] [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 --- .travis.yml | 2 +- .../app/components/files/files.component.ts | 7 +- lib/config/bundle-scss-new.js | 25 --- lib/config/bundle-scss.js | 8 +- lib/config/webpack.build.js | 2 +- .../content-action.component.spec.ts | 2 +- .../services/document-actions.service.spec.ts | 26 ++- .../services/document-actions.service.ts | 17 +- .../services/document-list.service.ts | 23 ++- lib/content-services/tsconfig.json | 1 - .../upload-button.component.spec.ts | 23 +-- .../components/upload-button.component.ts | 55 ++---- lib/core/collapsable/collapsable.module.ts | 2 + lib/core/mock/traslation.service.mock.ts | 16 +- lib/core/services/content.service.ts | 12 +- lib/core/services/translation.service.ts | 6 +- lib/core/tsconfig.json | 1 - lib/insights/tsconfig.json | 1 - lib/package.json | 6 +- lib/process-services/tsconfig.json | 1 - scripts/npm-publish-webpack.sh | 164 ------------------ scripts/npm-publish.sh | 2 +- scripts/test-dist.sh | 2 +- 23 files changed, 122 insertions(+), 282 deletions(-) delete mode 100644 lib/config/bundle-scss-new.js delete mode 100755 scripts/npm-publish-webpack.sh diff --git a/.travis.yml b/.travis.yml index cc09e0a37e..012295c44f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ script: fi - if ([ "$MODULE" == "packaging" ]); then - (cd lib && npm run new-build || exit 1;); + (cd lib && npm run build || exit 1;); fi - if ([ "$MODULE" == "demo-shell" ]); then diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 3f9a86ca93..6fc2e6c1fe 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -15,12 +15,13 @@ * limitations under the License. */ -import { Component, Input, OnInit, OnChanges, OnDestroy, +import { + Component, Input, OnInit, OnChanges, OnDestroy, EventEmitter, ViewChild, SimpleChanges, Output } from '@angular/core'; import { MatDialog } from '@angular/material'; import { Router } from '@angular/router'; -import { MinimalNodeEntity, NodePaging, Pagination, MinimalNodeEntryEntity, SiteEntry } from 'alfresco-js-api'; +import { MinimalNodeEntity, NodePaging, Pagination, MinimalNodeEntryEntity, SiteEntry } from 'alfresco-js-api'; import { AuthenticationService, AppConfigService, ContentService, TranslationService, FileUploadEvent, FolderCreatedEvent, LogService, NotificationService, @@ -336,7 +337,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { if (this.contentService.hasPermission(contentEntry, 'update')) { this.dialog.open(VersionManagerDialogAdapterComponent, { - data: { contentEntry, showComments, allowDownload }, + data: { contentEntry: contentEntry, showComments: showComments, allowDownload: allowDownload }, panelClass: 'adf-version-manager-dialog', width: '630px' }); diff --git a/lib/config/bundle-scss-new.js b/lib/config/bundle-scss-new.js deleted file mode 100644 index 9117dfd578..0000000000 --- a/lib/config/bundle-scss-new.js +++ /dev/null @@ -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); -}); - diff --git a/lib/config/bundle-scss.js b/lib/config/bundle-scss.js index 534876f008..9117dfd578 100644 --- a/lib/config/bundle-scss.js +++ b/lib/config/bundle-scss.js @@ -4,22 +4,22 @@ var mkdirpSync = require('fs-extra').mkdirpSync; new Bundler().Bundle('./core/styles/_index.scss', '**/*.scss').then(result => { 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 => { 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 => { 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 => { mkdirpSync('content-services'); - writeFileSync('content-services/_theming.scss', result.bundledContent); + writeFileSync('dist/content-services/_theming.scss', result.bundledContent); }); diff --git a/lib/config/webpack.build.js b/lib/config/webpack.build.js index 935cf69bb9..464853f77a 100644 --- a/lib/config/webpack.build.js +++ b/lib/config/webpack.build.js @@ -24,7 +24,7 @@ module.exports = webpackMerge(commonConfig, { ], output: { - filename: '[name]/bundles/adf-[name].js', + filename: 'dist-webpack/[name]/bundles/adf-[name].js', library: '[name]', libraryTarget: 'umd', chunkFilename: '[id].chunk.js' diff --git a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts index db23cf6a44..ce852b780c 100644 --- a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts +++ b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts @@ -63,7 +63,7 @@ describe('ContentAction', () => { beforeEach(() => { contentService = TestBed.get(ContentService); nodeActionsService = new NodeActionsService(null, null, null); - documentActions = new DocumentActionsService(nodeActionsService, null); + documentActions = new DocumentActionsService(nodeActionsService, null, null); folderActions = new FolderActionsService(nodeActionsService, null, contentService); documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent); diff --git a/lib/content-services/document-list/services/document-actions.service.spec.ts b/lib/content-services/document-list/services/document-actions.service.spec.ts index e0759ab66c..ca4c85eda7 100644 --- a/lib/content-services/document-list/services/document-actions.service.spec.ts +++ b/lib/content-services/document-list/services/document-actions.service.spec.ts @@ -15,7 +15,13 @@ * 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 { ContentActionHandler } from '../models/content-action.model'; import { DocumentActionsService } from './document-actions.service'; @@ -34,8 +40,7 @@ describe('DocumentActionsService', () => { let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null); - - service = new DocumentActionsService(null, null, documentListService, contentService); + service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService); }); it('should register default download action', () => { @@ -47,7 +52,8 @@ describe('DocumentActionsService', () => { }); it('should register custom action handler', () => { - let handler: ContentActionHandler = function (obj: any) {}; + let handler: ContentActionHandler = function (obj: any) { + }; service.setHandler('', handler); expect(service.getHandler('')).toBe(handler); }); @@ -57,7 +63,8 @@ describe('DocumentActionsService', () => { }); it('should be case insensitive for keys', () => { - let handler: ContentActionHandler = function (obj: any) {}; + let handler: ContentActionHandler = function (obj: any) { + }; service.setHandler('', handler); expect(service.getHandler('')).toBe(handler); }); @@ -71,7 +78,7 @@ describe('DocumentActionsService', () => { let file = new FileNode(); expect(service.canExecuteAction(file)).toBeTruthy(); - service = new DocumentActionsService(nodeActionsService, null); + service = new DocumentActionsService(nodeActionsService, null, null); expect(service.canExecuteAction(file)).toBeFalsy(); }); @@ -82,7 +89,8 @@ describe('DocumentActionsService', () => { }); 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('', handler)).toBeFalsy(); expect(service.setHandler('my-handler', handler)).toBeTruthy(); @@ -205,8 +213,8 @@ describe('DocumentActionsService', () => { }); it('should emit success event upon node deletion', (done) => { - service.success.subscribe((nodeId) => { - expect(nodeId).not.toBeNull(); + service.success.subscribe((message) => { + expect(message).toEqual('CORE.DELETE_NODE.SINGULAR'); done(); }); spyOn(documentListService, 'deleteNode').and.returnValue(Observable.of(true)); diff --git a/lib/content-services/document-list/services/document-actions.service.ts b/lib/content-services/document-list/services/document-actions.service.ts index fe83684dc9..e26c3c2dba 100644 --- a/lib/content-services/document-list/services/document-actions.service.ts +++ b/lib/content-services/document-list/services/document-actions.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ContentService } from '@alfresco/adf-core'; +import { ContentService, TranslationService } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { MinimalNodeEntity } from 'alfresco-js-api'; import { Observable } from 'rxjs/Observable'; @@ -38,6 +38,7 @@ export class DocumentActionsService { constructor(private nodeActionsService: NodeActionsService, private contentNodeDialogService: ContentNodeDialogService, + private translation: TranslationService, private documentListService?: DocumentListService, private contentService?: ContentService) { this.setupActionHandlers(); @@ -111,7 +112,7 @@ export class DocumentActionsService { private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void { actionObservable.subscribe( (fileOperationMessage) => { - this.success.next(fileOperationMessage); + this.success.next(fileOperationMessage); }, this.error.next.bind(this.error) ); @@ -124,11 +125,19 @@ export class DocumentActionsService { if (this.contentService.hasPermission(node.entry, permission)) { handlerObservable = this.documentListService.deleteNode(node.entry.id); 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; } 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')); } } diff --git a/lib/content-services/document-list/services/document-list.service.ts b/lib/content-services/document-list/services/document-list.service.ts index be186fd824..96a5348004 100644 --- a/lib/content-services/document-list/services/document-list.service.ts +++ b/lib/content-services/document-list/services/document-list.service.ts @@ -21,7 +21,7 @@ import { } from '@alfresco/adf-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 '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 { + + 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. * @param nodeId ID of the folder node * @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)); } - /** * Get thumbnail URL for the given document node. * @param node Node to get URL for. diff --git a/lib/content-services/tsconfig.json b/lib/content-services/tsconfig.json index 63b3c819da..bd57bbdfdf 100644 --- a/lib/content-services/tsconfig.json +++ b/lib/content-services/tsconfig.json @@ -20,7 +20,6 @@ "baseUrl" : "./", "paths": { "@alfresco/adf-process-services": ["../process-services"], - "@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-core": ["../core"], "@angular/*": ["../node_modules/@angular/*"] }, diff --git a/lib/content-services/upload/components/upload-button.component.spec.ts b/lib/content-services/upload/components/upload-button.component.spec.ts index 1933b804ad..ee917c3133 100644 --- a/lib/content-services/upload/components/upload-button.component.spec.ts +++ b/lib/content-services/upload/components/upload-button.component.spec.ts @@ -33,13 +33,15 @@ describe('UploadButtonComponent', () => { }; let fakeFolderNodeWithPermission = { - allowableOperations: [ - 'create', - 'update' - ], - isFolder: true, - name: 'Folder Fake Name', - nodeType: 'cm:folder' + entry: { + allowableOperations: [ + 'create', + 'update' + ], + isFolder: true, + name: 'Folder Fake Name', + nodeType: 'cm:folder' + } }; let component: UploadButtonComponent; @@ -54,6 +56,7 @@ describe('UploadButtonComponent', () => { ], providers: [ UploadService, + ContentService, { provide: TranslationService, useClass: TranslationMock } ] }).compileComponents(); @@ -98,7 +101,7 @@ describe('UploadButtonComponent', () => { component.rootFolderId = '-root-'; 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) }); uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue'); @@ -113,7 +116,7 @@ describe('UploadButtonComponent', () => { component.rootFolderId = '-my-'; 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) }); uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue'); @@ -128,7 +131,7 @@ describe('UploadButtonComponent', () => { component.rootFolderId = '-my-'; 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) }); fixture.detectChanges(); diff --git a/lib/content-services/upload/components/upload-button.component.ts b/lib/content-services/upload/components/upload-button.component.ts index 828a0581da..f66630df3f 100644 --- a/lib/content-services/upload/components/upload-button.component.ts +++ b/lib/content-services/upload/components/upload-button.component.ts @@ -15,29 +15,11 @@ * limitations under the License. */ -import { - AlfrescoApiService, - EXTENDIBLE_COMPONENT, - FileModel, - FileUtils, - LogService, - NodePermissionSubject, - TranslationService, - UploadService +import { ContentService, EXTENDIBLE_COMPONENT, FileModel, FileUtils, + LogService, NodePermissionSubject, TranslationService, UploadService } from '@alfresco/adf-core'; -import { - Component, - EventEmitter, - forwardRef, - Input, - OnChanges, - OnInit, - Output, - SimpleChanges, - ViewEncapsulation -} from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; -import { Observable } from 'rxjs/Observable'; +import { Component, EventEmitter, forwardRef, Input, + OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { PermissionModel } from '../../document-list/models/permissions.model'; import 'rxjs/add/observable/throw'; @@ -111,7 +93,7 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang private permissionValue: Subject = new Subject(); constructor(private uploadService: UploadService, - private apiService: AlfrescoApiService, + private contentService: ContentService, protected translateService: TranslationService, protected logService: LogService ) { @@ -221,31 +203,18 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang checkPermission() { if (this.rootFolderId) { - this.getFolderNode(this.rootFolderId).subscribe( - res => this.permissionValue.next(this.hasCreatePermission(res)), + let opts: any = { + includeSource: true, + include: ['allowableOperations'] + }; + + this.contentService.getNode(this.rootFolderId, opts).subscribe( + res => this.permissionValue.next(this.hasCreatePermission(res.entry)), error => this.error.emit(error) ); } } - // TODO: move to ContentService - getFolderNode(nodeId: string): Observable { - let opts: any = { - includeSource: true, - include: ['allowableOperations'] - }; - - return Observable.fromPromise(this.apiService.getInstance().nodes.getNodeInfo(nodeId, opts)) - .catch(err => this.handleError(err)); - } - - 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 { if (node && node.allowableOperations) { return node.allowableOperations.find(permission => permission === 'create') ? true : false; diff --git a/lib/core/collapsable/collapsable.module.ts b/lib/core/collapsable/collapsable.module.ts index 175d7a67e4..3e17249a3b 100644 --- a/lib/core/collapsable/collapsable.module.ts +++ b/lib/core/collapsable/collapsable.module.ts @@ -22,6 +22,8 @@ import { MaterialModule } from '../material.module'; import { AccordionGroupComponent } from './accordion-group.component'; import { AccordionComponent } from './accordion.component'; +// @deprecated 2.3.0 use the material accodrdion + @NgModule({ imports: [ MaterialModule, diff --git a/lib/core/mock/traslation.service.mock.ts b/lib/core/mock/traslation.service.mock.ts index 68e36cceb9..0420c22bf6 100644 --- a/lib/core/mock/traslation.service.mock.ts +++ b/lib/core/mock/traslation.service.mock.ts @@ -25,17 +25,31 @@ export interface LangChangeEvent { export class TranslationMock { + defaultLang: string = 'en'; + userLang: string; + customLoader: any; + translate: any; + onLangChange: EventEmitter = new EventEmitter(); addTranslationFolder() { } - get(key: string|Array, interpolateParams?: Object): Observable { + onTranslationChanged() { + + } + + use(): any { + + } + + get(key: string | Array, interpolateParams?: Object): Observable { return Observable.of(key); } instant(key: string | Array, interpolateParams?: Object): string | any { return key; } + } diff --git a/lib/core/services/content.service.ts b/lib/core/services/content.service.ts index 654104979e..450e37aa50 100644 --- a/lib/core/services/content.service.ts +++ b/lib/core/services/content.service.ts @@ -17,7 +17,7 @@ import { Injectable } from '@angular/core'; 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 { Subject } from 'rxjs/Subject'; import { FolderCreatedEvent } from '../events/folder-created.event'; @@ -191,6 +191,16 @@ export class ContentService { .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 { + return Observable.fromPromise(this.apiService.getInstance().nodes.getNode(nodeId, opts)); + } + /** * Check if the user has permissions on that node * @param node Node to check allowableOperations diff --git a/lib/core/services/translation.service.ts b/lib/core/services/translation.service.ts index 8fcb2e6a5d..e5e0246a0c 100644 --- a/lib/core/services/translation.service.ts +++ b/lib/core/services/translation.service.ts @@ -43,7 +43,7 @@ export class TranslationService { customLoader: TranslateLoaderService; constructor(public translate: TranslateService, - private userPreference: UserPreferencesService, + userPreference: UserPreferencesService, @Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) { this.customLoader = this.translate.currentLoader; @@ -56,7 +56,7 @@ export class TranslationService { } } - this.userPreference.locale$.subscribe( (locale) => { + userPreference.locale$.subscribe( (locale) => { this.userLang = locale; this.use(this.userLang); }); @@ -90,7 +90,7 @@ export class TranslationService { } } - private onTranslationChanged(lang: string): void { + onTranslationChanged(lang: string): void { this.translate.onTranslationChange.next({ lang: lang, translations: this.customLoader.getFullTranslationJSON(lang) diff --git a/lib/core/tsconfig.json b/lib/core/tsconfig.json index 106b24d6e9..b9250b5bc2 100644 --- a/lib/core/tsconfig.json +++ b/lib/core/tsconfig.json @@ -22,7 +22,6 @@ "paths": { "@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-content-services": ["../content-services"], - "@alfresco/adf-core": ["../core"], "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ diff --git a/lib/insights/tsconfig.json b/lib/insights/tsconfig.json index 687e7d4ec7..1d3831ff30 100644 --- a/lib/insights/tsconfig.json +++ b/lib/insights/tsconfig.json @@ -22,7 +22,6 @@ "@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-core": ["../core"], - "@alfresco/adf-insights": ["../analytics"], "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ diff --git a/lib/package.json b/lib/package.json index 896ce7e5f8..63a0c1366b 100644 --- a/lib/package.json +++ b/lib/package.json @@ -7,12 +7,10 @@ "clean": "rimraf node_modules", "clean-lock": "rimraf package-lock.json", "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 .", "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-new": "node ./config/bundle-scss-new.js", "test-browser": "node node_modules/karma/bin/karma start karma.conf.js --reporters kjhtml", "coverage": "", "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-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", - "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", "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/", diff --git a/lib/process-services/tsconfig.json b/lib/process-services/tsconfig.json index f3e6ff9be6..4801982081 100644 --- a/lib/process-services/tsconfig.json +++ b/lib/process-services/tsconfig.json @@ -19,7 +19,6 @@ "outDir": "../dist/process-services/", "baseUrl" : "./", "paths": { - "@alfresco/adf-process-services": ["../process-services"], "@alfresco/adf-content-services": ["../content-services"], "@alfresco/adf-insights": ["../analytics"], "@alfresco/adf-core": ["../core"], diff --git a/scripts/npm-publish-webpack.sh b/scripts/npm-publish-webpack.sh deleted file mode 100755 index e8d263c844..0000000000 --- a/scripts/npm-publish-webpack.sh +++ /dev/null @@ -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 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 diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index 60613f7b00..269ab335b7 100755 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -146,7 +146,7 @@ fi if $EXEC_BUILD == true; then echo "====== Build ADF ===== " - npm run new-build + npm run build fi for PACKAGE in ${projects[@]} diff --git a/scripts/test-dist.sh b/scripts/test-dist.sh index c84a9b4e0b..e7eb3f1b2d 100755 --- a/scripts/test-dist.sh +++ b/scripts/test-dist.sh @@ -18,7 +18,7 @@ npm install alfresco-js-api@alpha echo "====== Build ADF ===== " -npm run new-build +npm run build echo "====== COPY new build in demo shell node_modules ===== "