From 0d7f32a6491e4d9dc924b58881ccbfbbb2ff0302 Mon Sep 17 00:00:00 2001 From: Vito Albano Date: Tue, 27 Sep 2016 18:12:53 +0100 Subject: [PATCH] Fixed structure and naming convention --- .../ng2-alfresco-userinfo/angular-cli.json | 27 --- ng2-components/ng2-alfresco-userinfo/index.ts | 47 ++++- .../ng2-alfresco-userinfo/karma-test-shim.js | 194 ++++++++++-------- .../ng2-alfresco-userinfo/karma.conf.js | 94 ++++++--- .../ng2-alfresco-userinfo/package.json | 79 ++++--- .../user-info.component.css} | 0 .../user-info.component.html} | 0 .../components/user-info.component.spec.ts | 25 +++ .../user-info.component.ts} | 14 +- .../{bpmUser.model.ts => bpm-user.model.ts} | 0 ...mCompany.model.ts => ecm-company.model.ts} | 0 .../{ecmUser.model.ts => ecm-user.model.ts} | 2 +- ...bpmUser.service.ts => bpm-user.service.ts} | 4 +- ...ecmUser.service.ts => ecm-user.service.ts} | 4 +- .../src/userinfo.component.spec.ts | 16 -- .../ng2-alfresco-userinfo/tsconfig.json | 49 +++-- 16 files changed, 323 insertions(+), 232 deletions(-) delete mode 100644 ng2-components/ng2-alfresco-userinfo/angular-cli.json rename ng2-components/ng2-alfresco-userinfo/src/{userinfo.component.css => components/user-info.component.css} (100%) rename ng2-components/ng2-alfresco-userinfo/src/{userinfo.component.html => components/user-info.component.html} (100%) create mode 100644 ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.spec.ts rename ng2-components/ng2-alfresco-userinfo/src/{userinfo.component.ts => components/user-info.component.ts} (86%) rename ng2-components/ng2-alfresco-userinfo/src/models/{bpmUser.model.ts => bpm-user.model.ts} (100%) rename ng2-components/ng2-alfresco-userinfo/src/models/{ecmCompany.model.ts => ecm-company.model.ts} (100%) rename ng2-components/ng2-alfresco-userinfo/src/models/{ecmUser.model.ts => ecm-user.model.ts} (95%) rename ng2-components/ng2-alfresco-userinfo/src/services/{bpmUser.service.ts => bpm-user.service.ts} (96%) rename ng2-components/ng2-alfresco-userinfo/src/services/{ecmUser.service.ts => ecm-user.service.ts} (96%) delete mode 100644 ng2-components/ng2-alfresco-userinfo/src/userinfo.component.spec.ts diff --git a/ng2-components/ng2-alfresco-userinfo/angular-cli.json b/ng2-components/ng2-alfresco-userinfo/angular-cli.json deleted file mode 100644 index ef1d3675f0..0000000000 --- a/ng2-components/ng2-alfresco-userinfo/angular-cli.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "project": { - "version": "ng2-alfresco-userinfo", - "name": "0.1.0" - }, - "apps": [ - { - "main": "src/ng2-alfresco-userinfo.component.ts", - "tsconfig": "tsconfig.json", - "mobile": false - } - ], - "addons": [], - "packages": [], - "test": { - "karma": { - "config": "karma.conf.js" - } - }, - "defaults": { - "prefix": "", - "sourceDir": "src", - "styleExt": "css", - "prefixInterfaces": false, - "lazyRoutePrefix": "+" - } -} diff --git a/ng2-components/ng2-alfresco-userinfo/index.ts b/ng2-components/ng2-alfresco-userinfo/index.ts index 3548a5fae7..a75fe639fd 100644 --- a/ng2-components/ng2-alfresco-userinfo/index.ts +++ b/ng2-components/ng2-alfresco-userinfo/index.ts @@ -1,10 +1,47 @@ -import { ECMUserService } from './src/services/ecmUser.service'; +/*! + * @license + * Copyright 2016 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 { CoreModule } from 'ng2-alfresco-core'; +import { EcmUserService } from './src/services/ecm-user.service'; +import { BpmUserService } from './src/services/bpm-user.service'; -export * from './src/userinfo.component'; -export * from './src/services/ecmUser.service'; - +export * from './src/components/user-info.component'; export const USER_INFO_SERVICE: [any] = [ - ECMUserService + EcmUserService, + BpmUserService ]; + +@NgModule({ + imports: [ + CoreModule + ], + declarations: [ + ...USER_INFO_SERVICE + ], + exports: [ + ...USER_INFO_SERVICE + ] +}) +export class UserInfoModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: UserInfoModule + }; + } +} diff --git a/ng2-components/ng2-alfresco-userinfo/karma-test-shim.js b/ng2-components/ng2-alfresco-userinfo/karma-test-shim.js index 445a2b98d0..fb1c3905f3 100644 --- a/ng2-components/ng2-alfresco-userinfo/karma-test-shim.js +++ b/ng2-components/ng2-alfresco-userinfo/karma-test-shim.js @@ -1,110 +1,128 @@ -'use strict'; // Tun on full stack traces in errors to help debugging Error.stackTraceLimit = Infinity; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; + __karma__.loaded = function() {}; +var builtPath = '/base/dist/'; + +function isJsFile(path) { + return path.slice(-3) == '.js'; +} + +function isSpecFile(path) { + return /\.spec\.(.*\.)?js$/.test(path); +} + +function isBuiltFile(path) { + return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath); +} + +var allSpecFiles = Object.keys(window.__karma__.files) + .filter(isSpecFile) + .filter(isBuiltFile); + +var paths = { + // paths serve as alias + 'npm:': 'base/node_modules/' +}; + var map = { - app: 'base/dist', - rxjs: 'base/node_modules/rxjs', - '@angular': 'base/node_modules/@angular', - 'ng2-translate': '/base/node_modules/ng2-translate', - 'ng2-alfresco-core': '/base/node_modules/ng2-alfresco-core/dist' + 'app': 'base/dist', + // angular bundles + '@angular/core': 'npm:@angular/core/bundles/core.umd.js', + '@angular/common': 'npm:@angular/common/bundles/common.umd.js', + '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', + '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', + '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', + '@angular/http': 'npm:@angular/http/bundles/http.umd.js', + '@angular/router': 'npm:@angular/router/bundles/router.umd.js', + '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', + // testing + '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js', + '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js', + '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js', + '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js', + '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js', + '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js', + '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js', + '@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js', + + // other libraries + 'rxjs': 'npm:rxjs', + 'ng2-translate': 'npm:ng2-translate', + + 'alfresco-js-api': 'npm:alfresco-js-api/dist', + 'ng2-activiti-form': 'npm:ng2-activiti-form/dist', + 'ng2-activiti-processlist': 'npm:ng2-activiti-processlist/dist', + 'ng2-activiti-tasklist': 'npm:ng2-activiti-tasklist/dist', + 'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist', + 'ng2-alfresco-datatable': 'npm:ng2-alfresco-datatable/dist', + 'ng2-alfresco-documentlist': 'npm:ng2-alfresco-documentlist/dist', + 'ng2-alfresco-login': 'npm:ng2-alfresco-login/dist', + 'ng2-alfresco-search': 'npm:ng2-alfresco-search/dist', + 'ng2-alfresco-tag': 'npm:ng2-alfresco-tag/dist', + 'ng2-alfresco-upload': 'npm:ng2-alfresco-upload/dist', + 'ng2-alfresco-viewer': 'npm:ng2-alfresco-viewer/dist', + 'ng2-alfresco-webscript': 'npm:ng2-alfresco-webscript/dist', + 'ng2-alfresco-userinfo': 'npm:ng2-alfresco-userinfo/dist' }; var packages = { - app: { main: 'main.js', defaultExtension: 'js' }, - rxjs: { defaultExtension: 'js' }, - 'ng2-translate': { defaultExtension: 'js' }, - 'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' } -}; + 'app': { main: 'index.js', defaultExtension: 'js', format: 'register' }, + 'rxjs': { defaultExtension: 'js' }, + 'ng2-translate': { defaultExtension: 'js' }, -var packageNames = [ - '@angular/common', - '@angular/compiler', - '@angular/core', - '@angular/http', - '@angular/platform-browser', - '@angular/platform-browser-dynamic', - '@angular/router', - '@angular/router-deprecated', - '@angular/testing', - '@angular/upgrade' -]; - -packageNames.forEach(function(pkgName) { - packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }; -}); - -packages['base/dist'] = { - defaultExtension: 'js', - format: 'register', - map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {}) + 'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'}, + 'ng2-activiti-form': { main: './index.js', defaultExtension: 'js'}, + 'ng2-activiti-processlist': { main: './index.js', defaultExtension: 'js'}, + 'ng2-activiti-tasklist': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-datatable': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-documentlist': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-login': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-search': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-tag': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-upload': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-viewer': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-webscript': { main: './index.js', defaultExtension: 'js'}, + 'ng2-alfresco-userinfo': { main: './index.js', defaultExtension: 'js'} }; var config = { - map: map, - packages: packages + paths: paths, + map: map, + packages: packages }; System.config(config); -System.import('@angular/platform-browser/src/browser/browser_adapter') - .then(function(browserAdapter) { - browserAdapter.BrowserDomAdapter.makeCurrent(); - }) - .then(function() { +System.import('app') + .then(initTestBed) + .then(initTesting); + +function initTestBed(){ return Promise.all([ - System.import('@angular/core/testing'), - System.import('@angular/platform-browser-dynamic/testing') - ]); - }) - .then(function(providers) { - var testing = providers[0]; - var testingBrowser = providers[1]; + System.import('@angular/core/testing'), + System.import('@angular/platform-browser-dynamic/testing') + ]) + .then(function (providers) { + var coreTesting = providers[0]; + var browserTesting = providers[1]; - testing.setBaseTestProviders( - testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, - testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS); - }) - .then(function() { - return Promise.all(resolveTestFiles()); - }) - .then( - function() { - __karma__.start(); - }, - function(error) { - if (typeof __karma__.error === 'function') { - __karma__.error(error.stack || error); - } else { - console.error(error); - } - } - ); - -function createPathRecords(pathsMapping, appPath) { - var pathParts = appPath.split('/'); - var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/'); - moduleName = moduleName.replace(/\.js$/, ''); - pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]; - return pathsMapping; + coreTesting.TestBed.initTestEnvironment( + browserTesting.BrowserDynamicTestingModule, + browserTesting.platformBrowserDynamicTesting()); + }) } -function onlyAppFiles(filePath) { - return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath); -} - -function onlySpecFiles(path) { - return /\.spec\.js$/.test(path); -} - -function resolveTestFiles() { - return Object.keys(window.__karma__.files) // All files served by Karma. - .filter(onlySpecFiles) - .map(function(moduleName) { - // loads all spec files via their global module names (e.g. - // 'base/dist/vg-player/vg-player.spec') - return System.import(moduleName); - }); +// Import all spec files and start karma +function initTesting () { + return Promise.all( + allSpecFiles.map(function (moduleName) { + return System.import(moduleName); + }) + ) + .then(__karma__.start, __karma__.error); } diff --git a/ng2-components/ng2-alfresco-userinfo/karma.conf.js b/ng2-components/ng2-alfresco-userinfo/karma.conf.js index c822c9fcd6..c0374b25c3 100644 --- a/ng2-components/ng2-alfresco-userinfo/karma.conf.js +++ b/ng2-components/ng2-alfresco-userinfo/karma.conf.js @@ -1,48 +1,78 @@ 'use strict'; -module.exports = function(config) { - config.set({ - +module.exports = function (config) { + var configuration = { basePath: '.', - frameworks: ['jasmine'], + frameworks: ['jasmine-ajax', 'jasmine'], files: [ - // paths loaded by Karma - {pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: false}, - {pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false}, - {pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: false}, - {pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false}, - {pattern: 'node_modules/rxjs/**/*.map', included: false, watched: false}, - {pattern: 'node_modules/@angular/**/*.js', included: false, watched: false}, - {pattern: 'node_modules/@angular/**/*.map', included: false, watched: false}, - {pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false}, - {pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false}, - {pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false}, + // System.js for module loading + 'node_modules/systemjs/dist/system.src.js', - {pattern: 'karma-test-shim.js', included: true, watched: true}, + // Polyfills + 'node_modules/core-js/client/shim.js', + 'node_modules/reflect-metadata/Reflect.js', + + // zone.js + 'node_modules/zone.js/dist/zone.js', + 'node_modules/zone.js/dist/long-stack-trace-zone.js', + 'node_modules/zone.js/dist/proxy.js', + 'node_modules/zone.js/dist/sync-test.js', + 'node_modules/zone.js/dist/jasmine-patch.js', + 'node_modules/zone.js/dist/async-test.js', + 'node_modules/zone.js/dist/fake-async-test.js', + + // RxJs + { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false }, + { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false }, + + // Paths loaded via module imports: + // Angular itself + {pattern: 'node_modules/@angular/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false}, + + 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', + {pattern: 'node_modules/ng2-translate/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/ng2-translate/**/*.js.map', included: false, watched: false}, + + 'karma-test-shim.js', // paths loaded via module imports {pattern: 'dist/**/*.js', included: false, watched: true}, {pattern: 'dist/**/*.html', included: true, served: true, watched: true}, {pattern: 'dist/**/*.css', included: true, served: true, watched: true}, + // ng2-components + { pattern: 'node_modules/ng2-activiti-form/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-activiti-processlist/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-activiti-tasklist/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-documentlist/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-login/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-search/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-tag/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-upload/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-viewer/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-webscript/dist/**/*.js', included: false, served: true, watched: false }, + { pattern: 'node_modules/ng2-alfresco-userinfo/dist/**/*.js', included: false, served: true, watched: false }, + // paths to support debugging with source maps in dev tools {pattern: 'src/**/*.ts', included: false, watched: false}, {pattern: 'dist/**/*.js.map', included: false, watched: false} ], + exclude: [ + 'node_modules/**/*spec.js' + ], + // proxied base paths proxies: { // required for component assets fetched by Angular's compiler '/src/': '/base/src/' }, - // list of files to exclude - exclude: [ - 'node_modules/**/*spec.js' - ], - port: 9876, // level of logging @@ -55,10 +85,18 @@ module.exports = function(config) { browsers: ['Chrome'], + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + // Karma plugins loaded plugins: [ 'karma-jasmine', 'karma-coverage', + 'karma-jasmine-ajax', 'karma-chrome-launcher', 'karma-mocha-reporter', 'karma-jasmine-html-reporter' @@ -70,7 +108,7 @@ module.exports = function(config) { // Source files that you wanna generate coverage for. // Do not include tests or libraries (these files will be instrumented by Istanbul) preprocessors: { - 'dist/**/!(*spec).js': ['coverage'] + // 'dist/**/!(*spec).js': ['coverage'] }, coverageReporter: { @@ -78,10 +116,16 @@ module.exports = function(config) { subdir: 'report', reporters: [ {type: 'text'}, - {type: 'text-summary'}, {type: 'json', file: 'coverage-final.json'}, - {type: 'html'} + {type: 'html'}, + {type: 'lcov'} ] } - }); + }; + + if (process.env.TRAVIS) { + configuration.browsers = ['Chrome_travis_ci']; + } + + config.set(configuration) }; diff --git a/ng2-components/ng2-alfresco-userinfo/package.json b/ng2-components/ng2-alfresco-userinfo/package.json index 538102137b..19e3865dde 100644 --- a/ng2-components/ng2-alfresco-userinfo/package.json +++ b/ng2-components/ng2-alfresco-userinfo/package.json @@ -5,11 +5,10 @@ "author": "vito albano ", "scripts": { "clean": "rimraf dist node_modules", - "license-check": "echo 'license check is disabled'", - "build": "npm run tslint && rimraf dist && tsc && npm run copy-dist && npm run license-check", + "build": "npm run tslint && rimraf dist && tsc && npm run copy-dist", "build:w": "npm run tslint && rimraf dist && npm run watch-task", - "watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"npm run license-check\"", - "tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts", + "watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"license-check\"", + "tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json 'src/{,**/}**.ts'", "copy-dist": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src", "copy-dist:w": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src -w", "tsc": "tsc", @@ -19,43 +18,53 @@ "test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"", "posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json", "coverage": "npm run test && wsrv -o -p 9875 ./coverage/report", - "travis": "echo 'placeholder'" + "travis": "npm link ng2-alfresco-core" }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", "repository": { "type": "git", - "url": "https://github.com/alfresco/ng2-alfresco-userinfo.git" + "url": "https://github.com/Alfresco/alfresco-ng2-components.git" }, "bugs": { - "url": "https://github.com/alfresco/ng2-alfresco-userinfo/issues" + "url": "https://github.com/Alfresco/alfresco-ng2-components/issues" }, - + "license": "Apache-2.0", + "contributors": [ + { + "name": "Vito Albano", + "email": "vito.albano@alfresco.com" + } + ], + "keywords": [ + "ng2", + "angular", + "angular2", + "alfresco" + ], "dependencies": { - "alfresco-js-api": "^0.3.0", - "@angular/common": "2.0.0-rc.3", - "@angular/compiler": "2.0.0-rc.3", - "@angular/core": "2.0.0-rc.3", - "@angular/forms": "0.1.1", - "@angular/http": "2.0.0-rc.3", - "@angular/platform-browser": "2.0.0-rc.3", - "@angular/platform-browser-dynamic": "2.0.0-rc.3", - "@angular/router": "3.0.0-alpha.7", - "@angular/router-deprecated": "2.0.0-rc.2", - "@angular/upgrade": "2.0.0-rc.3", + "@angular/common": "2.0.0", + "@angular/compiler": "2.0.0", + "@angular/core": "2.0.0", + "@angular/forms": "2.0.0", + "@angular/http": "2.0.0", + "@angular/platform-browser": "2.0.0", + "@angular/platform-browser-dynamic": "2.0.0", + "@angular/router": "3.0.0", + "@angular/upgrade": "2.0.0", + "core-js": "^2.4.1", + "reflect-metadata": "^0.1.3", + "rxjs": "5.0.0-beta.12", "systemjs": "0.19.27", - "core-js": "2.4.0", - "reflect-metadata": "0.1.3", - "rxjs": "5.0.0-beta.6", - "zone.js": "0.6.12", - "ng2-translate": "2.2.2", - "ng2-alfresco-core": "0.3.2", - "material-design-icons": "2.2.3", - "material-design-lite": "1.1.3" + "zone.js": "^0.6.23", + + "ng2-translate": "2.5.0", + "ng2-alfresco-core": "0.3.2" }, "devDependencies": { "@types/core-js": "^0.9.32", "@types/jasmine": "^2.2.33", + "concurrently": "^2.2.0", "cpx": "1.3.1", "jasmine-ajax": "3.2.0", "jasmine-core": "2.4.1", @@ -74,11 +83,13 @@ "typescript": "^2.0.2", "wsrv": "^0.1.5" }, - "keywords": [ - "component", - "userinfo", - "alfresco", - "alfresco-component" - ], - "license": "Apache-2.0" + "license-check-config": { + "src": [ + "./dist/**/*.js" + ], + "path": "assets/license_header.txt", + "blocking": true, + "logInfo": false, + "logError": true + } } diff --git a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.css b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css similarity index 100% rename from ng2-components/ng2-alfresco-userinfo/src/userinfo.component.css rename to ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css diff --git a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.html b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html similarity index 100% rename from ng2-components/ng2-alfresco-userinfo/src/userinfo.component.html rename to ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html diff --git a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.spec.ts b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.spec.ts new file mode 100644 index 0000000000..a91e2f2ac8 --- /dev/null +++ b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.spec.ts @@ -0,0 +1,25 @@ +/*! + * @license + * Copyright 2016 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 { UserInfoComponent } from '../src/userinfo.component'; + +describe('Basic Example test ng2-alfresco-userinfo', () => { + + it('Test hello world', () => { + expect(true).toBe(true); + }); + +}); diff --git a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.ts b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts similarity index 86% rename from ng2-components/ng2-alfresco-userinfo/src/userinfo.component.ts rename to ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts index f991d8825f..d54b9669e3 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts @@ -16,10 +16,10 @@ */ import { Component, OnInit } from '@angular/core'; -import { ECMUserService } from './services/ecmUser.service'; -import { BPMUserService } from './services/bpmUser.service'; -import { EcmUserModel } from './models/ecmUser.model'; -import { BpmUserModel } from './models/bpmUser.model'; +import { EcmUserService } from './../services/ecm-user.service'; +import { BpmUserService } from './../services/bpm-user.service'; +import { EcmUserModel } from './../models/ecm-user.model'; +import { BpmUserModel } from './../models/bpm-user.model'; import { AlfrescoAuthenticationService } from 'ng2-alfresco-core'; declare let __moduleName: string; @@ -29,7 +29,7 @@ declare let __moduleName: string; moduleId: __moduleName, styleUrls: ['./userinfo.component.css'], templateUrl: './userinfo.component.html', - providers: [ECMUserService, BPMUserService, AlfrescoAuthenticationService] + providers: [EcmUserService, BpmUserService, AlfrescoAuthenticationService] }) export class UserInfoComponent implements OnInit { @@ -42,8 +42,8 @@ export class UserInfoComponent implements OnInit { public ecmUserImage: any; - constructor(private ecmUserService: ECMUserService, - private bpmUserService: BPMUserService, + constructor(private ecmUserService: EcmUserService, + private bpmUserService: BpmUserService, public authService: AlfrescoAuthenticationService) { } diff --git a/ng2-components/ng2-alfresco-userinfo/src/models/bpmUser.model.ts b/ng2-components/ng2-alfresco-userinfo/src/models/bpm-user.model.ts similarity index 100% rename from ng2-components/ng2-alfresco-userinfo/src/models/bpmUser.model.ts rename to ng2-components/ng2-alfresco-userinfo/src/models/bpm-user.model.ts diff --git a/ng2-components/ng2-alfresco-userinfo/src/models/ecmCompany.model.ts b/ng2-components/ng2-alfresco-userinfo/src/models/ecm-company.model.ts similarity index 100% rename from ng2-components/ng2-alfresco-userinfo/src/models/ecmCompany.model.ts rename to ng2-components/ng2-alfresco-userinfo/src/models/ecm-company.model.ts diff --git a/ng2-components/ng2-alfresco-userinfo/src/models/ecmUser.model.ts b/ng2-components/ng2-alfresco-userinfo/src/models/ecm-user.model.ts similarity index 95% rename from ng2-components/ng2-alfresco-userinfo/src/models/ecmUser.model.ts rename to ng2-components/ng2-alfresco-userinfo/src/models/ecm-user.model.ts index 436604989c..08f24fbcdb 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/models/ecmUser.model.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/models/ecm-user.model.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { EcmCompanyModel } from './ecmCompany.model'; +import { EcmCompanyModel } from './ecm-company.model'; export class EcmUserModel { id: string; diff --git a/ng2-components/ng2-alfresco-userinfo/src/services/bpmUser.service.ts b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts similarity index 96% rename from ng2-components/ng2-alfresco-userinfo/src/services/bpmUser.service.ts rename to ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts index 6e8204a234..089320a264 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/services/bpmUser.service.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts @@ -19,7 +19,7 @@ import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfr import { Injectable } from '@angular/core'; import { Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; -import { BpmUserModel } from '../models/bpmUser.model'; +import { BpmUserModel } from '../models/bpm-user.model'; /** * * BPMUserService retrieve all the information of an Ecm user. @@ -27,7 +27,7 @@ import { BpmUserModel } from '../models/bpmUser.model'; * @returns {BPMUserService} . */ @Injectable() -export class BPMUserService { +export class BpmUserService { constructor(private authService: AlfrescoAuthenticationService, private settingService: AlfrescoSettingsService) { diff --git a/ng2-components/ng2-alfresco-userinfo/src/services/ecmUser.service.ts b/ng2-components/ng2-alfresco-userinfo/src/services/ecm-user.service.ts similarity index 96% rename from ng2-components/ng2-alfresco-userinfo/src/services/ecmUser.service.ts rename to ng2-components/ng2-alfresco-userinfo/src/services/ecm-user.service.ts index 56b0e62c0b..6875ee7d48 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/services/ecmUser.service.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/services/ecm-user.service.ts @@ -19,7 +19,7 @@ import { AlfrescoAuthenticationService, AlfrescoContentService } from 'ng2-alfre import { Injectable } from '@angular/core'; import { Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; -import { EcmUserModel } from '../models/ecmUser.model'; +import { EcmUserModel } from '../models/ecm-user.model'; /** * * ECMUserService retrieve all the information of an Ecm user. @@ -27,7 +27,7 @@ import { EcmUserModel } from '../models/ecmUser.model'; * @returns {ECMUserService} . */ @Injectable() -export class ECMUserService { +export class EcmUserService { constructor(private authService: AlfrescoAuthenticationService, private contentService: AlfrescoContentService) {} diff --git a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.spec.ts b/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.spec.ts deleted file mode 100644 index e7917d1f0b..0000000000 --- a/ng2-components/ng2-alfresco-userinfo/src/userinfo.component.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ - -import {describe, expect, it, inject} from '@angular/core/testing'; -import { TestComponentBuilder } from '@angular/compiler/testing'; -import { UserInfoComponent } from '../src/userinfo.component'; - -describe('Basic Example test ng2-alfresco-userinfo', () => { - it('Test hello world', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { - return tcb - .createAsync(UserInfoComponent) - .then((fixture) => { - let element = fixture.nativeElement; - expect(element.querySelector('h1')).toBeDefined(); - expect(element.getElementsByTagName('h1')[0].innerHTML).toEqual('Hello World Angular 2 ng2-alfresco-userinfo'); - }); - })); -}); diff --git a/ng2-components/ng2-alfresco-userinfo/tsconfig.json b/ng2-components/ng2-alfresco-userinfo/tsconfig.json index e4d2ae201a..b1effea355 100644 --- a/ng2-components/ng2-alfresco-userinfo/tsconfig.json +++ b/ng2-components/ng2-alfresco-userinfo/tsconfig.json @@ -1,27 +1,26 @@ { - "compilerOptions": { - "target": "es5", - "module": "system", - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "sourceMap": true, - "removeComments": true, - "declaration": true, - "noLib": false, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "outDir": "dist" - }, - "exclude": [ - "demo", - "node_modules", - "typings/main", - "typings/main.d.ts", - "dist" - ] + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "sourceMap": true, + "removeComments": true, + "declaration": true, + "noLib": false, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitUseStrict": false, + "noFallthroughCasesInSwitch": true, + "outDir": "dist", + "types": ["core-js", "jasmine"] + }, + "exclude": [ + "demo", + "node_modules", + "dist" + ] }