Skip to content

Commit 6f922ec

Browse files
committed
Clean up for improved consistency
1 parent e899b61 commit 6f922ec

File tree

7 files changed

+43
-44
lines changed

7 files changed

+43
-44
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ os:
44
- linux
55
- windows
66
node_js:
7-
- '4'
87
- '5'
98
- '6'
109
- 'stable'
1110
script:
1211
- npm run lint
13-
- npm run test:typings
14-
- npm run test
12+
- npm run test:all
1513
cache:
1614
directories:
1715
- node_modules

example/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ReactDOM.render(
66
React.createElement(DateTime, {
77
viewMode: 'months',
88
dateFormat: 'MMMM',
9-
isValidDate: function(current){
9+
isValidDate: function(current) {
1010
return current.isBefore(DateTime.moment().startOf('month'));
1111
}
1212
}),

example/webpack.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
var path = require('path');
22

33
module.exports = {
4-
entry: [
5-
'webpack/hot/dev-server',
6-
'webpack-dev-server/client?http://localhost:8080',
7-
path.resolve(__dirname, 'example.js')
8-
],
4+
entry: [
5+
'webpack/hot/dev-server',
6+
'webpack-dev-server/client?http://localhost:8080',
7+
path.resolve(__dirname, 'example.js')
8+
],
99

10-
output: {
11-
path: path.resolve(__dirname, '.'),
12-
filename: 'bundle.js'
13-
},
14-
resolve: {
15-
extensions: ['', '.js']
16-
}
17-
}
10+
output: {
11+
path: path.resolve(__dirname, '.'),
12+
filename: 'bundle.js'
13+
},
14+
resolve: {
15+
extensions: ['', '.js']
16+
}
17+
};

gulpfile.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
var gulp = require('gulp'),
2-
uglify = require('gulp-uglify'),
32
insert = require('gulp-insert'),
3+
uglify = require('gulp-uglify'),
44
webpack = require('gulp-webpack')
55
;
66

77
var packageName = 'react-datetime';
88
var pack = require( './package.json' );
99

10-
var getWPConfig = function( filename ){
10+
var getWPConfig = function( filename ) {
1111
return {
1212
externals: {
1313
react: 'React',
@@ -22,28 +22,28 @@ var getWPConfig = function( filename ){
2222
};
2323
};
2424

25-
var cr = ('/*\n%%name%% v%%version%%\n%%homepage%%\n%%license%%: https://github.com/arqex/' + packageName + '/raw/master/LICENSE\n*/\n')
25+
var cr = ( '/*\n%%name%% v%%version%%\n%%homepage%%\n%%license%%: https://github.com/arqex/' + packageName + '/raw/master/LICENSE\n*/\n' )
2626
.replace( '%%name%%', pack.name)
2727
.replace( '%%version%%', pack.version)
2828
.replace( '%%license%%', pack.license)
2929
.replace( '%%homepage%%', pack.homepage)
3030
;
3131

32-
var handleError = function( err ){
33-
console.log( 'Error: ', err );
32+
var handleError = function( err ) {
33+
console.error( 'Error:', err );
3434
};
3535

36-
function wp( config, minify ){
37-
var stream = gulp.src('./Datetime.js')
36+
function wp( config, minify ) {
37+
var stream = gulp.src( './Datetime.js' )
3838
.pipe( webpack( config ) )
3939
;
4040

41-
if( minify ){
41+
if( minify ) {
4242
stream = stream.pipe( uglify() ).on( 'error', handleError );
4343
}
4444

4545
return stream.pipe( insert.prepend( cr ) )
46-
.pipe( gulp.dest('dist/') )
46+
.pipe( gulp.dest( 'dist/' ) )
4747
;
4848
}
4949

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
],
1919
"types": "./typings/index.d.ts",
2020
"scripts": {
21-
"build:win": "./node_modules/.bin/gulp.cmd",
2221
"build:mac": "./node_modules/.bin/gulp",
23-
"test": "node node_modules/mocha/bin/mocha tests",
24-
"test:watch": "node node_modules/mocha/bin/mocha --watch tests",
25-
"dev": "webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example",
22+
"build:win": "./node_modules/.bin/gulp.cmd",
23+
"dev": "./node_modules/.bin/webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example",
2624
"lint": "./node_modules/.bin/eslint src/ DateTime.js",
27-
"test:typings": "tsc -p ./typings"
25+
"test": "node node_modules/mocha/bin/mocha tests",
26+
"test:all": "npm run test:typings && npm run test",
27+
"test:typings": "./node_modules/.bin/tsc -p ./typings",
28+
"test:watch": "node node_modules/mocha/bin/mocha --watch tests"
2829
},
2930
"keywords": [
3031
"react",
@@ -37,9 +38,9 @@
3738
"author": "Javier Marquez",
3839
"license": "MIT",
3940
"peerDependencies": {
41+
"moment": ">=2.16.0",
4042
"react": ">=0.13",
41-
"react-dom": ">=0.13",
42-
"moment": ">=2.16.0"
43+
"react-dom": ">=0.13"
4344
},
4445
"devDependencies": {
4546
"@types/react": "^0.14.49",
@@ -66,6 +67,6 @@
6667
},
6768
"pre-commit": [
6869
"lint",
69-
"test"
70+
"test:all"
7071
]
7172
}

tests/testdom.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
module.exports = function(markup) {
2-
if (typeof document !== 'undefined') return;
3-
var jsdom = require("jsdom").jsdom;
4-
global.document = jsdom(markup || '<!doctype html><html><body></body></html>');
5-
global.window = document.defaultView;
1+
module.exports = function( markup ) {
2+
if (typeof document !== 'undefined') return;
63

7-
global.navigator = global.window.navigator = {};
8-
navigator.userAgent = 'NodeJs JsDom';
9-
navigator.appVersion = '';
4+
var jsdom = require('jsdom').jsdom;
5+
global.document = jsdom(markup || '<!doctype html><html><body></body></html>');
6+
global.window = document.defaultView;
7+
global.navigator = global.window.navigator = {};
8+
navigator.userAgent = 'NodeJs JsDom';
9+
navigator.appVersion = '';
1010

11-
return document;
11+
return document;
1212
};

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var webpack = require('webpack');
22

33
var plugins = [
44
new webpack.DefinePlugin({
5-
'process.env': { NODE_ENV: '"production"'}
5+
'process.env': { NODE_ENV: '"production"'}
66
})
77
];
88

0 commit comments

Comments
 (0)