Skip to content

Commit d9bcafa

Browse files
committed
feature(build): Added @angular/compiler-cli support
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.
1 parent afc4374 commit d9bcafa

8 files changed

+31
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
node_modules
2+
src/node_modules
23
npm-debug.log
34
coverage
45
lib
56
build
67
src/*.js
78
src/*.map
89
src/*.d.ts
10+
src/*.ngfactory.ts
911
demo/webpack/bundle.js
1012
demo/webpack/bundle.js.map

.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.travis.yml
12
demo
23
test
34
coverage
@@ -7,4 +8,6 @@ tsd.json
78
karma-test-shim.js
89
karma.conf.js
910
karma.coverage.js
10-
lib/*.spec.*
11+
lib/*.spec.*
12+
src/node_modules
13+
debug.log

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
largely based off of [AngularJS-Toaster](https://github.com/jirikavi/AngularJS-Toaster).
55

66
[![Build Status](https://travis-ci.org/Stabzs/Angular2-Toaster.svg?branch=master)](https://travis-ci.org/Stabzs/Angular2-Toaster)
7-
[![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)
7+
[![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)
88

9-
### Current Version 0.5.1-rc.6
9+
### Current Version 0.5.2-rc.6
1010

1111
## Installation:
1212

@@ -21,6 +21,7 @@ npm install angular2-toaster
2121

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

2526
Clone a copy of the repo:
2627

karma-test-shim.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ Promise.all([
6464
}).then(function () {
6565
return Promise.all(
6666
Object.keys(window.__karma__.files)
67-
.filter(onlySpecFiles)
67+
.filter(isSpecFile)
68+
.filter(isBuiltFile)
6869
.map(file2moduleName)
6970
.map(importModules)
7071
);
@@ -75,8 +76,16 @@ Promise.all([
7576
__karma__.start();
7677
});
7778

78-
function onlySpecFiles(path) {
79-
return /[\.|-]spec\.js$/.test(path);
79+
function isJsFile(path) {
80+
return path.slice(-3) == '.js';
81+
}
82+
83+
function isSpecFile(path) {
84+
return /\.spec\.(.*\.)?js$/.test(path);
85+
}
86+
87+
function isBuiltFile(path) {
88+
return isJsFile(path) && (path.indexOf('/base/lib/') > -1);
8089
}
8190

8291
// Normalize paths to module names.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "angular2-toaster",
3-
"version": "0.5.1-rc.6",
3+
"version": "0.5.2-rc.6",
44
"description": "An Angular 2 Toaster Notification library based on AngularJS-Toaster",
55
"main": "angular2-toaster.ts",
66
"scripts": {
77
"watch": "tsc -p src -w",
88
"start": "npm run test && http-server -c-1 -o -p 8875 .",
9-
"build": "tsc -p src && cpx src/toaster.css lib",
9+
"build": "node_modules/.bin/ngc -p src && cpx src/toaster.css lib",
1010
"pretest": "npm run build",
1111
"test": "karma start karma.conf.js",
1212
"postcoverage": "node_modules/.bin/remap-istanbul -i coverage/ts-json-report/coverage-final.json -o coverage -t html",
@@ -42,6 +42,8 @@
4242
"rxjs": "5.0.0-beta.11"
4343
},
4444
"devDependencies": {
45+
"@angular/compiler-cli": "^0.6.0",
46+
"@angular/platform-server": "^2.0.0-rc.6",
4547
"core-js": "^2.4.1",
4648
"coveralls": "^2.11.9",
4749
"cpx": "^1.3.1",

src/toaster-container.component.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export class TestComponent {
2525
public toasterconfig: ToasterConfig = new ToasterConfig({ showCloseButton: true, tapToDismiss: false, timeout: 0, toastContainerId: 1 });
2626
public toasterconfig2: ToasterConfig = new ToasterConfig({ showCloseButton: true, tapToDismiss: false, timeout: 0, toastContainerId: 2 });
2727
}
28+
@NgModule({
29+
imports: [ToasterModule],
30+
declarations: [TestComponent]
31+
})
2832

2933

3034
// Mock component for testing bodyOutputType Component rendering

src/toaster-container.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,4 @@ export class ToasterContainerComponent {
204204
if(this.addToastSubscriber) { this.addToastSubscriber.unsubscribe(); }
205205
if(this.clearToastsSubscriber) { this.clearToastsSubscriber.unsubscribe(); }
206206
}
207-
}
207+
}

src/toaster.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {NgModule} from '@angular/core';
22
import {CommonModule} from '@angular/common';
3+
import {ToasterConfig} from './toaster-config';
34
import {ToastComponent} from './toast.component';
45
import {ToasterContainerComponent} from './toaster-container.component';
56
import {ToasterService} from './toaster.service';

0 commit comments

Comments
 (0)