#33 components build

This commit is contained in:
Mario Romano
2016-04-21 11:39:06 +01:00
parent c35819515a
commit 5914688467
31 changed files with 164 additions and 135 deletions

View File

@@ -5,8 +5,8 @@ import {Authentication} from './services/authentication';
import {AuthRouterOutlet} from './components/AuthRouterOutlet'; import {AuthRouterOutlet} from './components/AuthRouterOutlet';
import {HomeView} from './components/home.view'; import {HomeView} from './components/home.view';
import {Page1View} from './components/page1.view'; import {Page1View} from './components/page1.view';
import {AlfrescoService} from 'ng2-alfresco-documentslist/dist/alfresco.service';
import {Page2View} from './components/page2.view'; import {Page2View} from './components/page2.view';
import {AlfrescoService} from 'ng2-alfresco/components';
@Component({ @Component({
selector: 'my-app', selector: 'my-app',

View File

@@ -1,5 +1,5 @@
import {Component} from 'angular2/core'; import {Component} from 'angular2/core';
import {DocumentList} from 'ng2-alfresco/components'; import {DocumentList} from '../../../ng2-alfresco-documentslist/src/components';
@Component({ @Component({
selector: 'home-view', selector: 'home-view',

View File

@@ -1,5 +1,5 @@
import {Component} from 'angular2/core'; import {Component} from 'angular2/core';
import {HelloWorld} from 'ng2-alfresco/components'; import {HelloWorld} from '../../../ng2-alfresco-documentslist/src/components';
@Component({ @Component({
selector: 'page2-view', selector: 'page2-view',

View File

@@ -3,7 +3,7 @@ import {AppComponent} from './app.component';
import {ROUTER_PROVIDERS} from 'angular2/router'; import {ROUTER_PROVIDERS} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http'; import {HTTP_PROVIDERS} from 'angular2/http';
import {Authentication} from './services/authentication'; import {Authentication} from './services/authentication';
import {ALFRESCO_PROVIDERS} from 'ng2-alfresco/components'; import {ALFRESCO_PROVIDERS} from '../../ng2-alfresco-documentslist/src/components';
bootstrap(AppComponent, [ bootstrap(AppComponent, [
ROUTER_PROVIDERS, ROUTER_PROVIDERS,

View File

@@ -21,7 +21,7 @@
"es6-shim": "^0.35.0", "es6-shim": "^0.35.0",
"font-awesome": "^4.5.0", "font-awesome": "^4.5.0",
"jquery": "^2.2.2", "jquery": "^2.2.2",
"ng2-alfresco": "file:../ng2-alfresco", "ng2-alfresco-documentslist": "file:../ng2-components/ng2-alfresco-documentslist",
"ng2-uploader": "denisvuyka/ng2-uploader", "ng2-uploader": "denisvuyka/ng2-uploader",
"reflect-metadata": "0.1.2", "reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2", "rxjs": "5.0.0-beta.2",

View File

@@ -1,2 +0,0 @@
/node_modules
/typings

View File

@@ -1,14 +0,0 @@
/// <reference path="node_modules/angular2/typings/browser.d.ts" />
import { HelloWorld } from './src/HelloWorld';
import { DocumentList } from "./src/document-list.component";
import { AlfrescoService } from "./src/alfresco.service";
export * from './src/HelloWorld';
export * from './src/document-list.component';
export * from './src/alfresco.service';
declare var _default: {
directives: (typeof HelloWorld | typeof DocumentList)[];
providers: typeof AlfrescoService[];
};
export default _default;
export declare const ALFRESCO_DIRECTIVES: [any];
export declare const ALFRESCO_PROVIDERS: [any];

View File

@@ -1,17 +0,0 @@
///<reference path='./node_modules/angular2/typings/browser.d.ts'/>
import { HelloWorld } from './src/HelloWorld';
import { DocumentList } from "./src/document-list.component";
import { AlfrescoService } from "./src/alfresco.service";
export * from './src/HelloWorld';
export * from './src/document-list.component';
export * from './src/alfresco.service';
export default {
directives: [HelloWorld, DocumentList],
providers: [AlfrescoService]
}
export const ALFRESCO_DIRECTIVES: [any] = [HelloWorld, DocumentList];
export const ALFRESCO_PROVIDERS: [any] = [AlfrescoService];

View File

@@ -1,38 +0,0 @@
var pkg = require('./package.json');
var path = require('path');
var Builder = require('systemjs-builder');
var name = pkg.name;
var builder = new Builder();
var config = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: './node_modules/typescript/lib/typescript.js',
angular2: path.resolve('node_modules/angular2'),
rxjs: path.resolve('node_modules/rxjs')
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/angular2/*': { build: false },
'node_modules/rxjs/*': { build: false }
}
};
builder.config(config);
builder
//.bundle(name, path.resolve(__dirname, 'bundles/', name + '.js'))
.bundle('components', path.resolve(__dirname, 'bundles/', name + '.js'))
.then(function() {
console.log('Build complete.');
})
.catch(function(err) {
console.log('Error', err);
});

View File

@@ -1,30 +0,0 @@
{
"name": "ng2-alfresco",
"version": "0.1.0",
"description": "Alfresco Angular 2 Components",
"license": "MIT",
"main": "./components.ts",
"contributors": [
{
"name": "Denys Vuika",
"email": "denis.vuyka@gmail.com"
}
],
"scripts": {
"__prepublish": "tsc && node make.js",
"preinstall": "npm install --ignore-scripts",
"postinstall": "tsc && node make.js"
},
"dependencies": {
"angular2": "2.0.0-beta.15",
"systemjs": "0.19.26",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.10"
},
"devDependencies": {
"typescript": "^1.8.10",
"systemjs-builder": "^0.15.14"
}
}

View File

@@ -1,19 +0,0 @@
{
"compilerOptions": {
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
},
"exclude": [
"node_modules"
]
}

View File

@@ -4,6 +4,5 @@ jspm_packages
.idea .idea
lib lib
build build
*.js
*.js.map
!make.js !make.js
node_modules/

View File

@@ -0,0 +1,2 @@
/typings
/src

View File

@@ -0,0 +1,57 @@
const gulp = require('gulp');
const del = require('del');
const typescript = require('gulp-typescript');
const tscConfig = require('./tsconfig.json');
const sourcemaps = require('gulp-sourcemaps');
const tslint = require('gulp-tslint');
const tsconfig = require('tsconfig-glob');
// clean the contents of the distribution directory
gulp.task('clean', function () {
return del('dist/**/*');
});
// copy static assets - i.e. non TypeScript compiled source
gulp.task('copy:assets', ['clean'], function () {
return gulp.src(['src/**/*.ts','!node_modules/**/*.*'])
.pipe(gulp.dest('dist'))
});
// copy dependencies
gulp.task('copy:libs', ['clean'], function () {
return gulp.src([
'node_modules/**/*',
'!node_modules/**/*.d.ts'
])
.pipe(gulp.dest('dist/node_modules'))
});
// linting
gulp.task('tslint', function () {
return gulp.src('app/**/*.ts')
.pipe(tslint())
.pipe(tslint.report('verbose'));
});
// TypeScript compile
gulp.task('compile', ['clean'], function () {
return gulp
.src(tscConfig.files)
.pipe(sourcemaps.init())
.pipe(typescript(tscConfig.compilerOptions))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
// update the tsconfig files based on the glob pattern
gulp.task('tsconfig-glob', function () {
return tsconfig({
configPath: '.',
indent: 2
});
});
gulp.task('build', ['tslint', 'copy:assets', 'copy:libs', 'compile']);
gulp.task('default', ['build']);

View File

@@ -0,0 +1,39 @@
{
"name": "ng2-alfresco-documentslist",
"version": "0.1.0",
"description": "Alfresco Document list - Angular 2 Component",
"license": "GNU",
"main": "dist/components.ts",
"contributors": [
{
"name": "Denys Vuika",
"email": "denis.vuyka@gmail.com"
},
{
"name": "Mario Romano",
"email": "mario.romano83@gmail.com"
}
],
"dependencies": {
"angular2": "2.0.0-beta.15",
"browser-sync": "^2.10.0",
"concurrently": "^2.0.0",
"del": "^2.1.0",
"es6-shim": "^0.35.0",
"gulp": "^3.9.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^3.6.0",
"gulp-typescript": "^2.8.0",
"jasmine-core": "2.4.1",
"lite-server": "^2.2.0",
"live-server": "^0.9.2",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.26",
"systemjs-builder": "^0.15.14",
"tsconfig-glob": "^0.3.3",
"typescript": "^1.8.10",
"typings": "^0.7.12",
"zone.js": "0.6.10"
}
}

View File

@@ -18,7 +18,7 @@ export class AlfrescoService {
public set host(value:string) { public set host(value:string) {
this._host = value; this._host = value;
} }
private getBaseUrl():string { private getBaseUrl():string {
return this.host + this._baseUrlPath; return this.host + this._baseUrlPath;
} }

View File

@@ -0,0 +1,13 @@
import { HelloWorld } from './HelloWorld';
import { DocumentList } from "./document-list.component.ts";
import { AlfrescoService } from "./alfresco.service.ts";
export * from './HelloWorld';
export * from './document-list.component.ts';
export * from './alfresco.service.ts';
declare var _default: {
directives: (typeof HelloWorld | typeof DocumentList)[];
providers: typeof AlfrescoService[];
};
export default _default;
export declare const ALFRESCO_DIRECTIVES: [any];
export declare const ALFRESCO_PROVIDERS: [any];

View File

@@ -0,0 +1,15 @@
import { HelloWorld } from './HelloWorld';
import { DocumentList } from "./document-list.component.ts";
import { AlfrescoService } from "./alfresco.service.ts";
export * from './HelloWorld';
export * from './document-list.component.ts';
export * from './alfresco.service.ts';
export default {
directives: [HelloWorld, DocumentList],
providers: [AlfrescoService]
}
export const ALFRESCO_DIRECTIVES: [any] = [HelloWorld, DocumentList];
export const ALFRESCO_PROVIDERS: [any] = [AlfrescoService];

View File

@@ -10,28 +10,28 @@ import {DocumentEntity} from "./core/entities/document.entity";
:host .breadcrumb { :host .breadcrumb {
margin-bottom: 4px; margin-bottom: 4px;
} }
:host .folder-icon { :host .folder-icon {
float: left; float: left;
margin-right: 10px; margin-right: 10px;
} }
:host .file-icon { :host .file-icon {
width: 52px; width: 52px;
height: 52px; height: 52px;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
} }
:host .document-header:hover { :host .document-header:hover {
text-decoration: underline; text-decoration: underline;
} }
:host .download-button { :host .download-button {
color: #777; color: #777;
text-decoration: none; text-decoration: none;
} }
:host .download-button:hover { :host .download-button:hover {
color: #555; color: #555;
} }
@@ -175,11 +175,11 @@ export class DocumentList implements OnInit {
var relativePath = container + path + item.fileName; var relativePath = container + path + item.fileName;
return item.location.site + '/' + relativePath; return item.location.site + '/' + relativePath;
} }
getContentUrl(document: DocumentEntity) { getContentUrl(document: DocumentEntity) {
return this._alfrescoService.getContentUrl(document); return this._alfrescoService.getContentUrl(document);
} }
getDocumentThumbnailUrl(document: DocumentEntity) { getDocumentThumbnailUrl(document: DocumentEntity) {
return this._alfrescoService.getDocumentThumbnailUrl(document); return this._alfrescoService.getDocumentThumbnailUrl(document);
} }

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"target": "es5",
"outDir": "dist/app"
},
"filesGlob": [
"node_modules/angular2/typings/browser.d.ts"
],
"files": [
"node_modules/angular2/typings/browser.d.ts",
"*.ts",
"src/**/*.ts"
]
}