Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	doc/CHANGELOG.md
#	package.json
  • Loading branch information
stephenlautier committed Aug 9, 2016
2 parents 00e1ec4 + 2380e44 commit 9bf2244
Show file tree
Hide file tree
Showing 22 changed files with 243 additions and 128 deletions.
41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].

Expand All @@ -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]
Expand All @@ -36,33 +36,37 @@ 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
## 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:
Expand All @@ -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


Expand Down
1 change: 0 additions & 1 deletion build/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ gulp.task("rebuild", (cb) => {
return runSeq(
"clean",
"build",
"copy-dist",
cb);
}
return runSeq(
Expand Down
23 changes: 12 additions & 11 deletions build/tasks/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion dist/amd/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/amd/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/amd/logging/logger.factory.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/amd/logging/logger.factory.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions dist/amd/module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/amd/module.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./logging/logging";
export * from "./module";
2 changes: 1 addition & 1 deletion dist/typings/logging/logger.factory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions dist/typings/module.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare class CoreModule {
}
14 changes: 12 additions & 2 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<a name="0.0.1"></a>
## [0.0.1](https://github.com/sketch7/ssv-ng2-core/compare/0.0.1-rc.1...v0.0.1) (2016-06-09)
<a name="0.0.1-rc.0"></a>
## [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))



<a name="0.0.1-rc.2"></a>
## [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)



Expand Down
70 changes: 70 additions & 0 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
@@ -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);
});
}
79 changes: 35 additions & 44 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 9bf2244

Please sign in to comment.