Skip to content

Commit

Permalink
Merge pull request #17 from hapinessjs/next
Browse files Browse the repository at this point in the history
release(version): v1.1.0
  • Loading branch information
akanass committed Nov 20, 2017
2 parents 72425b1 + aad097e commit 819706e
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 115 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -59,8 +59,8 @@ $ yarn add @hapiness/core @hapiness/logger rxjs

```javascript
"dependencies": {
"@hapiness/core": "^1.1.1",
"@hapiness/logger": "^1.0.0",
"@hapiness/core": "^1.2.2",
"@hapiness/logger": "^1.1.0",
"rxjs": "^5.5.2",
//...
}
Expand Down Expand Up @@ -137,6 +137,10 @@ To set up your development environment:

## Change History

* v1.1.0 (2017-11-20)
* Latest packages' versions.
* Documentation.
* Change packaging process.
* v1.0.0 (2017-10-26)
* Create LoggerModule
* Logger extension
Expand Down
17 changes: 8 additions & 9 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "@hapiness/logger",
"version": "1.0.0",
"version": "1.1.0",
"description": "Hapiness module for logging",
"main": "index.js",
"main": "commonjs/index.js",
"types": "index.d.ts",
"private": false,
"scripts": {
Expand Down Expand Up @@ -67,32 +67,31 @@
},
"homepage": "https://github.com/hapinessjs/logger-module#readme",
"dependencies": {
"@types/chalk": "^0.4.31",
"@types/node": "^8.0.47",
"@types/node": "^8.0.53",
"chalk": "^2.3.0",
"debug": "^3.1.0"
},
"devDependencies": {
"@hapiness/core": "^1.1.1",
"@types/fs-extra": "^4.0.2",
"@hapiness/core": "^1.2.2",
"@types/fs-extra": "^4.0.5",
"coveralls": "^3.0.0",
"fs-extra": "^4.0.2",
"intercept-stdout": "^0.1.2",
"istanbul": "^1.1.0-alpha.1",
"mocha": "^4.0.1",
"mocha-typescript": "^1.1.11",
"mocha-typescript": "^1.1.12",
"rimraf": "^2.6.2",
"rxjs": "^5.5.2",
"ts-node": "^3.3.0",
"tslint": "^5.8.0",
"typescript": "^2.5.3",
"typescript": "^2.6.1",
"unit.js": "^2.0.0"
},
"engines": {
"node": ">=7.0.0"
},
"peerDependencies": {
"@hapiness/core": "^1.1.1",
"@hapiness/core": "^1.2.2",
"rxjs": "^5.5.2"
}
}
2 changes: 1 addition & 1 deletion src/module/logger.module.ts
Expand Up @@ -4,7 +4,7 @@ import { AccessLogs } from './logger.lifecycle';
import { LOGGER_CONFIG, LoggerConfig } from './logger.config';

@HapinessModule({
version: '1.0.0-rc.7',
version: '1.1.0',
declarations: [ AccessLogs ],
providers: [ LoggerService ],
exports: [ LoggerService ]
Expand Down
7 changes: 1 addition & 6 deletions tools/files.json
@@ -1,10 +1,5 @@
[
{ "name":"README.md" },
{ "name":"LICENSE.md" },
{ "name":"package.json" },
{ "name":"src" },
{ "name":"index.js", "remove":true },
{ "name":"index.js.map", "remove":true },
{ "name":"index.d.ts", "remove":true },
{ "name":"module", "remove":true }
{ "name":"package.json" }
]
63 changes: 10 additions & 53 deletions tools/packaging.ts
Expand Up @@ -9,8 +9,6 @@ import * as fs from 'fs-extra';
*/
interface FileObject {
name: string;
remove?: boolean;
externals?: boolean;
}

/**
Expand Down Expand Up @@ -41,28 +39,23 @@ class Packaging {
* Function to copy one file
*
* @param file {string}
* @param externals {boolean}
*
* @return {Observable<R>}
* @return {Observable<any>}
*/
private _copy(file: string, externals?: boolean): Observable<any> {
private _copy(file: string): Observable<any> {
// copy package.json
if (file.indexOf('package.json') !== -1) {
return this._copyAndCleanupPackageJson(file);
}

// copy other files
return <Observable<any>> Observable.create((observer) => {
let fileDest = file;
if (externals && file.indexOf('src/') !== -1) {
fileDest = file.split('src/').pop();
}
fs.stat(`${this._srcPath}${file}`, (error, stats) => {
if (error) {
console.error('doesn\'t exist on copy =>', error.message);
}
if (stats && (stats.isFile() || stats.isDirectory())) {
fs.copy(`${this._srcPath}${file}`, `${this._destPath}${fileDest}`, (err) => {
fs.copy(`${this._srcPath}${file}`, `${this._destPath}${file}`, (err) => {
if (err) {
console.error('copy failed =>', err.message);
}
Expand All @@ -78,52 +71,12 @@ class Packaging {
});
}

/**
* Function to remove original file
*
* @param file {string}
* @param remove {boolean}
*
* @return {Observable<any>}
*
* @private
*/
private _remove(file: string, remove?: boolean): Observable<any> {
// remove original files
return <Observable<any>> Observable.create((observer) => {
if (remove) {
fs.stat(`${this._srcPath}${file}`, (error, stats) => {
if (error) {
console.error('doesn\'t exist on remove =>', error.message);
}

if (stats && (stats.isFile() || stats.isDirectory())) {
fs.remove(`${this._srcPath}${file}`, (err) => {
if (err) {
console.error('remove failed =>', err.message);
}

observer.next();
observer.complete();
});
} else {
observer.next();
observer.complete();
}
});
} else {
observer.next();
observer.complete();
}
});
}

/**
* Function to cleanup package.json and _copy it to dist directory
*
* @param file {string}
*
* @return {Observable<R>}
* @return {Observable<any>}
*
* @private
*/
Expand Down Expand Up @@ -171,8 +124,12 @@ class Packaging {
* Function that _copy all files in dist directory
*/
process() {
Observable.forkJoin(this._files.map((fileObject: FileObject) => this._copy(fileObject.name, fileObject.externals)
.flatMap(_ => this._remove(fileObject.name, fileObject.remove)))).subscribe(null, error => console.error(error));
Observable.forkJoin(
this._files.map(
(fileObject: FileObject) => this._copy(fileObject.name)
)
)
.subscribe(null, error => console.error(error));
}
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.build.json
@@ -1,9 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": ".",
"outDir": "./dist/commonjs",
"rootDir": "./src",
"declarationDir": "./dist",
"types": [
"node",
"chalk"
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
@@ -1,11 +1,12 @@
{
"compilerOptions": {
"target": "es2015",
"module": "umd",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"noImplicitAny": false,
"sourceMap": true,
"inlineSources": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "./tmp",
Expand Down

0 comments on commit 819706e

Please sign in to comment.