diff --git a/package.json b/package.json index d664479..ac3d3e3 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,29 @@ { "name": "react-final-form-html5-validation", "version": "1.0.0", - "description": - "A swap-in replacement for 🏁 React Final Form's component to provide HTML5 Validation", + "description": "A swap-in replacement for 🏁 React Final Form's component to provide HTML5 Validation", "main": "dist/react-final-form-html5-validation.cjs.js", "jsnext:main": "dist/react-final-form-html5-validation.es.js", "module": "dist/react-final-form-html5-validation.es.js", "sideEffects": false, - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "start": "nps", "test": "nps test", "precommit": "lint-staged && npm start validate" }, - "author": - "Erik Rasmussen (http://github.com/erikras)", + "author": "Erik Rasmussen (http://github.com/erikras)", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/final-form/react-final-form-html5-validation.git" }, "bugs": { - "url": - "https://github.com/final-form/react-final-form-html5-validation/issues" + "url": "https://github.com/final-form/react-final-form-html5-validation/issues" }, - "homepage": - "https://github.com/final-form/react-final-form-html5-validation#readme", + "homepage": "https://github.com/final-form/react-final-form-html5-validation#readme", "devDependencies": { "babel-eslint": "^8.2.2", "babel-jest": "^22.4.1", @@ -71,13 +69,19 @@ "final-form": ">=4.0.0", "prop-types": "^15.6.0", "react": "^15.3.0 || ^16.0.0-0", + "react-dom": "^15.3.0 || ^16.0.0-0", "react-final-form": ">=3.0.0" }, "jest": { - "setupFiles": ["raf/polyfill"] + "setupFiles": [ + "raf/polyfill" + ] }, "lint-staged": { - "*.{js*,ts*,json,md,css}": ["prettier --write", "git add"] + "*.{js*,ts*,json,md,css}": [ + "prettier --write", + "git add" + ] }, "bundlesize": [ { diff --git a/rollup.config.js b/rollup.config.js index 03e08de..bcabb13 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,6 +4,7 @@ import flow from 'rollup-plugin-flow' import commonjs from 'rollup-plugin-commonjs' import uglify from 'rollup-plugin-uglify' import replace from 'rollup-plugin-replace' +import pkg from './package.json' const minify = process.env.MINIFY const format = process.env.FORMAT @@ -41,6 +42,9 @@ if (es) { throw new Error('no format specified. --environment FORMAT:xxx') } +const deps = Object.keys(pkg.dependencies || {}) +const peers = Object.keys(pkg.peerDependencies || {}) + export default { input: 'src/index.js', output: Object.assign( @@ -49,6 +53,7 @@ export default { exports: 'named', globals: { react: 'React', + 'react-dom': 'ReactDOM', 'prop-types': 'PropTypes', 'final-form': 'FinalForm', 'react-final-form': 'ReactFinalForm' @@ -56,11 +61,11 @@ export default { }, output ), - external: ['react', 'prop-types', 'final-form', 'react-final-form'], + external: umd ? peers : deps.concat(peers), plugins: [ resolve({ jsnext: true, main: true }), flow(), - commonjs({ include: 'node_modules/**' }), + umd && commonjs({ include: 'node_modules/**' }), babel({ exclude: 'node_modules/**', babelrc: false,