Skip to content

Commit

Permalink
feat: updated dependencies (#1855)
Browse files Browse the repository at this point in the history
* feat: updated dependencies

* feat: bumped eslint

* fix: build

* fix: docs

* fix: cleanup

* fix: warnings warning

* fix: tests

* fix: Cannot find module 'babel-helpers'

* fix: use latest firefox

* fix: cleanup

* fix: warning

* feat: cleanup

* fix: readded .flowconfig

* feat: added mocha reporter

* fix: unit tests

* fix: added npm cache

* fix: cleanup babelrc config

* feat: reduce bundle size of docs
  • Loading branch information
mxschmitt authored and martijnrusschen committed Aug 22, 2019
1 parent 45a18ac commit 91db4f0
Show file tree
Hide file tree
Showing 33 changed files with 5,065 additions and 3,134 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

52 changes: 13 additions & 39 deletions .babelrc.js
@@ -1,45 +1,19 @@
var NODE_ENV = process.env.NODE_ENV;
var MODULES = process.env.MODULES;
const { NODE_ENV, MODULES } = process.env;

var modules = MODULES === "false" || NODE_ENV === "test" ? "commonjs" : false;
const modules = MODULES === "false" || NODE_ENV === "test" ? "commonjs" : false;

var config = {
presets: [
[
"env",
{
loose: true,
modules: modules,
forceAllTransforms: NODE_ENV === "production"
}
],
"stage-0",
"react"
],
plugins: []
};

if (NODE_ENV === "development") {
config.plugins = config.plugins.concat([
"transform-class-properties",
[
"react-transform",
{
transforms: [
{
transform: "react-transform-hmr",
imports: ["react"],
locals: ["module"]
}
]
}
],
"add-react-displayname"
]);
}
const presets = [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-flow"
];
const plugins = [
"@babel/plugin-transform-react-jsx",
"@babel/plugin-proposal-class-properties"
];

if (NODE_ENV === "production") {
config.plugins = config.plugins.concat(["transform-react-remove-prop-types"]);
plugins.push("transform-react-remove-prop-types");
}

module.exports = config;
module.exports = { presets, plugins };
110 changes: 100 additions & 10 deletions .gitignore
@@ -1,20 +1,110 @@
node_modules
.sass-cache
npm-debug.log
.DS_Store
.idea
.vscode
.history
# Created by https://www.gitignore.io/api/node
# Edit at https://www.gitignore.io/?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# End of https://www.gitignore.io/api/node

dist
lib
es
tmp
coverage
docs-site/bundle.js
docs-site/style.css

.vscode
*.iml
.idea

docs-site/*bundle.js
docs-site/style.css

docs/calendar.md
docs/date_input.md
docs/day.md
Expand Down
6 changes: 5 additions & 1 deletion .travis.yml
@@ -1,7 +1,9 @@
language: node_js
node_js:
- "node"
cache: yarn
cache:
- npm
- yarn
script:
- yarn lint
- yarn test
Expand All @@ -15,6 +17,8 @@ deploy:
local_dir: docs-site
on:
branch: master
addons:
firefox: latest
notifications:
slack:
secure: kAmrLltV0ZLuhl6rKk26fDLGuoCch6AYaObRQje4UZlxVQjR2467k430vOZLqv39Mr3U5XmYl6VLcCGmBr3tjM/9c1zjoXnRT8MRy4eIYaUr/thXeh2FlfHKOk8rXnNOoRZ1kBsCzCDFCNDYZZA4jya8S5ITcQyGyYcOqBWVy1w=
15 changes: 5 additions & 10 deletions README.md
Expand Up @@ -32,19 +32,15 @@ import "react-datepicker/dist/react-datepicker.css";
// import 'react-datepicker/dist/react-datepicker-cssmodules.css';

class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
startDate: new Date()
};
this.handleChange = this.handleChange.bind(this);
}
state = {
startDate: new Date()
};

handleChange(date) {
handleChange = date => {
this.setState({
startDate: date
});
}
};

render() {
return (
Expand Down Expand Up @@ -117,7 +113,6 @@ registerLocale('es', es)
Locales can be changed in the following way:

- **Globally** - `setDefaultLocale('es');`


## Compatibility

Expand Down
2 changes: 2 additions & 0 deletions docs-site/src/boot.jsx
@@ -1,3 +1,5 @@
import "core-js/stable";

import React from "react";
import ReactDOM from "react-dom";
import Root from "./root";
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/example_components.jsx
@@ -1,5 +1,6 @@
import React from "react";
import hljs from "highlight.js";
import hljs from "highlight.js/lib/highlight";
import hljsJavaScriptLanguage from "highlight.js/lib/languages/javascript";
import Default from "./examples/default";
import CodeExampleComponent from "./code_example_component";

Expand Down Expand Up @@ -66,6 +67,7 @@ import "./style.scss";
export default class exampleComponents extends React.Component {
componentDidMount() {
hljs.initHighlightingOnLoad();
hljs.registerLanguage("javascript", hljsJavaScriptLanguage);
}

examples = [
Expand Down
File renamed without changes
File renamed without changes
8 changes: 6 additions & 2 deletions docs-site/src/root.jsx
Expand Up @@ -17,7 +17,7 @@ export default class Root extends React.Component {
<a href="https://hackerone.com" className="hero__crafted-by-link">
Crafted by{" "}
<img
src="images/logo.png"
src="src/images/logo.png"
className="hero__image"
alt="HackerOne"
title="HackerOne"
Expand Down Expand Up @@ -71,6 +71,10 @@ export default class Root extends React.Component {
<p>
<code>npm install react-datepicker --save</code>
</p>
<p>Or by using Yarn:</p>
<p>
<code>yarn add react-datepicker</code>
</p>
</div>
<div className="wrapper">
<ExampleComponents />
Expand All @@ -79,7 +83,7 @@ export default class Root extends React.Component {
<a href="https://github.com/Hacker0x01/react-datepicker/">
<img
className="github-ribbon"
src="images/ribbon.png"
src="src/images/ribbon.png"
alt="Fork me on GitHub"
/>
</a>
Expand Down
22 changes: 10 additions & 12 deletions karma.conf.js
@@ -1,42 +1,40 @@
// Karma configuration
// Generated on Tue Jul 28 2015 16:29:51 GMT+0200 (CEST)
var webpack = require("webpack");
var path = require("path");

var CONTINUOUS_INTEGRATION = process.env.CONTINUOUS_INTEGRATION === "true";
const webpack = require("webpack");
const path = require("path");

module.exports = function(config) {
config.set({
frameworks: ["mocha", "sinon", "chai"],

browsers: ["FirefoxHeadless"],

singleRun: CONTINUOUS_INTEGRATION,

files: ["test/index.js"],

preprocessors: {
"test/index.js": ["webpack", "sourcemap"]
},

reporters: ["dots", "coverage"],
reporters: ["mocha", "coverage"],

webpack: {
mode: "development",
devtool: "inline-source-map",
module: {
loaders: [
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel",
loader: "babel-loader",
query: {
presets: ["airbnb"]
}
},
{
test: /\.jsx?$/,
include: path.resolve(__dirname, "src"),
loader: "isparta"
loader: "istanbul-instrumenter-loader",
enforce: "post",
options: { esModules: true }
}
]
},
Expand All @@ -46,7 +44,7 @@ module.exports = function(config) {
})
],
resolve: {
extensions: ["", ".jsx", ".js"]
extensions: [".jsx", ".js"]
},
externals: {
cheerio: "window",
Expand Down

0 comments on commit 91db4f0

Please sign in to comment.