Skip to content

Commit

Permalink
feat(build): use ngc compiler to produce metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Telnov authored and jtomaszewski committed Oct 22, 2016
1 parent 45f27f0 commit dace1c4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ ng2-bootstrap.js
ng2-bootstrap.d.ts
ng2-bootstrap.js.map
/logs

factories

/**/*.metadata.json
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ webpack.config.js
/components/**/*.ts
!/components/**/*.d.ts

factories
34 changes: 12 additions & 22 deletions components/carousel/carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,6 @@ import { SlideComponent } from './slide.component';

export enum Direction {UNKNOWN, NEXT, PREV}

const NAVIGATION:any = {
[Ng2BootstrapTheme.BS4]: `
<a class="left carousel-control" (click)="prev()" *ngIf="slides.length">
<span class="icon-prev" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" (click)="next()" *ngIf="slides.length">
<span class="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
`,
[Ng2BootstrapTheme.BS3]: `
<a class="left carousel-control" (click)="prev()" *ngIf="slides.length">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" (click)="next()" *ngIf="slides.length">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
`
};

// todo:
// (ng-swipe-right)="prev()" (ng-swipe-left)="next()"
/**
Expand All @@ -45,7 +24,14 @@ const NAVIGATION:any = {
<li *ngFor="let slidez of slides" [class.active]="slidez.active === true" (click)="select(slidez)"></li>
</ol>
<div class="carousel-inner"><ng-content></ng-content></div>
${NAVIGATION[Ng2BootstrapConfig.theme]}
<a class="left carousel-control" (click)="prev()" *ngIf="slides.length">
<span class="icon-prev" aria-hidden="true"></span>
<span *ngIf="isBS4" class="sr-only">Previous</span>
</a>
<a class="right carousel-control" (click)="next()" *ngIf="slides.length">
<span class="icon-next" aria-hidden="true"></span>
<span *ngIf="isBS4" class="sr-only">Next</span>
</a>
</div>
`
})
Expand All @@ -71,6 +57,10 @@ export class CarouselComponent implements OnDestroy {
private currentSlide:SlideComponent;
private _interval:number;

public get isBS4():boolean {
return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4;
}

public ngOnDestroy():void {
this.destroyed = true;
}
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"typedoc": "typedoc",
"flow.docs": "npm run typedoc -- --exclude '**/*.spec.ts' ./components/",
"flow.compile": "npm run flow.compile:common && npm run flow.compile:system",
"flow.compile:common": "tsc -p tsconfig.publish.json",
"flow.compile:common": "ngc -p tsconfig.publish.json",
"flow.compile:system": "node ./.config/bundle-system.js",
"flow.copy:src": "cpy ng2-bootstrap.ts \"components/*.ts\" ts --parents",
"flow.clean": "del-cli bundles coverage demo-build \"components/**/*.+(js|d.ts|js.map)\" dist \"ng2-bootstrap.+(js|d.ts|js.map)\"",
Expand Down Expand Up @@ -49,7 +49,7 @@
},
"homepage": "https://github.com/valor-software/ng2-bootstrap#readme",
"dependencies": {
"moment": "2.15.0"
"moment": "2.15.1"
},
"peerDependencies": {
"@angular/common": "2.0.0",
Expand All @@ -60,13 +60,14 @@
"devDependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/compiler-cli": "0.6.2",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@types/jasmine": "2.2.33",
"@types/node": "6.0.38",
"@types/jasmine": "2.2.34",
"@types/node": "6.0.39",
"@types/webpack": "1.12.34",
"async": "2.0.1",
"bootstrap": "3.3.7",
Expand All @@ -77,7 +78,7 @@
"cpy-cli": "1.0.1",
"cross-env": "2.0.1",
"del-cli": "0.2.0",
"es6-promise": "3.3.0",
"es6-promise": "3.3.1",
"es6-shim": "0.35.1",
"es7-reflect-metadata": "1.6.0",
"eslint-config-valorsoft": "0.1.0",
Expand All @@ -99,6 +100,6 @@
"tslint-config-valorsoft": "1.1.1",
"typedoc": "0.4.5",
"typescript": "2.0.3",
"zone.js": "0.6.23"
"zone.js": "0.6.25"
}
}
5 changes: 4 additions & 1 deletion tsconfig.publish.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
"files": [
"./demo/custom-typings.d.ts",
"./ng2-bootstrap.ts"
]
],
"angularCompilerOptions": {
"genDir": "factories"
}
}

0 comments on commit dace1c4

Please sign in to comment.