Clean up for improved consistency
| | |
| | | - linux |
| | | - windows |
| | | node_js: |
| | | - '4' |
| | | - '5' |
| | | - '6' |
| | | - 'stable' |
| | | script: |
| | | - npm run lint |
| | | - npm run test:typings |
| | | - npm run test |
| | | - npm run test:all |
| | | cache: |
| | | directories: |
| | | - node_modules |
| | |
| | | React.createElement(DateTime, { |
| | | viewMode: 'months', |
| | | dateFormat: 'MMMM', |
| | | isValidDate: function(current){ |
| | | isValidDate: function(current) { |
| | | return current.isBefore(DateTime.moment().startOf('month')); |
| | | } |
| | | }), |
| | |
| | | var path = require('path'); |
| | | |
| | | module.exports = { |
| | | entry: [ |
| | | 'webpack/hot/dev-server', |
| | | 'webpack-dev-server/client?http://localhost:8080', |
| | | path.resolve(__dirname, 'example.js') |
| | | ], |
| | | entry: [ |
| | | 'webpack/hot/dev-server', |
| | | 'webpack-dev-server/client?http://localhost:8080', |
| | | path.resolve(__dirname, 'example.js') |
| | | ], |
| | | |
| | | output: { |
| | | path: path.resolve(__dirname, '.'), |
| | | filename: 'bundle.js' |
| | | }, |
| | | resolve: { |
| | | extensions: ['', '.js'] |
| | | } |
| | | } |
| | | output: { |
| | | path: path.resolve(__dirname, '.'), |
| | | filename: 'bundle.js' |
| | | }, |
| | | resolve: { |
| | | extensions: ['', '.js'] |
| | | } |
| | | }; |
| | |
| | | var gulp = require('gulp'), |
| | | uglify = require('gulp-uglify'), |
| | | insert = require('gulp-insert'), |
| | | uglify = require('gulp-uglify'), |
| | | webpack = require('gulp-webpack') |
| | | ; |
| | | |
| | | var packageName = 'react-datetime'; |
| | | var pack = require( './package.json' ); |
| | | |
| | | var getWPConfig = function( filename ){ |
| | | var getWPConfig = function( filename ) { |
| | | return { |
| | | externals: { |
| | | react: 'React', |
| | |
| | | }; |
| | | }; |
| | | |
| | | var cr = ('/*\n%%name%% v%%version%%\n%%homepage%%\n%%license%%: https://github.com/arqex/' + packageName + '/raw/master/LICENSE\n*/\n') |
| | | var cr = ( '/*\n%%name%% v%%version%%\n%%homepage%%\n%%license%%: https://github.com/arqex/' + packageName + '/raw/master/LICENSE\n*/\n' ) |
| | | .replace( '%%name%%', pack.name) |
| | | .replace( '%%version%%', pack.version) |
| | | .replace( '%%license%%', pack.license) |
| | | .replace( '%%homepage%%', pack.homepage) |
| | | ; |
| | | |
| | | var handleError = function( err ){ |
| | | console.log( 'Error: ', err ); |
| | | var handleError = function( err ) { |
| | | console.error( 'Error:', err ); |
| | | }; |
| | | |
| | | function wp( config, minify ){ |
| | | var stream = gulp.src('./Datetime.js') |
| | | function wp( config, minify ) { |
| | | var stream = gulp.src( './Datetime.js' ) |
| | | .pipe( webpack( config ) ) |
| | | ; |
| | | |
| | | if( minify ){ |
| | | if( minify ) { |
| | | stream = stream.pipe( uglify() ).on( 'error', handleError ); |
| | | } |
| | | |
| | | return stream.pipe( insert.prepend( cr ) ) |
| | | .pipe( gulp.dest('dist/') ) |
| | | .pipe( gulp.dest( 'dist/' ) ) |
| | | ; |
| | | } |
| | | |
| | |
| | | ], |
| | | "types": "./typings/index.d.ts", |
| | | "scripts": { |
| | | "build:win": "./node_modules/.bin/gulp.cmd", |
| | | "build:mac": "./node_modules/.bin/gulp", |
| | | "test": "node node_modules/mocha/bin/mocha tests", |
| | | "test:watch": "node node_modules/mocha/bin/mocha --watch tests", |
| | | "dev": "webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example", |
| | | "build:win": "./node_modules/.bin/gulp.cmd", |
| | | "dev": "./node_modules/.bin/webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example", |
| | | "lint": "./node_modules/.bin/eslint src/ DateTime.js", |
| | | "test:typings": "tsc -p ./typings" |
| | | "test": "node node_modules/mocha/bin/mocha tests", |
| | | "test:all": "npm run test:typings && npm run test", |
| | | "test:typings": "./node_modules/.bin/tsc -p ./typings", |
| | | "test:watch": "node node_modules/mocha/bin/mocha --watch tests" |
| | | }, |
| | | "keywords": [ |
| | | "react", |
| | |
| | | "author": "Javier Marquez", |
| | | "license": "MIT", |
| | | "peerDependencies": { |
| | | "moment": ">=2.16.0", |
| | | "react": ">=0.13", |
| | | "react-dom": ">=0.13", |
| | | "moment": ">=2.16.0" |
| | | "react-dom": ">=0.13" |
| | | }, |
| | | "devDependencies": { |
| | | "@types/react": "^0.14.49", |
| | |
| | | }, |
| | | "pre-commit": [ |
| | | "lint", |
| | | "test" |
| | | "test:all" |
| | | ] |
| | | } |
| | |
| | | module.exports = function(markup) { |
| | | if (typeof document !== 'undefined') return; |
| | | var jsdom = require("jsdom").jsdom; |
| | | global.document = jsdom(markup || '<!doctype html><html><body></body></html>'); |
| | | global.window = document.defaultView; |
| | | module.exports = function( markup ) { |
| | | if (typeof document !== 'undefined') return; |
| | | |
| | | global.navigator = global.window.navigator = {}; |
| | | navigator.userAgent = 'NodeJs JsDom'; |
| | | navigator.appVersion = ''; |
| | | var jsdom = require('jsdom').jsdom; |
| | | global.document = jsdom(markup || '<!doctype html><html><body></body></html>'); |
| | | global.window = document.defaultView; |
| | | global.navigator = global.window.navigator = {}; |
| | | navigator.userAgent = 'NodeJs JsDom'; |
| | | navigator.appVersion = ''; |
| | | |
| | | return document; |
| | | return document; |
| | | }; |
| | |
| | | |
| | | var plugins = [ |
| | | new webpack.DefinePlugin({ |
| | | 'process.env': { NODE_ENV: '"production"'} |
| | | 'process.env': { NODE_ENV: '"production"'} |
| | | }) |
| | | ]; |
| | | |