Skip to content

Commit ef9c1ca

Browse files
authored
Merge pull request #3 from hapinessjs/next
release(version): v1.0.0
2 parents 01e5175 + e14795b commit ef9c1ca

12 files changed

+561
-630
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.2.1
1+
9.3.0

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pretest:
22
@node ./node_modules/.bin/tslint -p ./tsconfig.json --type-check "./src/**/*.ts" "./test/**/*.ts"
33
test:
4-
@node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha ./test
4+
@node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha "./test/**/*.ts"
55
coveralls:
66
cat ./coverage/lcov.info | node ./node_modules/.bin/coveralls
77
tsc:

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ $ yarn add @hapiness/core @hapiness/date
5959

6060
```javascript
6161
"dependencies": {
62-
"@hapiness/core": "^1.0.0-rc.6",
63-
"@hapiness/date": "^1.0.0-rc.6",
62+
"@hapiness/core": "^1.3.0",
63+
"@hapiness/date": "^1.0.0",
6464
//...
6565
}
6666
//...
@@ -107,19 +107,18 @@ To set up your development environment:
107107

108108
## Change History
109109

110-
* v1.0.0-rc.6 (2017-07-31)
110+
* v1.0.0 (2017-12-19)
111111
* Module initialization.
112112
* Moment.js helper + timezone.
113113
* Documentation.
114-
* Module version related to core version.
115114

116115
[Back to top](#table-of-contents)
117116

118117
## Maintainers
119118

120119
<table>
121120
<tr>
122-
<td colspan="4" align="center"><a href="https://www.tadaweb.com"><img src="https://tadaweb.com/images/tadaweb/logo.png" width="117" alt="tadaweb" /></a></td>
121+
<td colspan="4" align="center"><a href="https://www.tadaweb.com"><img src="http://bit.ly/2xHQkTi" width="117" alt="tadaweb" /></a></td>
123122
</tr>
124123
<tr>
125124
<td align="center"><a href="https://github.com/Juneil"><img src="https://avatars3.githubusercontent.com/u/6546204?v=3&s=117" width="117"/></a></td>

package.json

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@hapiness/date",
3-
"version": "1.0.0-rc.6",
3+
"version": "1.0.0",
44
"description": "Date module for Hapiness framework based on moment",
5-
"main": "index.js",
5+
"main": "commonjs/index.js",
66
"types": "index.d.ts",
77
"private": false,
88
"scripts": {
@@ -67,31 +67,29 @@
6767
},
6868
"homepage": "https://github.com/hapinessjs/date-module#readme",
6969
"peerdependencies": {
70-
"@hapiness/core": "^1.0.0-rc.6"
70+
"@hapiness/core": "^1.3.0"
7171
},
7272
"devDependencies": {
73-
"@hapiness/core": "^1.0.0-rc.6",
74-
"@types/fs-extra": "^4.0.0",
75-
"coveralls": "^2.13.1",
76-
"fs-extra": "^4.0.0",
77-
"intercept-stdout": "^0.1.2",
73+
"@hapiness/core": "^1.3.0",
74+
"@types/fs-extra": "^5.0.0",
75+
"coveralls": "^3.0.0",
76+
"fs-extra": "^5.0.0",
7877
"istanbul": "^1.1.0-alpha.1",
79-
"mocha": "^3.4.2",
80-
"mocha-typescript": "^1.1.7",
81-
"rimraf": "^2.6.1",
82-
"rxjs": "^5.4.2",
78+
"mocha": "^4.0.1",
79+
"mocha-typescript": "^1.1.12",
80+
"rimraf": "^2.6.2",
81+
"rxjs": "^5.5.5",
8382
"ts-node": "^3.3.0",
84-
"tslint": "^5.5.0",
85-
"typescript": "^2.4.2",
83+
"tslint": "^5.8.0",
84+
"typescript": "^2.6.2",
8685
"unit.js": "^2.0.0"
8786
},
8887
"engines": {
8988
"node": ">=7.0.0"
9089
},
9190
"dependencies": {
92-
"@types/moment": "^2.13.0",
93-
"@types/moment-timezone": "^0.2.34",
94-
"moment": "^2.18.1",
95-
"moment-timezone": "^0.5.13"
91+
"@types/moment-timezone": "^0.5.2",
92+
"moment": "^2.20.1",
93+
"moment-timezone": "^0.5.14"
9694
}
9795
}

src/module/date.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { HapinessModule } from '@hapiness/core';
22
import { DateService } from './date.service';
33

44
@HapinessModule({
5-
version: '1.0.0-rc.6',
5+
version: '1.0.0',
66
exports: [ DateService ]
77
})
88
export class DateModule {}

src/module/date.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Optional, Inject, Injectable } from '@hapiness/core';
1+
import { Injectable } from '@hapiness/core';
22
import * as momentTz from 'moment-timezone';
33
import { Moment } from 'moment';
44
import * as moment from 'moment';
@@ -17,7 +17,7 @@ export class DateService {
1717
/**
1818
* Get date helper
1919
*/
20-
helper = moment
20+
helper = moment;
2121

2222
/**
2323
* Get timezone infos

test/mocha.opts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
--report lcovonly
33
--reporter spec
44
--recursive
5-
--compilers ts:ts-node/register
5+
--require ts-node/register
66
--throw-deprecation
77
--colors

tools/files.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
[
22
{ "name":"README.md" },
33
{ "name":"LICENSE.md" },
4-
{ "name":"package.json" },
5-
{ "name":"src" },
6-
{ "name":"index.js", "remove":true },
7-
{ "name":"index.js.map", "remove":true },
8-
{ "name":"index.d.ts", "remove":true },
9-
{ "name":"module", "remove":true }
4+
{ "name":"package.json" }
105
]

tools/packaging.ts

+10-53
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import * as fs from 'fs-extra';
99
*/
1010
interface FileObject {
1111
name: string;
12-
remove?: boolean;
13-
externals?: boolean;
1412
}
1513

1614
/**
@@ -41,28 +39,23 @@ class Packaging {
4139
* Function to copy one file
4240
*
4341
* @param file {string}
44-
* @param externals {boolean}
4542
*
46-
* @return {Observable<R>}
43+
* @return {Observable<any>}
4744
*/
48-
private _copy(file: string, externals?: boolean): Observable<any> {
45+
private _copy(file: string): Observable<any> {
4946
// copy package.json
5047
if (file.indexOf('package.json') !== -1) {
5148
return this._copyAndCleanupPackageJson(file);
5249
}
5350

5451
// copy other files
5552
return <Observable<any>> Observable.create((observer) => {
56-
let fileDest = file;
57-
if (externals && file.indexOf('src/') !== -1) {
58-
fileDest = file.split('src/').pop();
59-
}
6053
fs.stat(`${this._srcPath}${file}`, (error, stats) => {
6154
if (error) {
6255
console.error('doesn\'t exist on copy =>', error.message);
6356
}
6457
if (stats && (stats.isFile() || stats.isDirectory())) {
65-
fs.copy(`${this._srcPath}${file}`, `${this._destPath}${fileDest}`, (err) => {
58+
fs.copy(`${this._srcPath}${file}`, `${this._destPath}${file}`, (err) => {
6659
if (err) {
6760
console.error('copy failed =>', err.message);
6861
}
@@ -78,52 +71,12 @@ class Packaging {
7871
});
7972
}
8073

81-
/**
82-
* Function to remove original file
83-
*
84-
* @param file {string}
85-
* @param remove {boolean}
86-
*
87-
* @return {Observable<any>}
88-
*
89-
* @private
90-
*/
91-
private _remove(file: string, remove?: boolean): Observable<any> {
92-
// remove original files
93-
return <Observable<any>> Observable.create((observer) => {
94-
if (remove) {
95-
fs.stat(`${this._srcPath}${file}`, (error, stats) => {
96-
if (error) {
97-
console.error('doesn\'t exist on remove =>', error.message);
98-
}
99-
100-
if (stats && (stats.isFile() || stats.isDirectory())) {
101-
fs.remove(`${this._srcPath}${file}`, (err) => {
102-
if (err) {
103-
console.error('remove failed =>', err.message);
104-
}
105-
106-
observer.next();
107-
observer.complete();
108-
});
109-
} else {
110-
observer.next();
111-
observer.complete();
112-
}
113-
});
114-
} else {
115-
observer.next();
116-
observer.complete();
117-
}
118-
});
119-
}
120-
12174
/**
12275
* Function to cleanup package.json and _copy it to dist directory
12376
*
12477
* @param file {string}
12578
*
126-
* @return {Observable<R>}
79+
* @return {Observable<any>}
12780
*
12881
* @private
12982
*/
@@ -171,8 +124,12 @@ class Packaging {
171124
* Function that _copy all files in dist directory
172125
*/
173126
process() {
174-
Observable.forkJoin(this._files.map((fileObject: FileObject) => this._copy(fileObject.name, fileObject.externals)
175-
.flatMap(_ => this._remove(fileObject.name, fileObject.remove)))).subscribe(null, error => console.error(error));
127+
Observable.forkJoin(
128+
this._files.map(
129+
(fileObject: FileObject) => this._copy(fileObject.name)
130+
)
131+
)
132+
.subscribe(null, error => console.error(error));
176133
}
177134
}
178135

tsconfig.build.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"outDir": ".",
4+
"outDir": "./dist/commonjs",
55
"rootDir": "./src",
6+
"declarationDir": "./dist",
67
"types": [
78
"node",
8-
"moment",
99
"moment-timezone"
1010
]
1111
},
@@ -15,4 +15,4 @@
1515
"test",
1616
"tools"
1717
]
18-
}
18+
}

tsconfig.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"compilerOptions": {
33
"target": "es2015",
4-
"module": "umd",
4+
"module": "commonjs",
55
"moduleResolution": "node",
66
"declaration": true,
77
"noImplicitAny": false,
88
"sourceMap": true,
9+
"inlineSources": true,
910
"emitDecoratorMetadata": true,
1011
"experimentalDecorators": true,
1112
"outDir": "./tmp",
@@ -14,9 +15,8 @@
1415
"typeRoots": ["./node_modules/@types"],
1516
"types": [
1617
"node",
17-
"moment",
18-
"moment-timezone",
19-
"fs-extra"
18+
"fs-extra",
19+
"moment-timezone"
2020
],
2121
"lib": [
2222
"dom",

0 commit comments

Comments
 (0)