ocrcc-chatbox/README.md

109 lines
3.5 KiB
Markdown
Raw Normal View History

<div align="center">
<h1>Embeddable React Widget</h1>
Easy creation of embeddable widgets - https://seriousben.github.io/embeddable-react-widget
2018-05-26 18:53:54 +00:00
2018-06-03 15:05:02 +00:00
[![CircleCI](https://circleci.com/gh/seriousben/embeddable-react-widget.svg?style=shield)](https://circleci.com/gh/seriousben/embeddable-react-widget)
[![codecov](https://codecov.io/gh/seriousben/embeddable-react-widget/branch/master/graph/badge.svg)](https://codecov.io/gh/seriousben/embeddable-react-widget)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
2018-05-30 02:14:07 +00:00
</div>
2018-05-26 18:53:54 +00:00
## Features
* Full ES6/ES2015 support (with Babel)
2018-06-03 15:02:07 +00:00
* Package fonts, css, json, javascripts together into one single package (with Webpack)
* No css styling conflicts between the host page and the widget (with https://github.com/premasagar/cleanslate)
2018-06-03 20:05:21 +00:00
* Bookmarklet supported for fast testing and demonstration
2018-05-28 01:31:47 +00:00
* User theming of widget
2018-05-26 18:53:54 +00:00
* Obfuscating of the widget code
2018-06-03 15:15:23 +00:00
* Unit Tested with code coverage enabled
* Continuous Integration ready
2018-05-26 18:53:54 +00:00
## Demo
2019-04-27 13:04:32 +00:00
<img width="600px" src="./bookmarklet-flow.gif" />
2018-06-03 15:15:23 +00:00
## Running the widget
2018-05-26 18:53:54 +00:00
2018-06-03 15:15:23 +00:00
### Install dependencies
2018-05-26 18:53:54 +00:00
2018-06-03 15:15:23 +00:00
```sh
$ npm install
```
2018-05-26 18:53:54 +00:00
2018-06-03 15:15:23 +00:00
### Start the development server
```sh
$ npm start
... server running at http://localhost:8080/
```
### Run tests
```
$ npm test
... test output
```
### Production build
```
$ npm run build
... create files in /dist
```
2018-05-26 18:53:54 +00:00
## Roadmap
2018-05-28 01:31:47 +00:00
- [x] Widget as react app - index.html works (webpack, babel, react)
2018-05-30 01:56:01 +00:00
- [x] React widget (widget builder)
- [x] Webpack changed to output a library
- [x] Add tests
2018-06-03 15:15:23 +00:00
- [x] Add circleci integration
- [x] Add codecov integration for codecoverage
2018-05-31 00:45:33 +00:00
- [x] Production Build
- [x] Minified
2018-06-03 15:02:07 +00:00
- [x] Add greenkeeper
2018-06-03 20:05:21 +00:00
- [x] Bookmarklet
2018-06-09 13:50:36 +00:00
- [x] Reset / Cleanslate / No-conflicts of styles
- [x] Obfuscation
2018-05-28 01:31:47 +00:00
- [ ] Theming support
- [ ] Storyboard and docs
2018-06-09 13:50:36 +00:00
- [ ] Integrate eslint with webpack
2018-05-26 18:53:54 +00:00
2018-06-03 15:15:23 +00:00
## Background
### What is an embeddable widget?
* Usable using a simple `<script>` tag
* Configurable with code
* Themable
### Why not in an iframe?
* Interaction between the frame and the hosting page is tricky and not recommended
* You can only display content within the iframe
* iframe and content resizing is impossible
* iframe sandboxing can result in missing functionalities
### Read more
Read more about about widgets, react and scoping of css.
* https://www.robinwieruch.de/minimal-react-webpack-babel-setup/#hot-module-replacement
* https://codeburst.io/building-react-widget-libraries-using-webpack-e0a140c16ce4
* https://github.com/timarney/react-app-rewired
2018-05-26 18:53:54 +00:00
* https://github.com/premasagar/cleanslate
* https://github.com/krasimir/third-party-react-widget
* https://github.com/jenyayel/js-widget
* https://github.com/anakinjay/react-widget-starter
* https://webpack.js.org/guides/author-libraries/
* https://github.com/webpack-contrib/webpack-serve
* https://medium.freecodecamp.org/part-1-react-app-from-scratch-using-webpack-4-562b1d231e75
* https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.prod.js
* https://github.com/webpack-contrib/purifycss-webpack
* https://medium.com/quick-code/from-zero-to-deploy-set-up-react-stack-with-webpack-3-20b57d6cb8d7
* https://medium.com/dailyjs/building-a-react-component-with-webpack-publish-to-npm-deploy-to-github-guide-6927f60b3220
* http://krasimirtsonev.com/blog/article/javascript-library-starter-using-webpack-es6
* https://github.com/javascript-obfuscator/webpack-obfuscator
* https://github.com/tsileo/embedded-js-widget
* https://thomassileo.name/blog/2014/03/27/building-an-embeddable-javascript-widget-third-party-javascript/