Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dependencies): upgrade dependencies
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
The peer dependencies have been upgraded to be:
* "rxjs": "^5.4.2",
* "@angular/core": "^4.3.0",
* "@ngrx/store": "^2.2.3"

close ngrx#2, close ngrx#3
julienevano committed Jul 26, 2017
1 parent dd18a17 commit fefa907
Showing 15 changed files with 4,576 additions and 142 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<a name="2.0.0"></a>
# [2.0.0](https://github.com/ngrx/notify/compare/v1.0.0...v2.0.0) (2017-07-22)


### Chores

* **dependencies:** upgrade dependencies ([8592504](https://github.com/ngrx/notify/commit/8592504)), closes [#2](https://github.com/ngrx/notify/issues/2) [#3](https://github.com/ngrx/notify/issues/3)


### BREAKING CHANGES

* **dependencies:** The peer dependencies have been upgraded to be:
* "rxjs": "^5.4.2",
* "@angular/core": "^4.3.0",
* "@ngrx/store": "^2.2.3"



<a name="1.0.0"></a>
# 1.0.0 (2016-06-07)



61 changes: 40 additions & 21 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var path = require('path');
var webpack = require('webpack');

module.exports = function(karma) {
'use strict';
@@ -18,16 +19,17 @@ module.exports = function(karma) {
'tests.js': ['coverage', 'webpack', 'sourcemap']
},

reporters: ['mocha', 'coverage'],
reporters: ['mocha', 'coverage-istanbul'],

coverageReporter: {
dir: 'coverage/',
subdir: '.',
reporters: [
{ type: 'text-summary' },
{ type: 'json' },
{ type: 'html' }
]
coverageIstanbulReporter: {
dir: path.join(__dirname, 'coverage'),
reports: [
'html',
'lcovonly',
'json',
'clover'
],
fixWebpackSourcePaths: true
},

browsers: ['Chrome'],
@@ -41,32 +43,49 @@ module.exports = function(karma) {

webpack: {
devtool: 'inline-source-map',
entry: undefined,
resolve: {
root: __dirname,
extensions: ['', '.ts', '.js']
extensions: ['.ts', '.js'],
modules: [
path.join(__dirname),
'node_modules'
]
},
module: {
loaders: [
rules: [
{
test: /\.ts?$/,
exclude: /(node_modules)/,
loader: 'ts-loader?target=es5&module=commonjs'
}
],
postLoaders: [
use: [
{
loader: 'ts-loader?target=es5&module=commonjs'
}
]
},
{
test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader',
test: /\.(js|ts)$/,
enforce: 'post',
include: path.resolve(__dirname, 'lib'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
],
use: [
{
loader: 'istanbul-instrumenter-loader'
}
]
}
]
},
ts: {
configFileName: './spec/tsconfig.json'
}
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
ts: {
configFileName: './spec/tsconfig.json'
}
}
})
]
},

webpackServer: {
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { Notify } from './notify';
export { NOTIFY_PROVIDERS, NOTIFY_GLOBAL_OPTIONS } from './ng2';
export { NotifyModule, NOTIFY_GLOBAL_OPTIONS } from './ng2';
export { NotificationInstance, NotificationOptions } from './notification';
89 changes: 50 additions & 39 deletions lib/ng2.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,56 @@
import { OpaqueToken } from '@angular/core';
import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core';

import { Notify } from './notify';
import { NotificationStatic, NotificationOptions } from './notification';
import { NotificationPermission } from './notification-permission';

declare var Notification: NotificationStatic;

export const NOTIFY_GLOBAL_OPTIONS = new OpaqueToken('[@ngrx/notify] Global Options');
export const NOTIFICATION_STATIC = new OpaqueToken('[@ngrx/notify] Notification Static Constructor');


const NOTIFICATION_STATIC_PROVIDER = {
provide: NOTIFICATION_STATIC,
useValue: Notification
};

const NOTIFICATION_PERMISSION_PROVIDER = {
provide: NotificationPermission,
deps: [ NOTIFICATION_STATIC ],
useFactory(Notification: NotificationStatic) {
return new NotificationPermission(Notification);
export declare var Notification: NotificationStatic;

export const NOTIFY_GLOBAL_OPTIONS = new InjectionToken<NotificationOptions>('[@ngrx/notify] Global Options');
export const NOTIFICATION_STATIC = new InjectionToken<NotificationStatic>('[@ngrx/notify] Notification Static Constructor');

export function createNotification(): NotificationStatic {
return Notification;
}

export function createNotificationPermission(notification: NotificationStatic): NotificationPermission {
return new NotificationPermission(notification);
}

export function createNotify(notification: NotificationStatic, options: NotificationOptions, permission$: NotificationPermission): Notify {
return new Notify(notification, options, permission$);
}

@NgModule({
})
export class NotifyModule {
static forRoot(options: NotificationOptions = {}): ModuleWithProviders {
return {
ngModule: NotifyModule,
providers: [
{
provide: NOTIFICATION_STATIC,
useFactory: (createNotification)
},
{
provide: NotificationPermission,
deps: [NOTIFICATION_STATIC],
useFactory: (createNotificationPermission)
},
{
provide: NOTIFY_GLOBAL_OPTIONS,
useValue: options
},
{
provide: Notify,
deps: [
NOTIFICATION_STATIC,
NOTIFY_GLOBAL_OPTIONS,
NotificationPermission
],
useFactory: (createNotify)
}
]
};
}
};

const NOTIFY_PROVIDER = {
provide: Notify,
deps: [ NOTIFICATION_STATIC, NOTIFY_GLOBAL_OPTIONS, NotificationPermission ],
useFactory(Notification: NotificationStatic, options: NotificationOptions[], permission$: NotificationPermission) {
return new Notify(Notification, options, permission$);
}
};

const DEFAULT_GLOBAL_OPTIONS_PROVIDER = {
provide: NOTIFY_GLOBAL_OPTIONS,
multi: true,
useValue: {}
};

export const NOTIFY_PROVIDERS: any[] = [
NOTIFICATION_STATIC_PROVIDER,
NOTIFICATION_PERMISSION_PROVIDER,
NOTIFY_PROVIDER,
DEFAULT_GLOBAL_OPTIONS_PROVIDER
];
}
6 changes: 5 additions & 1 deletion lib/notification.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export type NotificationPermissionStatus = 'denied' | 'granted' | 'default';
export enum NotificationPermissionStatus {
DENIED = 'denied',
GRANTED = 'granted',
DEFAULT = 'default'
}

export interface NotificationOptions {
dir?: 'auto' | 'ltr' | 'rtl';
12 changes: 5 additions & 7 deletions lib/notify.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import 'rxjs/add/operator/cache';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/share';
import { Observable } from 'rxjs/Observable';
import { Subscriber } from 'rxjs/Subscriber';

import { NotificationStatic, NotificationOptions, NotificationInstance } from './notification';


export class Notify {
private _permission$: Observable<boolean>;

constructor(
private notificationConstructor: NotificationStatic,
private globalOptions: NotificationOptions[],
private globalOptions: NotificationOptions,
permission$: Observable<boolean>
) {
this._permission$ = permission$.cache();
this._permission$ = permission$.share();
}

requestPermission(): Observable<boolean> {
return this._permission$;
}

private _createNotificationObservable(title: string, _options?: NotificationOptions) {
const options: NotificationOptions = Object.assign({}, ...this.globalOptions, _options);
const options: NotificationOptions = { ...this.globalOptions, ..._options };

return new Observable((subscriber: Subscriber<NotificationInstance>) => {
const notification = new this.notificationConstructor(title, options);
4,354 changes: 4,354 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

68 changes: 37 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ngrx/notify",
"version": "1.0.0",
"description": "Web Notifications Powered by RxJS for Angular 2",
"version": "2.0.0",
"description": "Web Notifications Powered by RxJS for Angular",
"main": "index.js",
"jsnext:main": "esm/index.js",
"repository": {
@@ -12,18 +12,16 @@
"lint": "npm-run-all lint:*",
"lint:lib": "tslint lib/**.ts",
"lint:spec": "tslint spec/**.ts",
"typings": "typings install",
"clean": "npm-run-all clean:*",
"clean:release": "rm -rf ./release",
"clean:typings": "rm -rf ./typings",
"prebuild": "npm-run-all clean typings karma",
"prebuild": "npm-run-all clean karma",
"build": "npm-run-all build:cjs build:es6",
"build:cjs": "tsc --p tsconfig.es5.json --diagnostics --pretty",
"build:es6": "tsc -m es2015 --outDir ./release/esm --target ES6 -d --diagnostics --pretty",
"prepare": "npm-run-all prepare:*",
"prepare:es6": "cp -R ./release/esm ./release/npm",
"prepare:package": "cp ./{package.json,README.md,LICENSE} ./release/npm",
"test": "npm-run-all clean typings karma",
"test": "npm-run-all clean karma",
"karma": "karma start --single-run",
"karma:watch": "karma start",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
@@ -36,38 +34,46 @@
],
"license": "MIT",
"peerDependencies": {
"rxjs": "5.0.0-beta.6",
"@angular/core": "^2.0.0-rc.1",
"@ngrx/store": "^2.0.0"
"rxjs": "^5.4.2",
"@angular/core": "^4.3.0",
"@ngrx/store": "^2.2.3"
},
"devDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@ngrx/core": "^1.0.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
"@angular/platform-browser-dynamic": "^4.3.0",
"@ngrx/store": "^2.2.3",
"@types/core-js": "^0.9.42",
"@types/jasmine": "^2.5.53",
"@types/node": "^8.0.14",
"conventional-changelog-cli": "^1.1.1",
"core-js": "^2.2.2",
"istanbul-instrumenter-loader": "^0.2.0",
"fs.realpath": "^1.0.0",
"is-utf8": "^0.2.1",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.5.5",
"karma-jasmine": "^0.3.8",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-mocha-reporter": "^2.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript-preprocessor": "0.0.21",
"karma-webpack": "^1.7.0",
"npm-run-all": "^1.7.0",
"karma-typescript-preprocessor": "0.3.1",
"karma-webpack": "^2.0.4",
"npm-run-all": "^4.0.2",
"pseudomap": "^1.0.2",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"source-map-loader": "^0.1.5",
"ts-loader": "^0.8.1",
"tslint": "^3.6.0",
"typescript": "^1.8.9",
"typings": "^0.7.12",
"webpack": "^1.12.14",
"zone.js": "^0.6.8"
"rxjs": "5.4.2",
"source-map-loader": "^0.2.1",
"ts-helpers": "^1.1.2",
"ts-loader": "^2.3.0",
"tslint": "^5.5.0",
"typescript": "^2.4.1",
"webpack": "^3.3.0",
"yallist": "^3.0.2",
"zone.js": "0.8.12"
}
}
8 changes: 4 additions & 4 deletions spec/notification-permission.spec.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ describe('Notification Permission', function() {
});

it('should complete with a denied status if the permission type is "denied"', function(done) {
const permission: NotificationPermissionStatus = 'denied';
const permission = NotificationPermissionStatus.DENIED;
const notification: any = { permission };

new NotificationPermission(notification).subscribe({
@@ -26,7 +26,7 @@ describe('Notification Permission', function() {
});

it('should complete with a granted status if the permission type is "granted"', function(done) {
const permission: NotificationPermissionStatus = 'granted';
const permission = NotificationPermissionStatus.GRANTED;
const notification: any = { permission };

new NotificationPermission(notification).subscribe({
@@ -39,8 +39,8 @@ describe('Notification Permission', function() {
});

it('should request permission if the permission type is "default"', function(done) {
const permission: NotificationPermissionStatus = 'default';
const resolvedPermission: Promise<NotificationPermissionStatus> = Promise.resolve('granted');
const permission = NotificationPermissionStatus.DEFAULT;
const resolvedPermission: Promise<NotificationPermissionStatus> = Promise.resolve(NotificationPermissionStatus.GRANTED);
const requestPermission = jasmine.createSpy('requestPermission').and.returnValue(resolvedPermission);
const notification: any = { permission, requestPermission };

19 changes: 10 additions & 9 deletions spec/notify.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NotificationInstance } from '../lib/notification';
import 'rxjs/add/operator/take';
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
@@ -6,7 +7,7 @@ import { Notify } from '../lib/notify';

describe('Notify', function() {
it('should alias "requestPermission()" to "NotificationPermission"', function(done) {
const notify = new Notify(<any>{}, [], Observable.of(true));
const notify = new Notify(<any>{}, {}, Observable.of(true));

notify.requestPermission().subscribe({
next(permission) {
@@ -19,7 +20,7 @@ describe('Notify', function() {

it('should not create a notification observable if it does not have permission', function(done) {
const Notification = jasmine.createSpy('Notification');
const notify = new Notify(<any>Notification, [], Observable.of(false));
const notify = new Notify(<any>Notification, {}, Observable.of(false));

notify.open('test').subscribe({
error(err) {
@@ -39,7 +40,7 @@ describe('Notify', function() {
close: () => {}
});

const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));
const sub = notify.open('test').subscribe();

expect(Notification).toHaveBeenCalledWith('test', {});
@@ -49,7 +50,7 @@ describe('Notify', function() {
it('should close the notification when the observable is unsubscribed from', function() {
const close = jasmine.createSpy('close');
const Notification = jasmine.createSpy('Notification').and.returnValue({ close });
const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));
const sub = notify.open('test').subscribe();
sub.unsubscribe();

@@ -62,10 +63,10 @@ describe('Notify', function() {
val();
},
close: () => {}
};
} as NotificationInstance;

const Notification = jasmine.createSpy('Notification').and.returnValue(instance);
const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));

notify.open('something').take(1).subscribe({
next(val) {
@@ -85,7 +86,7 @@ describe('Notify', function() {
};

const Notification = jasmine.createSpy('Notification').and.returnValue(instance);
const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));

notify.open('something').subscribe({
error(err) {
@@ -104,7 +105,7 @@ describe('Notify', function() {
};

const Notification = jasmine.createSpy('Notification').and.returnValue(instance);
const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));

notify.open('something').subscribe({
complete: () => {
@@ -125,7 +126,7 @@ describe('Notify', function() {
};

const Notification = jasmine.createSpy('Notification').and.returnValue(instance);
const notify = new Notify(<any>Notification, [], Observable.of(true));
const notify = new Notify(<any>Notification, {}, Observable.of(true));

const sub = notify.open('test').subscribe({
next(val) {
9 changes: 7 additions & 2 deletions spec/tsconfig.json
Original file line number Diff line number Diff line change
@@ -7,10 +7,15 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": false
"declaration": false,
"lib": ["es2017", "dom"],
"types": [
"core-js",
"jasmine",
"node"
]
},
"files": [
"../typings/main.d.ts",
"notification-permission.spec.ts",
"notify.spec.ts",
"index.spec.ts"
39 changes: 27 additions & 12 deletions tests.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
require('core-js');
require('zone.js/dist/zone.js');
require('zone.js/dist/long-stack-trace-zone.js');
require('zone.js/dist/jasmine-patch.js');
require('zone.js/dist/async-test.js');
require('zone.js/dist/fake-async-test.js');
require('core-js/es6');
require('core-js/es7/reflect');
require('core-js/es7/array');

Error.stackTraceLimit = Infinity;
// Typescript emit helpers polyfill
require('ts-helpers');

require('zone.js/dist/zone');
require('zone.js/dist/long-stack-trace-zone');
require('zone.js/dist/proxy'); // since zone.js 0.6.15
require('zone.js/dist/sync-test');
require('zone.js/dist/jasmine-patch'); // put here since zone.js 0.6.14
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');

// RxJS
require('rxjs/Rx');

require('reflect-metadata');

const testContext = require.context('./spec', true, /\.spec\.ts/);
testContext.keys().forEach(testContext);
Error.stackTraceLimit = Infinity;

const testing = require('@angular/core/testing');
const browser = require('@angular/platform-browser-dynamic/testing');
testing.setBaseTestProviders(
browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
testing.TestBed.initTestEnvironment(
browser.BrowserDynamicTestingModule,
browser.platformBrowserDynamicTesting()
);

const testContext = require.context('./spec', true, /\.spec\.ts/);
function requireAll(requireContext) {
return requireContext.keys().map(requireContext);
}
const modules = requireAll(testContext);
12 changes: 7 additions & 5 deletions tsconfig.es5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": "1.8.0",
"compileOnSave": false,
"compilerOptions": {
"outDir": "./release/npm",
@@ -10,13 +9,16 @@
"experimentalDecorators": true,
"removeComments": false,
"moduleResolution": "node",
"declaration": true
"declaration": true,
"lib": ["es2017", "dom"],
"types": [
"core-js",
"node"
]
},
"exclude": [
"node_modules",
"spec",
"release",
"typings/browser",
"typings/browser.d.ts"
"release"
]
}
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": "1.8.0",
"compileOnSave": false,
"compilerOptions": {
"outDir": "./release/esm",
@@ -9,12 +8,16 @@
"experimentalDecorators": true,
"removeComments": false,
"moduleResolution": "node",
"declaration": true
"declaration": true,
"lib": ["es2017", "dom"],
"types": [
"core-js",
"node"
]
},
"exclude": [
"node_modules",
"spec",
"typings",
"release"
]
}
7 changes: 0 additions & 7 deletions typings.json

This file was deleted.

0 comments on commit fefa907

Please sign in to comment.