Skip to content

Commit

Permalink
feature(build): Added @angular/compiler-cli support
Browse files Browse the repository at this point in the history
Added @angular/compiler-cli build functionality instead of direct tsc
compilation.  Updated build tasks to run the angular compiler for all
scenarios.
Added metadata.json files based on the ngc compilation. Closes
#57.
Updated README to call out peer dependencies.
  • Loading branch information
Stabzs committed Sep 11, 2016
1 parent afc4374 commit d9bcafa
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
node_modules
src/node_modules
npm-debug.log
coverage
lib
build
src/*.js
src/*.map
src/*.d.ts
src/*.ngfactory.ts
demo/webpack/bundle.js
demo/webpack/bundle.js.map
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.travis.yml
demo
test
coverage
Expand All @@ -7,4 +8,6 @@ tsd.json
karma-test-shim.js
karma.conf.js
karma.coverage.js
lib/*.spec.*
lib/*.spec.*
src/node_modules
debug.log
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
largely based off of [AngularJS-Toaster](https://github.com/jirikavi/AngularJS-Toaster).

[![Build Status](https://travis-ci.org/Stabzs/Angular2-Toaster.svg?branch=master)](https://travis-ci.org/Stabzs/Angular2-Toaster)
[![Coverage Status](https://coveralls.io/repos/github/Stabzs/Angular2-Toaster/badge.svg?branch=master&bump=0.5.1-rc.6)](https://coveralls.io/github/Stabzs/Angular2-Toaster?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/Stabzs/Angular2-Toaster/badge.svg?branch=master&bumped=0.5.2-rc.6)](https://coveralls.io/github/Stabzs/Angular2-Toaster?branch=master)

### Current Version 0.5.1-rc.6
### Current Version 0.5.2-rc.6

## Installation:

Expand All @@ -21,6 +21,7 @@ npm install angular2-toaster

## Building the Source
In order to build Angular2-Toaster, you will need to have Git and Node.js installed.
In addition, the library assumes that you will install all peer dependencies.

Clone a copy of the repo:

Expand Down
15 changes: 12 additions & 3 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Promise.all([
}).then(function () {
return Promise.all(
Object.keys(window.__karma__.files)
.filter(onlySpecFiles)
.filter(isSpecFile)
.filter(isBuiltFile)
.map(file2moduleName)
.map(importModules)
);
Expand All @@ -75,8 +76,16 @@ Promise.all([
__karma__.start();
});

function onlySpecFiles(path) {
return /[\.|-]spec\.js$/.test(path);
function isJsFile(path) {
return path.slice(-3) == '.js';
}

function isSpecFile(path) {
return /\.spec\.(.*\.)?js$/.test(path);
}

function isBuiltFile(path) {
return isJsFile(path) && (path.indexOf('/base/lib/') > -1);
}

// Normalize paths to module names.
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "angular2-toaster",
"version": "0.5.1-rc.6",
"version": "0.5.2-rc.6",
"description": "An Angular 2 Toaster Notification library based on AngularJS-Toaster",
"main": "angular2-toaster.ts",
"scripts": {
"watch": "tsc -p src -w",
"start": "npm run test && http-server -c-1 -o -p 8875 .",
"build": "tsc -p src && cpx src/toaster.css lib",
"build": "node_modules/.bin/ngc -p src && cpx src/toaster.css lib",
"pretest": "npm run build",
"test": "karma start karma.conf.js",
"postcoverage": "node_modules/.bin/remap-istanbul -i coverage/ts-json-report/coverage-final.json -o coverage -t html",
Expand Down Expand Up @@ -42,6 +42,8 @@
"rxjs": "5.0.0-beta.11"
},
"devDependencies": {
"@angular/compiler-cli": "^0.6.0",
"@angular/platform-server": "^2.0.0-rc.6",
"core-js": "^2.4.1",
"coveralls": "^2.11.9",
"cpx": "^1.3.1",
Expand Down
4 changes: 4 additions & 0 deletions src/toaster-container.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export class TestComponent {
public toasterconfig: ToasterConfig = new ToasterConfig({ showCloseButton: true, tapToDismiss: false, timeout: 0, toastContainerId: 1 });
public toasterconfig2: ToasterConfig = new ToasterConfig({ showCloseButton: true, tapToDismiss: false, timeout: 0, toastContainerId: 2 });
}
@NgModule({
imports: [ToasterModule],
declarations: [TestComponent]
})


// Mock component for testing bodyOutputType Component rendering
Expand Down
2 changes: 1 addition & 1 deletion src/toaster-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@ export class ToasterContainerComponent {
if(this.addToastSubscriber) { this.addToastSubscriber.unsubscribe(); }
if(this.clearToastsSubscriber) { this.clearToastsSubscriber.unsubscribe(); }
}
}
}
1 change: 1 addition & 0 deletions src/toaster.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {ToasterConfig} from './toaster-config';
import {ToastComponent} from './toast.component';
import {ToasterContainerComponent} from './toaster-container.component';
import {ToasterService} from './toaster.service';
Expand Down

0 comments on commit d9bcafa

Please sign in to comment.