diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..23c967c --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "env": { + "es6": true, + "browser": true + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + } + }, + "extends": "airbnb", + "rules": { + "no-console": 0, + "no-unused-vars": 1, + "no-undef": 0, + "prefer-arrow-callback": 1, + "no-nested-ternary": 0, + "max-len": 0, + "react/jsx-no-bind":0 + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2582a1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +node_modules/ +.DS_store \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2254c8f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Pigs in Flight, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 087afa1..1951579 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ -# bebo-react \ No newline at end of file +# bebo-react + +A wrap react + +## Get it + +```npm install bebo-react --save``` + +## Usage + +```jsx +import React from 'react'; +import BeboReact from './js/utils/bebo-react'; +import App from './js/components/App'; + +import './style.scss'; +BeboReact.render( + , + document.getElementById('app'), + { + disableKeyboardDoneStrip: true + } +); +``` \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..0712c6b --- /dev/null +++ b/dist/index.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactSimpleFetch=t(require("react"),require("react-dom")):e.ReactSimpleFetch=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return e.displayName||e.name||"Component"}function i(e){var t=p["default"].createClass({displayName:"WithBebo",render:function(){return Bebo?p["default"].createElement(e,u({},this.props,{bebo:Bebo})):console.error("Bebo is not defined yet...")}});return t.displayName="withBebo("+a(e)+")",t.WrappedComponent=e,(0,b["default"])(t,e)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r + } + return console.error('Bebo is not defined yet...'); + + + } + }); + + WithBebo.displayName = `withBebo(${getDisplayName(WrappedComponent)})`; + WithBebo.WrappedComponent = WrappedComponent; + + return hoistStatics(WithBebo, WrappedComponent) +} + +export default new class BeboDOM { + constructor (){ + // eslint-disable-next-line + this.bebo = Bebo; + } + + render(component, element, beboOptions) { + this.bebo.onReady(() => { + const { disableKeyboardDoneStrip } = beboOptions; + if(disableKeyboardDoneStrip) { + // eslint-disable-next-line + Bebo.UI.disableKeyboardDoneStrip(); + } + ReactDOM.render(component, element); + }) + } +} \ No newline at end of file diff --git a/webpack.build.config.js b/webpack.build.config.js new file mode 100644 index 0000000..cea1a93 --- /dev/null +++ b/webpack.build.config.js @@ -0,0 +1,52 @@ +var webpack = require('webpack'); +var path = require('path'); + +var plugins = [ + new webpack.optimize.DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + '__DEV__': false, + 'process.env': { + NODE_ENV: JSON.stringify('production'), + }, + }), +]; +plugins.push(new webpack.optimize.UglifyJsPlugin()); + + +module.exports = { + entry: path.resolve(__dirname, './src/bebo-react.js'), + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + libraryTarget: 'umd', + library : 'ReactSimpleFetch', + }, + externals: { + 'react': { + commonjs: 'react', + commonjs2: 'react', + amd: 'react', + root: 'React' + }, + 'react-dom': { + commonjs: 'react-dom', + commonjs2: 'react-dom', + amd: 'react-dom', + root: 'ReactDOM' + } + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel-loader', + exclude: /node_modules/, + query: { + presets: ['es2015', 'react'] + } + }, + ], + }, + plugins: plugins, +}; \ No newline at end of file diff --git a/webpack.dev.config.js b/webpack.dev.config.js new file mode 100644 index 0000000..bddeaf3 --- /dev/null +++ b/webpack.dev.config.js @@ -0,0 +1,31 @@ +var path = require('path'); + +module.exports = { + entry: path.resolve(__dirname, './src/bebo-react.js'), + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + libraryTarget: 'umd', + library: 'ReactSimpleFetch', + }, + externals: { + react: { + commonjs: 'react', + commonjs2: 'react', + amd: 'react', + root: 'React', + }, + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel-loader', + exclude: /node_modules/, + query: { + presets: ['es2015', 'react'], + }, + }, + ], + }, +}; \ No newline at end of file