diff --git a/README.md b/README.md
index 0406e21..9736961 100644
--- a/README.md
+++ b/README.md
@@ -9,13 +9,13 @@
[jspm]: http://jspm.io
[typings]: https://github.com/typings/typings
-# ssv-ng2-core
+# @ssv/ng2-core
[![Build status](https://ci.appveyor.com/api/projects/status/2e0an5hvxtfs08mf?svg=true)](https://ci.appveyor.com/project/chiko/ssv-ng2-core)
[![Build status](https://ci.appveyor.com/api/projects/status/2e0an5hvxtfs08mf/branch/master?svg=true)](https://ci.appveyor.com/project/chiko/ssv-ng2-core/branch/master)
[![bitHound Overall Score](https://www.bithound.io/github/sketch7/ssv-ng2-core/badges/score.svg)](https://www.bithound.io/github/sketch7/ssv-ng2-core)
-[![npm version](https://badge.fury.io/js/ssv-ng2-core.svg)](https://badge.fury.io/js/ssv-ng2-core)
+[![npm version](https://badge.fury.io/js/%40ssv%2Fng2-core.svg)](https://badge.fury.io/js/%40ssv%2Fng2-core)
-Sketch7 Angular2 core components and utilities
+Core utilities and services for angular2, such as logger.
In order to contribute please read the [Contribution guidelines][contribWiki].
@@ -27,7 +27,7 @@ In order to contribute please read the [Contribution guidelines][contribWiki].
Get library via [npm]
```bash
-npm install ssv-ng2-core --save
+npm install @ssv/ng2-core --save
```
TypeScript Typings via [typings]
@@ -36,22 +36,26 @@ typings install github:sketch7/ssv-ng2-core --save
```
# Usage
-```ts
-import {LoggerFactory, ILog} from "ssv-ng2-core";
-
-private logger: ILog;
+## Register module
-constructor(
- loggerFactory: LoggerFactory
-) {
- this.logger = loggerFactory.getInstance(id);
+```ts
+import {CoreModule} from "@ssv/ng2-core";
+
+@NgModule({
+ imports: [
+ CoreModule
+ ],
+ declarations: [
+ AppComponent
+ ]
+}
+export class AppModule {
}
-
```
-## Logger
-Read more how to use [Logger](./src/logging/README.md).
+# Features
+ - [Logger](./src/logging/README.md)
# Getting Started
@@ -59,10 +63,10 @@ Read more how to use [Logger](./src/logging/README.md).
## Setup Machine for Development
Install/setup the following:
-- NodeJS v4+
+- NodeJS v5+
- Visual Studio Code or similar code editor
- TypeScript 1.8+
-- SourceTree, SmartGit (or similar)
+- Git + SourceTree, SmartGit or similar (optional)
- Ensure to install **global NPM modules** using the following:
@@ -73,8 +77,7 @@ npm install -g git gulp typings karma-cli
### Cloning Repo
-- Open SourceTree
-- Clone project repo from [project git][projectGit]
+- Run `git clone https://github.com/sketch7/ssv-ng2-core.git`
- Switch to `develop` branch
diff --git a/build/tasks/build.js b/build/tasks/build.js
index 43a359d..eae3d38 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -25,7 +25,6 @@ gulp.task("rebuild", (cb) => {
return runSeq(
"clean",
"build",
- "copy-dist",
cb);
}
return runSeq(
diff --git a/build/tasks/dev.js b/build/tasks/dev.js
index 9d8c6d2..f49a1f1 100644
--- a/build/tasks/dev.js
+++ b/build/tasks/dev.js
@@ -6,21 +6,22 @@ const args = require("../args");
const config = require("../config");
gulp.task("watch", () => {
- if (args.isRelease) {
- // ts
- gulp.watch([config.src.ts, `!${config.src.testTs}`], () => {
+
+ // ts
+ gulp.watch([config.src.ts, `!${config.src.testTs}`], () => {
+ if (args.isRelease) {
return runSeq(
"compile:ts",
"copy-dist"
);
- }).on("change", reportChange)
- .on("error", swallowError);
- } else {
- // ts
- gulp.watch([config.src.ts, `!${config.src.testTs}`], ["compile:ts"])
- .on("change", reportChange)
- .on("error", swallowError);
- }
+ } else {
+ return runSeq(
+ "compile:ts"
+ );
+ }
+ }).on("change", reportChange)
+ .on("error", swallowError);
+
});
function reportChange(event) {
diff --git a/dist/amd/index.js b/dist/amd/index.js
index 3233589..13ff7dc 100644
--- a/dist/amd/index.js
+++ b/dist/amd/index.js
@@ -1,9 +1,10 @@
-define(["require", "exports", "./logging/logging"], function (require, exports, logging_1) {
+define(["require", "exports", "./logging/logging", "./module"], function (require, exports, logging_1, module_1) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(logging_1);
+ __export(module_1);
});
//# sourceMappingURL=index.js.map
diff --git a/dist/amd/index.js.map b/dist/amd/index.js.map
index d62df86..a8c3843 100644
--- a/dist/amd/index.js.map
+++ b/dist/amd/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;IAAA,oBAAkC","file":"index.js","sourcesContent":["export * from \"./logging/logging\";"]}
\ No newline at end of file
+{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;IAAA,oBAAkC;IAClC,mBAAyB","file":"index.js","sourcesContent":["export * from \"./logging/logging\";\r\nexport * from \"./module\";"]}
\ No newline at end of file
diff --git a/dist/amd/logging/logger.factory.js b/dist/amd/logging/logger.factory.js
index 9064ff6..c345608 100644
--- a/dist/amd/logging/logger.factory.js
+++ b/dist/amd/logging/logger.factory.js
@@ -13,7 +13,7 @@ define(["require", "exports", "@angular/core", "./logger.service"], function (re
function LoggerFactory(loggerService) {
this.loggerService = loggerService;
}
- LoggerFactory.prototype.getInstance = function (sourceId) {
+ LoggerFactory.prototype.get = function (sourceId) {
return new logger_service_1.Log(sourceId, this.loggerService);
};
LoggerFactory = __decorate([
diff --git a/dist/amd/logging/logger.factory.js.map b/dist/amd/logging/logger.factory.js.map
index 98211cc..bc13a2a 100644
--- a/dist/amd/logging/logger.factory.js.map
+++ b/dist/amd/logging/logger.factory.js.map
@@ -1 +1 @@
-{"version":3,"sources":["logging/logger.factory.ts"],"names":[],"mappings":";;;;;;;;;;;IAMA;QAEC,uBACS,aAA4B;YAA5B,kBAAa,GAAb,aAAa,CAAe;QAGrC,CAAC;QAED,mCAAW,GAAX,UAAY,QAAgB;YAC3B,MAAM,CAAC,IAAI,oBAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9C,CAAC;QAXF;YAAC,iBAAU,EAAE;;yBAAA;QAYb,oBAAC;IAAD,CAXA,AAWC,IAAA;IAXY,qBAAa,gBAWzB,CAAA","file":"logger.factory.js","sourcesContent":["import {Injectable} from \"@angular/core\";\r\n\r\nimport {ILog} from \"./logger.model\";\r\nimport {Log, LoggerService} from \"./logger.service\";\r\n\r\n@Injectable()\r\nexport class LoggerFactory {\r\n\r\n\tconstructor(\r\n\t\tprivate loggerService: LoggerService\r\n\t) {\r\n\r\n\t}\r\n\r\n\tgetInstance(sourceId: string): ILog {\r\n\t\treturn new Log(sourceId, this.loggerService);\r\n\t}\r\n}"]}
\ No newline at end of file
+{"version":3,"sources":["logging/logger.factory.ts"],"names":[],"mappings":";;;;;;;;;;;IAMA;QAEC,uBACS,aAA4B;YAA5B,kBAAa,GAAb,aAAa,CAAe;QAGrC,CAAC;QAED,2BAAG,GAAH,UAAI,QAAgB;YACnB,MAAM,CAAC,IAAI,oBAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9C,CAAC;QAXF;YAAC,iBAAU,EAAE;;yBAAA;QAYb,oBAAC;IAAD,CAXA,AAWC,IAAA;IAXY,qBAAa,gBAWzB,CAAA","file":"logger.factory.js","sourcesContent":["import {Injectable} from \"@angular/core\";\r\n\r\nimport {ILog} from \"./logger.model\";\r\nimport {Log, LoggerService} from \"./logger.service\";\r\n\r\n@Injectable()\r\nexport class LoggerFactory {\r\n\r\n\tconstructor(\r\n\t\tprivate loggerService: LoggerService\r\n\t) {\r\n\r\n\t}\r\n\r\n\tget(sourceId: string): ILog {\r\n\t\treturn new Log(sourceId, this.loggerService);\r\n\t}\r\n}"]}
\ No newline at end of file
diff --git a/dist/amd/module.js b/dist/amd/module.js
new file mode 100644
index 0000000..1db630a
--- /dev/null
+++ b/dist/amd/module.js
@@ -0,0 +1,26 @@
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var __metadata = (this && this.__metadata) || function (k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+define(["require", "exports", "@angular/core", "./logging/logging"], function (require, exports, core_1, logging_1) {
+ "use strict";
+ var CoreModule = (function () {
+ function CoreModule() {
+ }
+ CoreModule = __decorate([
+ core_1.NgModule({
+ providers: [logging_1.LOGGER_PROVIDERS]
+ }),
+ __metadata('design:paramtypes', [])
+ ], CoreModule);
+ return CoreModule;
+ }());
+ exports.CoreModule = CoreModule;
+});
+
+//# sourceMappingURL=module.js.map
diff --git a/dist/amd/module.js.map b/dist/amd/module.js.map
new file mode 100644
index 0000000..cc87cd0
--- /dev/null
+++ b/dist/amd/module.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["module.ts"],"names":[],"mappings":";;;;;;;;;;;IAMA;QAAA;QACA,CAAC;QAJD;YAAC,eAAQ,CAAC;gBACT,SAAS,EAAE,CAAC,0BAAgB,CAAC;aAC7B,CAAC;;sBAAA;QAEF,iBAAC;IAAD,CADA,AACC,IAAA;IADY,kBAAU,aACtB,CAAA","file":"module.js","sourcesContent":["import {NgModule} from \"@angular/core\";\r\nimport {LOGGER_PROVIDERS} from \"./logging/logging\";\r\n\r\n@NgModule({\r\n\tproviders: [LOGGER_PROVIDERS]\r\n})\r\nexport class CoreModule {\r\n}"]}
\ No newline at end of file
diff --git a/dist/typings/index.d.ts b/dist/typings/index.d.ts
index abacc52..0d24a21 100644
--- a/dist/typings/index.d.ts
+++ b/dist/typings/index.d.ts
@@ -1 +1,2 @@
export * from "./logging/logging";
+export * from "./module";
diff --git a/dist/typings/logging/logger.factory.d.ts b/dist/typings/logging/logger.factory.d.ts
index 129b95e..c30e059 100644
--- a/dist/typings/logging/logger.factory.d.ts
+++ b/dist/typings/logging/logger.factory.d.ts
@@ -3,5 +3,5 @@ import { LoggerService } from "./logger.service";
export declare class LoggerFactory {
private loggerService;
constructor(loggerService: LoggerService);
- getInstance(sourceId: string): ILog;
+ get(sourceId: string): ILog;
}
diff --git a/dist/typings/module.d.ts b/dist/typings/module.d.ts
new file mode 100644
index 0000000..9f875c1
--- /dev/null
+++ b/dist/typings/module.d.ts
@@ -0,0 +1,2 @@
+export declare class CoreModule {
+}
diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md
index a239359..cbcd7ca 100644
--- a/doc/CHANGELOG.md
+++ b/doc/CHANGELOG.md
@@ -1,5 +1,15 @@
-
-## [0.0.1](https://github.com/sketch7/ssv-ng2-core/compare/0.0.1-rc.1...v0.0.1) (2016-06-09)
+
+## [0.0.1-rc.0](https://github.com/sketch7/ssv-ng2-core/compare/0.0.1-rc.2...v0.0.1-rc.0) (2016-08-09)
+
+
+### Features
+
+* **angular:** updated angular to rc5 + added module ([2978597](https://github.com/sketch7/ssv-ng2-core/commit/2978597))
+
+
+
+
+## [0.0.1-rc.2](https://github.com/sketch7/ssv-ng2-core/compare/0.0.1-rc.1...0.0.1-rc.2) (2016-06-22)
diff --git a/karma-test-shim.js b/karma-test-shim.js
new file mode 100644
index 0000000..bda7f4a
--- /dev/null
+++ b/karma-test-shim.js
@@ -0,0 +1,70 @@
+// reference: https://github.com/ocombe/ng2-translate/blob/master/karma-test-shim.js
+
+// Turn on full stack traces in errors to help debugging
+Error.stackTraceLimit = Infinity;
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
+
+// Cancel Karma"s synchronous start,
+// we will call `__karma__.start()` later, once all the specs are loaded.
+__karma__.loaded = function () { };
+
+System.config({
+ baseURL: "/base/",
+ defaultJSExtensions: true,
+ paths: {
+ "n:*": "node_modules/*"
+ },
+ map: {
+ "@angular": "n:@angular",
+ "@ssv": "n:@ssv",
+ "rxjs": "n:rxjs",
+ },
+ packages: {
+ "@angular/common": { main: "index.js", defaultExtension: "js" },
+ "@angular/compiler": { main: "index.js", defaultExtension: "js" },
+ "@angular/core": { main: "index.js", defaultExtension: "js" },
+ "@angular/platform-browser": { main: "index.js", defaultExtension: "js" },
+ "@angular/platform-browser-dynamic": { main: "index.js", defaultExtension: "js" },
+
+ "@ssv/ng2-core": { main: "dist/amd/index.js", defaultExtension: "js" },
+ }
+});
+
+System.import("@angular/platform-browser/src/browser/browser_adapter")
+ .then(function (browser_adapter) {
+ browser_adapter.BrowserDomAdapter.makeCurrent();
+ })
+ .then(function () {
+ return Promise.all([
+ System.import("@angular/core/testing"),
+ System.import("@angular/platform-browser-dynamic/testing")
+ ]).then(function (providers) {
+ var testing = providers[0];
+ var testingBrowser = providers[1];
+
+ testing.TestBed.initTestEnvironment(
+ testingBrowser.BrowserDynamicTestingModule,
+ testingBrowser.platformBrowserDynamicTesting()
+ );
+ });
+ })
+ .then(function () {
+ return Promise.all(resolveTestFiles());
+ })
+ .then(function () {
+ __karma__.start();
+ }, function (error) {
+ __karma__.error(error.stack || error);
+ });
+
+function onlySpecFiles(path) {
+ return /[\.|_]spec\.js$/.test(path);
+}
+function resolveTestFiles() {
+ return Object.keys(window.__karma__.files) // All files served by Karma.
+ .filter(onlySpecFiles)
+ .map(function (moduleName) {
+ return System.import(moduleName);
+ });
+}
\ No newline at end of file
diff --git a/karma.conf.js b/karma.conf.js
index 3393e43..d31cf8e 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -3,58 +3,49 @@ const conf = require("./build/config");
module.exports = function (config) {
config.set({
basePath: "./",
- frameworks: ["systemjs", "jasmine"],
+ frameworks: ["jasmine"],
- systemjs: {
- config: {
- paths: {
- "*": "*",
- "src/*": "src/*",
- "typescript": "node_modules/typescript/lib/typescript.js",
- "systemjs": "node_modules/systemjs/dist/system.js",
- "system-polyfills": "node_modules/systemjs/dist/system-polyfills.js",
- "es6-module-loader": "node_modules/es6-module-loader/dist/es6-module-loader.js",
- "n:*": "node_modules/*"
- },
- map: {
- "@angular": "n:@angular",
- "rxjs": "n:rxjs"
- },
- packages: {
- "src": {
- defaultExtension: "ts"
- },
- "rxjs": {
- defaultExtension: "js"
- },
- "@angular/core": {
- main: "index.js",
- defaultExtension: "js"
- }
- },
- transpiler: "typescript"
- },
- serveFiles: [
- conf.src.ts,
- "node_modules/**/*.js"
- ]
- },
files: [
- // Polyfills.
"node_modules/es6-shim/es6-shim.js",
- "node_modules/reflect-metadata/Reflect.js",
-
- // Zone.js dependencies
"node_modules/zone.js/dist/zone.js",
- "node_modules/zone.js/dist/jasmine-patch.js",
"node_modules/zone.js/dist/async-test.js",
"node_modules/zone.js/dist/fake-async-test.js",
+ "node_modules/zone.js/dist/long-stack-trace-zone.js",
+ "node_modules/zone.js/dist/jasmine-patch.js",
+ "node_modules/systemjs/dist/system.src.js",
+ "node_modules/reflect-metadata/Reflect.js",
- conf.src.testTs,
- "src/*.spec.ts"
+ { pattern: "node_modules/reflect-metadata/**/*.js.map", included: false, watched: false, served: true },
+ { pattern: "node_modules/systemjs/dist/system-polyfills.js", included: false, watched: false, served: true }, // PhantomJS2 (and possibly others) might require it
+ { pattern: "node_modules/@angular/**/*.js", included: false, watched: false, served: true },
+ { pattern: "node_modules/@angular/**/*.js.map", included: false, watched: false, served: true },
+ { pattern: "node_modules/rxjs/**/*.js", included: false, watched: false, served: true },
+ { pattern: "node_modules/rxjs/**/*.js.map", included: false, watched: false, served: true },
+ { pattern: "node_modules/@ssv/*/dist/**/*.js", included: false, watched: false, served: true },
+ { pattern: "node_modules/@ssv/*/dist/**/*.js.map", included: false, watched: false, served: true },
+
+ { pattern: conf.src.ts, included: false, watched: true }, // source files
+ "karma-test-shim.js"
+ ],
+ exclude: [
+ "node_modules/**/*_spec.js",
+ "node_modules/**/*.spec.js",
],
- exclude: [],
- preprocessors: {},
+ preprocessors: {
+ // "src/**/*.html": ["ng-html2js"],
+ [conf.src.ts]: ["typescript"],
+ },
+ typescriptPreprocessor: {
+ options: {
+ inlineSourceMap: true,
+ inlineSources: true,
+ emitDecoratorMetadata: true,
+ experimentalDecorators: true
+ }
+ },
+ client: {
+ captureConsole: false // disables console logs
+ },
reporters: ["mocha"], // note: gulp using config from config.js instead
port: 9876,
colors: true,
diff --git a/package.json b/package.json
index 00c23c1..240f0cc 100644
--- a/package.json
+++ b/package.json
@@ -1,15 +1,15 @@
{
- "name": "ssv-ng2-core",
- "version": "0.0.1",
+ "name": "@ssv/ng2-core",
+ "version": "0.0.1-rc.0",
"description": "ssv core angular2 components, utilities and services",
"keywords": [
"sketch7",
+ "ssv",
"ng2",
"angular2",
"core",
"utils",
- "logger",
- "router"
+ "logger"
],
"author": "Stephen Lautier ",
"license": "MIT",
@@ -20,8 +20,14 @@
"url": "https://github.com/sketch7/ssv-ng2-core.git"
},
"devDependencies": {
- "del": "^2.2.0",
+ "@angular/common": "^2.0.0-rc.5",
+ "@angular/compiler": "^2.0.0-rc.5",
+ "@angular/core": "^2.0.0-rc.5",
+ "@angular/platform-browser": "^2.0.0-rc.5",
+ "@angular/platform-browser-dynamic": "^2.0.0-rc.5",
+ "del": "^2.2.1",
"es6-module-loader": "^0.17.11",
+ "es6-shim": "^0.35.1",
"gulp": "^3.9.1",
"gulp-bump": "^2.1.0",
"gulp-conventional-changelog": "^1.1.0",
@@ -37,26 +43,24 @@
"karma-appveyor-reporter": "^0.3.0",
"karma-chrome-launcher": "^1.0.1",
"karma-jasmine": "^1.0.2",
- "karma-mocha-reporter": "^2.0.3",
- "karma-systemjs": "^0.13.0",
+ "karma-mocha-reporter": "^2.0.4",
+ "karma-typescript-preprocessor": "^0.2.1",
"merge2": "^1.0.2",
+ "reflect-metadata": "^0.1.3",
"require-dir": "^0.3.0",
"run-sequence": "^1.2.1",
- "systemjs": "^0.19.30",
+ "rxjs": "5.0.0-beta.6",
+ "systemjs": "^0.19.31",
"tslint": "^3.11.0",
"typescript": "^1.8.10",
"yargs": "^4.7.1",
- "@angular/core": "^2.0.0-rc.1",
- "rxjs": "5.0.0-beta.6",
- "zone.js": "^0.6.12",
- "reflect-metadata": "^0.1.3",
- "es6-shim": "^0.35.1"
+ "zone.js": "^0.6.12"
},
"dependencies": {},
"peerDependencies": {
- "@angular/core": "^2.0.0-rc.1",
+ "@angular/core": "^2.0.0-rc.5",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
},
"typings": "dist/typings/index.d.ts"
-}
\ No newline at end of file
+}
diff --git a/src/index.ts b/src/index.ts
index 61ee5bc..f571eab 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1 +1,2 @@
-export * from "./logging/logging";
\ No newline at end of file
+export * from "./logging/logging";
+export * from "./module";
\ No newline at end of file
diff --git a/src/logging/README.md b/src/logging/README.md
index 65d8751..7458c23 100644
--- a/src/logging/README.md
+++ b/src/logging/README.md
@@ -1,22 +1,11 @@
-# Logger Sample
+# Logger
+A minimal logger with a structured log format and replacable LoggingService which logs to console.
-## Register providers
-
-```ts
-
-import {LOGGER_PROVIDERS} from "ssv-ng2-core";
-
-// within bootstrap or AppComponent
-providers: [
- LOGGER_PROVIDERS
-]
-
-```
## Usage
```ts
-import {LoggerFactory, ILog} from "ssv-ng2-core";
+import {LoggerFactory, ILog} from "@ssv/ng2-core";
const id = "auth.service";
@@ -28,7 +17,7 @@ export class AuthService {
constructor(
loggerFactory: LoggerFactory
) {
- this.logger = loggerFactory.getInstance(id);
+ this.logger = loggerFactory.get(id);
}
login() {
diff --git a/src/logging/logger.factory.ts b/src/logging/logger.factory.ts
index 8a344a3..24dc166 100644
--- a/src/logging/logger.factory.ts
+++ b/src/logging/logger.factory.ts
@@ -12,7 +12,7 @@ export class LoggerFactory {
}
- getInstance(sourceId: string): ILog {
+ get(sourceId: string): ILog {
return new Log(sourceId, this.loggerService);
}
}
\ No newline at end of file
diff --git a/src/logging/logger.service.spec.ts b/src/logging/logger.service.spec.ts
index df8fed5..1eaa36d 100644
--- a/src/logging/logger.service.spec.ts
+++ b/src/logging/logger.service.spec.ts
@@ -1,22 +1,30 @@
-import {
- it,
- inject,
- describe,
- expect,
- beforeEach,
- beforeEachProviders
-} from "@angular/core/testing";
+import {inject, TestBed} from "@angular/core/testing";
+
import {LoggerService} from "./logger.service";
describe("LoggerService", () => {
- beforeEachProviders(() => [LoggerService]);
+
+ let SUT: LoggerService;
+
beforeEach(() => {
- spyOn(console, "log");
+
+ TestBed.configureTestingModule({
+ providers: [LoggerService]
+ });
});
- it("should log successfully", inject([LoggerService], (logger: LoggerService) => {
+ beforeEach(inject([
+ LoggerService
+ ], (
+ logger: LoggerService
+ ) => {
+ SUT = logger;
+ spyOn(console, "log");
+ }));
+
+ it("should log successfully", () => {
let message = "Hello";
- logger.log("log", message);
+ SUT.log("log", message);
expect(console.log).toHaveBeenCalledWith(message);
- }));
+ });
});
\ No newline at end of file
diff --git a/src/module.ts b/src/module.ts
new file mode 100644
index 0000000..3bb1bc5
--- /dev/null
+++ b/src/module.ts
@@ -0,0 +1,8 @@
+import {NgModule} from "@angular/core";
+import {LOGGER_PROVIDERS} from "./logging/logging";
+
+@NgModule({
+ providers: [LOGGER_PROVIDERS]
+})
+export class CoreModule {
+}
\ No newline at end of file
diff --git a/typings.json b/typings.json
index 767fe4a..cfb5b96 100644
--- a/typings.json
+++ b/typings.json
@@ -1,5 +1,5 @@
{
- "name": "ssv-ng2-core",
+ "name": "@ssv/ng2-core",
"main": "dist/typings/index.d.ts",
"globalDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"