forked from pravindia/react-hammerjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now using babel and rollup, based on react-select
- Loading branch information
Showing
5 changed files
with
116 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"browsers": ["last 2 versions", "ie 10"] | ||
} | ||
} | ||
], | ||
"react" | ||
], | ||
"plugins": ["transform-class-properties"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
extends: ['keystone-react'], | ||
rules: { 'space-before-function-paren': 'off' }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ coverage | |
|
||
# Dependency directory | ||
node_modules | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import { minify } from 'uglify-es'; | ||
|
||
const name = 'Hammer'; | ||
const input = 'src/Hammer.js'; | ||
const output = 'dist/react-hammerjs'; | ||
const globals = { | ||
'prop-types': 'PropTypes', | ||
'react-dom': 'ReactDOM', | ||
react: 'React', | ||
}; | ||
const external = Object.keys(globals); | ||
const babelOptions = production => { | ||
let result = { | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
'env', | ||
{ | ||
modules: false, | ||
targets: { | ||
browsers: ['last 2 versions', 'ie 10'], | ||
}, | ||
}, | ||
], | ||
'react', | ||
], | ||
plugins: ['transform-class-properties'], | ||
}; | ||
if (production) { | ||
result.plugins.push('transform-react-remove-prop-types'); | ||
} | ||
return result; | ||
}; | ||
|
||
export default [ | ||
{ | ||
input: input, | ||
output: { | ||
file: output + '.es.js', | ||
format: 'es', | ||
}, | ||
external: external, | ||
plugins: [babel(babelOptions(false))], | ||
}, | ||
{ | ||
input: input, | ||
output: { | ||
name: name, | ||
file: output + '.js', | ||
format: 'umd', | ||
}, | ||
globals: globals, | ||
external: external, | ||
plugins: [babel(babelOptions(false)), resolve()], | ||
}, | ||
{ | ||
input: input, | ||
output: { | ||
name: name, | ||
file: output + '.min.js', | ||
format: 'umd', | ||
}, | ||
globals: globals, | ||
external: external, | ||
plugins: [babel(babelOptions(true)), resolve(), uglify({}, minify)], | ||
}, | ||
]; |