Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@
["transform-es2015-destructuring", { "loose": true }],
"transform-es2015-block-scoping",
"transform-object-rest-spread",
["transform-es2015-modules-commonjs", { "loose": true }],
"transform-react-jsx",
"syntax-jsx"
]
],
"env": {
"build": {
"plugins": [
"external-helpers"
]
},
"test": {
"plugins": [
"transform-es2015-modules-commonjs"
]
}
}
}
4 changes: 4 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ rules:
no-multi-assign: "off"

react/sort-comp: "off"
react/jsx-filename-extension:
- "error"
- extensions:
- "js"

import/no-extraneous-dependencies:
- "error"
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
language: node_js

node_js:
- 4
- 5
- 6
- 7
- "node"

script:
- yarn run validate
Expand All @@ -13,3 +10,6 @@ script:
branches:
only:
- master

cache:
yarn: true
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "An opinionated form validation tool for React apps",
"author": "Alex Fedoseev <alex.fedoseev@gmail.com> (https://github.com/alexfedoseev)",
"license": "MIT",
"main": "./lib/index.js",
"main": "lib/react-validation-layer.cjs.js",
"module": "lib/react-validation-layer.es.js",
"browser": "lib/react-validation-layer.umd.js",
"engines": {
"node": ">=4.2.0"
},
Expand All @@ -17,12 +19,13 @@
},
"scripts": {
"start": "yarn run clean && yarn run dev",
"dev": "babel --watch --out-dir lib src",
"build": "yarn run clean && yarn run build:lib && yarn run build:flow",
"build:lib": "babel --out-dir lib src",
"build:flow": "flow-copy-source -v src lib",
"lint": "eslint --ext .js,.jsx .",
"test": "jest --config .jest.json",
"dev": "BABEL_ENV=build BUILD_TARGET=cjs rollup --config --watch",
"build": "yarn run clean && yarn run build:es && yarn run build:cjs && yarn run build:umd",
"build:es": "BABEL_ENV=build BUILD_TARGET=es rollup --config",
"build:cjs": "BABEL_ENV=build BUILD_TARGET=cjs rollup --config",
"build:umd": "BABEL_ENV=build BUILD_TARGET=umd rollup --config",
"lint": "eslint .",
"test": "BABEL_ENV=test jest --config .jest.json",
"flow": "flow --show-all-errors",
"flow:up": "rm -rf flow-typed && flow-typed install",
"clean": "rm -rf lib",
Expand Down Expand Up @@ -50,6 +53,7 @@
"babel-core": "6.24.0",
"babel-jest": "19.0.0",
"babel-plugin-check-es2015-constants": "6.22.0",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-plugin-transform-class-properties": "6.23.0",
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
Expand Down Expand Up @@ -79,12 +83,16 @@
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-react": "6.10.3",
"flow-bin": "0.42.0",
"flow-copy-source": "1.1.0",
"flow-typed": "2.0.0",
"immutable": "3.8.1",
"jest": "19.0.2",
"react": "15.4.2",
"react-addons-test-utils": "15.4.2",
"react-dom": "15.4.2"
"react-dom": "15.4.2",
"rollup": "0.41.6",
"rollup-plugin-babel": "2.7.1",
"rollup-plugin-commonjs": "8.0.2",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-watch": "3.2.2"
}
}
25 changes: 25 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* @flow */

import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';

const { BUILD_TARGET } = process.env;

if (!BUILD_TARGET) {
throw new Error('Specify build target via BUILD_TARGET environment variable.');
}

export default {
entry: 'src/index.js',
format: BUILD_TARGET,
dest: `lib/react-validation-layer.${BUILD_TARGET}.js`,
moduleName: 'ReactValidationLayer',
external: ['react'],
globals: { react: 'React' },
plugins: [
babel({ exclude: 'node_modules/**' }),
resolve(),
commonjs(),
],
};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion website/src/examples/login-form/LoginForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import email from './fields/email';
import password from './fields/password';

import ValidationLayer from '../../../../../lib';
import ValidationLayer from '../../../../../lib/react-validation-layer.cjs';

const LoginForm = ({ loginData, updateFormState, submitForm }) => (
<ValidationLayer
Expand Down
2 changes: 1 addition & 1 deletion website/src/examples/signup-form/SignupForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import email from './fields/email';
import password from './fields/password';
import passwordConfirmation from './fields/passwordConfirmation';

import ValidationLayer from '../../../../../lib';
import ValidationLayer from '../../../../../lib/react-validation-layer.cjs';

const SignupForm = ({ signupData, updateFormState, submitForm }) => (
<ValidationLayer
Expand Down
Loading