diff --git a/.gitignore b/.gitignore index c837656..84afbbe 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ __build__/** # Build Artifacts # release .ngc +*.ngfactory.ts \ No newline at end of file diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..7876e35 --- /dev/null +++ b/index.ts @@ -0,0 +1,4 @@ +export { Effect, mergeEffects } from './src/effects'; +export { Actions } from './src/actions'; +export { EffectsModule } from './src/effects.module'; +export { EffectsSubscription } from './src/effects-subscription'; diff --git a/karma.conf.js b/karma.conf.js index 38f989e..61cbf8b 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -9,20 +9,19 @@ module.exports = function(karma) { frameworks: ['jasmine'], files: [ - { pattern: 'tests.ts', watched: false } + { pattern: 'tests.bundle.ts', watched: false } ], exclude: [], preprocessors: { - 'tests.ts': ['coverage', 'webpack', 'sourcemap'] + 'tests.bundle.ts': ['coverage', 'webpack', 'sourcemap'] }, reporters: ['mocha', 'coverage'], coverageReporter: { dir: 'coverage/', - subdir: '.', reporters: [ { type: 'text-summary' }, { type: 'json' }, @@ -38,7 +37,7 @@ module.exports = function(karma) { logLevel: karma.LOG_INFO, autoWatch: true, singleRun: false, - + webpackServer: { noInfo: true }, webpack: { devtool: 'inline-source-map', resolve: { @@ -46,24 +45,37 @@ module.exports = function(karma) { extensions: ['', '.ts', '.js'] }, module: { + preLoaders: [ + { + test: /\.ts$/, + loader: 'tslint-loader', + exclude: [ + /node_modules/ + ] + } + ], loaders: [ { test: /\.ts?$/, exclude: /(node_modules)/, - loader: 'awesome-typescript' + loader: 'ts' } ], postLoaders: [ { - test: /\.ts?$/, loader: 'istanbul-instrumenter', + test: /\.(js|ts)$/, loader: 'istanbul-instrumenter', include: path.resolve(__dirname, 'src'), exclude: [ - /\.(e2e|spec)\.ts$/, - /tests/, + /\.(e2e|spec|bundle)\.ts$/, /node_modules/ ] } ] + }, + tslint: { + emitErrors: false, + failOnHint: false, + resourcePath: 'src' } } }); diff --git a/package.json b/package.json index ab1c409..b962289 100644 --- a/package.json +++ b/package.json @@ -2,56 +2,60 @@ "name": "@ngrx/effects", "version": "2.0.0-beta.3", "description": "Side effect model for @ngrx/store", - "main": "index.js", - "jsnext:main": "esm/index.js", + "main": "bundles/effects.umd.js", + "module": "index.js", "repository": { "type": "git", "url": "https://github.com/ngrx/effects.git" }, "scripts": { - "lint": "npm-run-all lint:*", - "lint:lib": "tslint lib/**.ts", - "lint:spec": "tslint spec/**.ts", - "clean": "rimraf ./release", - "prebuild": "npm-run-all clean karma", - "build": "npm-run-all build:*", - "build:cjs": "ngc -p tsconfig.cjs.json", - "build:esm": "ngc -p tsconfig.es2015.json", - "build:ts": "cpy src/*.ts release/src", - "prepare": "cpy ./{package.json,README.md,CHANGELOG.md,LICENSE} ./release", - "test": "npm-run-all clean karma", "karma": "karma start --single-run", - "karma:watch": "karma start", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "preversion": "npm run test", - "version": "npm run changelog && git add CHANGELOG.md", - "postversion": "npm run prepare" + "test": "npm run karma", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", + "clean:pre": "rimraf release", + "clean:post": "rimraf src/**/*.ngfactory.ts", + "copy": "cpy LICENSE package.json README.md release", + "build:js": "ngc -p tsconfig.dist.json", + "build:testing": "ngc -p tsconfig.testing.json", + "build:umd": "rollup -c rollup.config.js", + "build:umd:testing": "rollup -c rollup-testing.config.js", + "build:uglify": "uglifyjs -c --screw-ie8 --comments -o ./release/bundles/effects.min.umd.js ./release/bundles/effects.umd.js", + "build:uglify:testing": "uglifyjs -c --screw-ie8 --comments -o ./release/bundles/effects-testing.min.umd.js ./release/bundles/effects-testing.umd.js", + "bundle:main": "npm run build:js && npm run build:umd && npm run build:uglify", + "bundle:testing": "npm run build:testing && npm run build:umd:testing && npm run build:uglify:testing", + "prebuild": "npm run test && npm run clean:pre", + "postbuild": "npm run clean:post && npm run copy", + "build": "npm run bundle:main && npm run bundle:testing", + "version": "npm run changelog && git add CHANGELOG.md" }, "authors": [ "Mike Ryan" ], "license": "MIT", "peerDependencies": { - "rxjs": "^5.0.0-beta.11", - "@angular/core": "^2.0.0-rc.5", - "@ngrx/store": "^2.0.0" + "rxjs": "^5.0.0-beta.12", + "@angular/core": "^2.0.0", + "@ngrx/store": "^1.5.0 || ^2.0.0" }, "devDependencies": { - "@angular/common": "^2.0.0-rc.1", - "@angular/compiler": "^2.0.0-rc.1", - "@angular/compiler-cli": "^0.6.0", - "@angular/core": "^2.0.0-rc.1", - "@angular/platform-browser": "^2.0.0-rc.1", - "@angular/platform-browser-dynamic": "^2.0.0-rc.1", - "@angular/platform-server": "^2.0.0-rc.5", - "@ngrx/core": "^1.1.0", - "@types/jasmine": "^2.2.31", + "@angular/common": "^2.0.0", + "@angular/compiler": "^2.0.0", + "@angular/compiler-cli": "^0.6.1", + "@angular/core": "^2.0.0", + "@angular/platform-browser": "^2.0.0", + "@angular/platform-browser-dynamic": "^2.0.0", + "@angular/platform-server": "^2.0.0", + "@angular/router": "^3.0.0", + "@ngrx/core": "^1.2.0", + "@ngrx/store": "^2.0.0", + "@types/jasmine": "^2.2.33", "@types/node": "^6.0.38", "awesome-typescript-loader": "^2.2.1", "conventional-changelog-cli": "^1.1.1", "core-js": "^2.2.2", + "cpy-cli": "^1.0.1", "istanbul-instrumenter-loader": "^0.2.0", - "jasmine-core": "^2.4.1", + "jasmine-core": "^2.5.0", "karma": "^0.13.22", "karma-chrome-launcher": "^0.2.3", "karma-coverage": "^0.5.5", @@ -62,12 +66,15 @@ "karma-webpack": "^1.7.0", "npm-run-all": "^1.7.0", "reflect-metadata": "^0.1.3", - "rxjs": "^5.0.0-beta.11", + "rollup": "^0.34.13", + "rxjs": "^5.0.0-beta.12", "source-map-loader": "^0.1.5", - "ts-loader": "^0.8.1", - "tslint": "^3.6.0", + "ts-loader": "^0.8.2", + "tslint": "^3.15.1", + "tslint-loader": "^2.1.5", "typescript": "^2.0.2", + "uglifyjs": "^2.4.10", "webpack": "^2.1.0-beta.21", - "zone.js": "^0.6.8" + "zone.js": "^0.6.17" } } diff --git a/rollup-testing.config.js b/rollup-testing.config.js new file mode 100644 index 0000000..6720b15 --- /dev/null +++ b/rollup-testing.config.js @@ -0,0 +1,12 @@ +export default { + entry: './release/testing/index.js', + dest: './release/bundles/effects-testing.umd.js', + format: 'umd', + moduleName: 'ngrx.effects.testing', + globals: { + '@angular/core': 'ng.core', + '@ngrx/store': 'ngrx.store', + '@ngrx/effects': 'ngrx.effects', + 'rxjs/ReplaySubject': 'Rx' + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..0653550 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,15 @@ +export default { + entry: './release/index.js', + dest: './release/bundles/effects.umd.js', + format: 'umd', + moduleName: 'ngrx.effects', + globals: { + '@angular/core': 'ng.core', + '@ngrx/store': 'ngrx.store', + 'rxjs/Observable': 'Rx', + 'rxjs/Subscription': 'Rx', + 'rxjs/operator/filter': 'Rx.Observable.prototype', + 'rxjs/operator/ignoreElements': 'Rx.Observable.prototype', + 'rxjs/observable/merge': 'Rx.Observable' + } +} diff --git a/src/actions.ts b/src/actions.ts index c6f739d..4a9e1ad 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -3,7 +3,6 @@ import { Injectable, Inject } from '@angular/core'; import { Action, Dispatcher } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; -import { Operator } from 'rxjs/Operator'; import { filter } from 'rxjs/operator/filter'; diff --git a/src/module.ts b/src/effects.module.ts similarity index 100% rename from src/module.ts rename to src/effects.module.ts diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 5460bbb..0000000 --- a/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Effect, mergeEffects } from './effects'; -export { Actions } from './actions'; -export { EffectsModule } from './module'; -export { EffectsSubscription } from './effects-subscription'; diff --git a/testing/testing.module.ts b/testing/testing.module.ts index afcda1d..f4b95c3 100644 --- a/testing/testing.module.ts +++ b/testing/testing.module.ts @@ -1,5 +1,5 @@ import { NgModule } from '@angular/core'; -import { Actions } from '../src/actions'; +import { Actions } from '@ngrx/effects'; import { EffectsTestRunner } from './runner'; diff --git a/tests.ts b/tests.bundle.ts similarity index 99% rename from tests.ts rename to tests.bundle.ts index 9aea2f1..7331c23 100644 --- a/tests.ts +++ b/tests.bundle.ts @@ -1,12 +1,15 @@ import 'core-js'; import 'core-js/es7/reflect'; + import 'zone.js/dist/zone'; +import 'zone.js/dist/proxy'; import 'zone.js/dist/long-stack-trace-zone'; -import 'zone.js/dist/async-test'; -import 'zone.js/dist/fake-async-test'; import 'zone.js/dist/sync-test'; -import 'zone.js/dist/proxy'; import 'zone.js/dist/jasmine-patch'; +import 'zone.js/dist/async-test'; +import 'zone.js/dist/fake-async-test'; + + // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. declare var __karma__: any; diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index 44b9058..0000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "2.0.0", - "compileOnSave": false, - "compilerOptions": { - "outDir": "./release", - "target": "es5", - "sourceMap": false, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "removeComments": false, - "moduleResolution": "node", - "declaration": true, - "module": "commonjs", - "lib": ["es5", "dom", "es2015"] - }, - "include": [ - "src/**/*" - ], - "angularCompilerOptions": { - "genDir": ".ngc" - } -} diff --git a/tsconfig.dist.json b/tsconfig.dist.json new file mode 100644 index 0000000..9bbedf0 --- /dev/null +++ b/tsconfig.dist.json @@ -0,0 +1,26 @@ + +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "stripInternal": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "noEmitOnError": false, + "outDir": "./release", + "rootDir": ".", + "sourceMap": true, + "inlineSources": true, + "lib": ["es2015", "dom"], + "target": "es5", + "skipLibCheck": true + }, + "files": [ + "index.ts" + ], + "angularCompilerOptions": { + "strictMetadataEmit": true + } +} diff --git a/tsconfig.es2015.json b/tsconfig.es2015.json deleted file mode 100644 index d7a0c1a..0000000 --- a/tsconfig.es2015.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "2.0.0", - "compileOnSave": false, - "compilerOptions": { - "outDir": "./release/lib", - "target": "es5", - "sourceMap": false, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "removeComments": false, - "moduleResolution": "node", - "declaration": true, - "module": "es2015", - "lib": ["es5", "dom", "es2015"] - }, - "include": [ - "src/**/*" - ], - "angularCompilerOptions": { - "genDir": ".ngc" - } -} diff --git a/tsconfig.json b/tsconfig.json index 6ae6406..630d874 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,12 @@ "types": [ "jasmine", "node" - ] + ], + "baseUrl": ".", + "rootDir": ".", + "paths": { + "@ngrx/effects": ["./"] + } }, "exclude": [ "node_modules", diff --git a/tsconfig.testing.json b/tsconfig.testing.json new file mode 100644 index 0000000..bf70224 --- /dev/null +++ b/tsconfig.testing.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "stripInternal": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "noEmitOnError": false, + "outDir": "./release", + "rootDir": ".", + "sourceMap": true, + "inlineSources": true, + "lib": ["es2015", "dom"], + "target": "es5", + "skipLibCheck": true, + "paths": { + "@ngrx/effects": ["./release"] + } + }, + "files": [ + "testing/index.ts" + ], + "angularCompilerOptions": { + "strictMetadataEmit": true + } +}