react_rails_webpack 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b2f3a48acfa2f14f5d1e3895c7b01c4a7d2303d
4
- data.tar.gz: 2c4d4681099d46fe71be6ce89f4e2268bb4deca5
3
+ metadata.gz: 7df79ab8898ae43bbf479c52485fcb82f9c54417
4
+ data.tar.gz: 22713d477ca4b524ff22c71f916699d3929cf81b
5
5
  SHA512:
6
- metadata.gz: 913cb3241d660098233b46f58d7720ffaddc763f851428e03f24d8d5f1bc4e6d3ed97e9ed4a3ba5b2e2e529435ffac087d5ea1a9fbbe3c466972b4cd324b2b07
7
- data.tar.gz: 092242a9d94a1c01e8d5b08fd72fb57ecfb3e214bd5c9446e9f5e0b0fbb99332d95f06f48ada69d1e6c8cf4d05f39dd02969fd0453a869c0562ab857f82dac74
6
+ metadata.gz: a8001cad731cedcab5c09aef6130ce80613e94911b0c798a59d86362d4d95d5baadeea65312507937a2e1bf2956b0c9cb47afa8ca02079a68d2185ad26f7e56f
7
+ data.tar.gz: e2c25167f5ad6e448e032954b5f8c11c4e6e96db3621e1538fceee08edd625aac03f05f2e4cc9f2299c1a734bffff06d00210bf63eb3bcf5d77232b6550c384e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Changelog
2
2
 
3
+ ### 3.1.0
4
+ - Improve look of example components
5
+ - Add examples of using Font Awesome and image files
6
+
3
7
  ### 3.0.1
4
8
  - Add react-hmre preset to development environment in .babelrc file
5
9
 
@@ -12,4 +16,8 @@
12
16
  - Depend on main hjs-webpack repo instead of customized fork (UglifyJS options enabled this)
13
17
  - Add .babelrc file
14
18
  - Correct broken redux test
15
- - Start keeping a changelog
19
+ - Start keeping a changelog
20
+
21
+ **To upgrade to version 3**, update the gem version in your `Gemfile` to version 3, run `bundle install`, delete the `client/node_modules` directory, and run the `rails g react_rails_webpack:install` generator command again, and when it asks, refuse to overwrite the `availableComponents.js` file and any React component files you've changed.
22
+
23
+ There are some important changes to `webpack.config.js` for version 3, so if you've made changes to that file (for example, if you've written your own components and added divs for them to the `html` option), save them somewhere else before running the generator, then let the generator overwrite that file, and copy and paste the changes you made back into the new file after the generator finishes.
data/FEATURES.md ADDED
@@ -0,0 +1,11 @@
1
+ # All Features
2
+
3
+ 1. One-command setup
4
+ 2. Use any packages from the [npm](https://www.npmjs.com) ecosystem
5
+ 3. Built-in examples of plain and [redux](http://redux.js.org)-backed React components
6
+ 4. The [webpack](https://webpack.github.io) development server for React components will live update your changes to any device on your local network (including phones)
7
+ 5. Integrated with [hjs-webpack](https://github.com/HenrikJoreteg/hjs-webpack) to simplify webpack configuration ([video about hjs-webpack](http://learn.humanjavascript.com/react-ampersand/setting-up-webpack))
8
+ 6. Integration code is added directly to project, making it easy to read and modify
9
+ 7. Hot-reloading of components
10
+ 8. Built-in [Redux DevTools](https://github.com/gaearon/redux-devtools) integration for React-Redux components
11
+ 9. Built-in examples of [Redux](https://github.com/gaearon/redux-devtools) reducer testing using [Chai](http://chaijs.com)
data/README.md CHANGED
@@ -1,16 +1,23 @@
1
1
  # ReactRailsWebpack
2
+ [![Gem Version](https://badge.fury.io/rb/react_rails_webpack.svg)](https://badge.fury.io/rb/react_rails_webpack)
2
3
 
3
- Ruby gem for quickly and easily creating highly customizable react/rails integrations using webpack and npm.
4
+ > Warning: If you are upgrading across major versions, please read the [release notes in the changelog](CHANGELOG.md).
5
+
6
+ Ruby gem for quickly creating highly customizable react/rails integrations using webpack and npm.
4
7
 
5
8
  ## Key Features
6
9
 
7
10
  1. One-command setup
8
11
  2. Use any packages from the [npm](https://www.npmjs.com) ecosystem
9
12
  3. Built-in examples of plain and [redux](http://redux.js.org)-backed React components
10
- 4. The [webpack](https://webpack.github.io) development server for React components will live update your changes to any device on your local network (including phones)
13
+ 4. The [webpack](https://webpack.github.io) development server for React components will live update your changes to any device on your local network (including phones) (gif demo of this feature [here](images/rrw_demo_short.gif))
14
+
15
+ [more features...](FEATURES.md)
11
16
 
12
17
  ## Install
13
18
 
19
+ > Video demo of setup and use on a new Rails app [here](https://vimeo.com/180349372)
20
+
14
21
  1. Make sure you have the [requirements](#requirements) installed
15
22
  2. Add `gem 'react_rails_webpack'` to your Gemfile
16
23
  3. Run `bundle install`
Binary file
@@ -0,0 +1,13 @@
1
+ # I can't figure out a cleaner way to get font compilation
2
+ # to work than copying the compiled font files into the public
3
+ # directory. Without this copying step, the font filenames
4
+ # in the Webpack-generated CSS file won't match the filenames
5
+ # of the actual font files. Hoping for a better solution to
6
+ # this in the future.
7
+
8
+ require 'fileutils'
9
+
10
+ font_files = Dir.glob('../app/assets/webpack/*.{otf,eot,svg,ttf,woff,woff2}')
11
+ puts "Copying #{font_files.inspect} to public folder..."
12
+
13
+ FileUtils.cp font_files, '../public/'
@@ -6,6 +6,7 @@
6
6
  "scripts": {
7
7
  "start": "hjs-dev-server",
8
8
  "build": "NODE_ENV=production webpack",
9
+ "postbuild": "ruby copy_fonts.rb",
9
10
  "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js 'test/**/*.@(js|jsx)'"
10
11
  },
11
12
  "author": "",
@@ -24,6 +25,8 @@
24
25
  "chai": "^3.4.0",
25
26
  "chai-immutable": "^1.3.0",
26
27
  "css-loader": "^0.23.1",
28
+ "file-loader": "^0.9.0",
29
+ "font-awesome": "^4.6.3",
27
30
  "hjs-webpack": "^8.3.0",
28
31
  "jsdom": "^7.0.2",
29
32
  "mocha": "^2.3.3",
@@ -38,6 +41,7 @@
38
41
  "redux-devtools-log-monitor": "^1.0.11",
39
42
  "sass-loader": "^3.1.1",
40
43
  "style-loader": "^0.13.1",
44
+ "url-loader": "^0.5.7",
41
45
  "webpack": "^1.12.15"
42
46
  }
43
47
  }
@@ -2,7 +2,8 @@ import {
2
2
  renderReactComponentInDiv, renderLastComponentDiv
3
3
  } from './app/renderingComponentsInDivs'
4
4
 
5
- import './app.sass'
5
+ import './app.sass' // Require your styling files this way
6
+
6
7
  import injectTapEventPlugin from 'react-tap-event-plugin'
7
8
 
8
9
  injectTapEventPlugin()
@@ -1,14 +1,41 @@
1
+ // This file is included in the project by being required in the app.js file
1
2
  .bordered-component
2
- border: 2px solid gray
3
+ border: 4px solid gray
3
4
  border-radius: 10px
4
5
  margin: 10px 20px
5
6
  padding: 20px 40px
7
+ word-wrap: break-word
8
+ background-color: rgba(black, 0.05)
6
9
 
7
10
  h2
11
+ text-align: center
8
12
  margin-top: 0
9
13
 
14
+ .info-block
15
+ display: inline-block
16
+ margin: 4px 7px
17
+
18
+ .source
19
+ font-style: italic
20
+ font-size: 15px
21
+ color: rgba(black, 0.7)
22
+ text-align: center
23
+ margin-bottom: 15px
24
+
25
+ code
26
+ font-weight: bold
27
+
28
+ i
29
+ margin-left: 4px
30
+
10
31
  aside.source
11
32
  text-align: center
12
33
  color: darkblue
13
34
  font-size: 20px
14
- margin: 20px 0 35px
35
+ margin: 20px 0 35px
36
+
37
+ .react-logo
38
+ width: 40px
39
+ margin-bottom: -13px
40
+ margin-right: 10px
41
+ border-radius: 50%
@@ -0,0 +1,22 @@
1
+ // Here are some examples of other features
2
+ // written into some React components
3
+ // defined purely as functions. You can do
4
+ // components this way if they're simple
5
+ // enough.
6
+
7
+ import React from 'react'
8
+
9
+ // USING IMAGES EXAMPLE COMPONENT
10
+ import reactImageUrl from '../images/react_logo.svg'
11
+
12
+ export const ReactLogo = () =>
13
+ <img className='react-logo' src={reactImageUrl} />
14
+
15
+ // USING FONT AWESOME ICONS EXAMPLE COMPONENT
16
+ // Icon list here: http://fontawesome.io/icons/
17
+ import 'font-awesome/scss/font-awesome.scss'
18
+
19
+ export const Icon = (props) =>
20
+ <i className={'fa fa-' + props.icon}></i>
21
+
22
+ Icon.propTypes = { icon: React.PropTypes.string.isRequired }
@@ -1,5 +1,7 @@
1
1
  import React from 'react'
2
2
 
3
+ import {ReactLogo, Icon} from './FeatureWidgets'
4
+
3
5
  export default React.createClass({
4
6
  propTypes: {
5
7
  details: React.PropTypes.string.isRequired
@@ -9,12 +11,17 @@ export default React.createClass({
9
11
  },
10
12
  render () {
11
13
  return <div className='bordered-component'>
12
- <h2>This is the "Hello" component from 'client/src/components/Hello.jsx'</h2>
13
- <p><strong>Details</strong>: {this.props.details}</p>
14
- <p>Current greeting: {this.state.greeting}</p>
14
+ <h2><ReactLogo /> This is the Hello component</h2>
15
+ <div className='source'>from the <code>Hello.jsx</code> file in <Icon icon='folder-open' /> <code>client/src/components</code></div>
16
+
17
+ <div className='info-block'>
18
+ <label htmlFor='greeting'><strong>Change greeting</strong>: </label>
19
+ <input type='text' id='greeting' value={this.state.greeting} onChange={(e) => this.setState({ greeting: e.target.value })}/>
20
+ </div>
21
+
22
+ <div className='info-block'><strong>Current greeting</strong>: {this.state.greeting}</div>
15
23
 
16
- <label htmlFor='greeting'>Change the greeting here: </label>
17
- <input type='text' id='greeting' value={this.state.greeting} onChange={(e) => this.setState({ greeting: e.target.value })}/>
24
+ <div className='info-block'><strong>Details</strong>: {this.props.details}</div>
18
25
  </div>
19
26
  }
20
27
  })
@@ -2,6 +2,8 @@ import React from 'react'
2
2
  import {connect} from 'react-redux'
3
3
  import * as actionCreators from '../redux/reducer'
4
4
 
5
+ import {ReactLogo, Icon} from './FeatureWidgets'
6
+
5
7
  export const HelloWithRedux = React.createClass({
6
8
  propTypes: {
7
9
  greeting: React.PropTypes.string.isRequired,
@@ -10,12 +12,16 @@ export const HelloWithRedux = React.createClass({
10
12
  },
11
13
  render () {
12
14
  return <div className='bordered-component'>
13
- <h2>This is the "HelloWithRedux" component from 'client/src/components/HelloWithRedux.jsx'</h2>
14
- <p><strong>Details</strong>: {this.props.details}</p>
15
- <p>Current greeting: {this.props.greeting}</p>
15
+ <h2><ReactLogo /> This is the HelloWithRedux component</h2>
16
+ <div className='source'>from the <code>HelloWithRedux.jsx</code> file in <Icon icon='folder-open' /> <code>client/src/components</code></div>
17
+
18
+ <div className='info-block'>
19
+ <label htmlFor='redux-greeting'><strong>Change greeting</strong>: </label>
20
+ <input type='text' id='redux-greeting' value={this.props.greeting} onChange={(e) => this.props.setGreeting(e.target.value)}/>
21
+ </div>
16
22
 
17
- <label htmlFor='greeting'>Change the greeting here: </label>
18
- <input type='text' id='greeting' value={this.props.greeting} onChange={(e) => this.props.setGreeting(e.target.value)}/>
23
+ <div className='info-block'><strong>Current greeting</strong>: {this.props.greeting}</div>
24
+ <div className='info-block'><strong>Details</strong>: {this.props.details}</div>
19
25
  </div>
20
26
  }
21
27
  })
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ width="600px" height="600px" viewBox="0 0 600 600" enable-background="new 0 0 600 600" xml:space="preserve">
5
+ <rect fill="#222222" width="600" height="600"/>
6
+ <circle fill="#00D8FF" cx="299.529" cy="299.628" r="50.167"/>
7
+ <path fill="none" stroke="#00D8FF" stroke-width="24" stroke-miterlimit="10" d="M299.529,197.628
8
+ c67.356,0,129.928,9.665,177.107,25.907c56.844,19.569,91.794,49.233,91.794,76.093c0,27.991-37.041,59.503-98.083,79.728
9
+ c-46.151,15.291-106.879,23.272-170.818,23.272c-65.554,0-127.63-7.492-174.29-23.441c-59.046-20.182-94.611-52.103-94.611-79.559
10
+ c0-26.642,33.37-56.076,89.415-75.616C167.398,207.503,231.515,197.628,299.529,197.628z"/>
11
+ <path fill="none" stroke="#00D8FF" stroke-width="24" stroke-miterlimit="10" d="M210.736,248.922
12
+ c33.649-58.348,73.281-107.724,110.92-140.48c45.35-39.466,88.507-54.923,111.775-41.505
13
+ c24.248,13.983,33.042,61.814,20.067,124.796c-9.81,47.618-33.234,104.212-65.176,159.601
14
+ c-32.749,56.788-70.25,106.819-107.377,139.272c-46.981,41.068-92.4,55.929-116.185,42.213
15
+ c-23.079-13.31-31.906-56.921-20.834-115.233C153.281,368.316,176.758,307.841,210.736,248.922z"/>
16
+ <path fill="none" stroke="#00D8FF" stroke-width="24" stroke-miterlimit="10" d="M210.821,351.482
17
+ c-33.746-58.292-56.731-117.287-66.312-166.255c-11.544-58.999-3.382-104.109,19.864-117.566
18
+ c24.224-14.024,70.055,2.244,118.14,44.94c36.356,32.28,73.688,80.837,105.723,136.173c32.844,56.733,57.461,114.209,67.036,162.582
19
+ c12.117,61.213,2.309,107.984-21.453,121.74c-23.057,13.348-65.249-0.784-110.239-39.499
20
+ C285.567,460.886,244.898,410.344,210.821,351.482z"/>
21
+ </svg>
@@ -1,3 +1,3 @@
1
1
  module ReactRailsWebpack
2
- VERSION = "3.0.1"
2
+ VERSION = "3.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_rails_webpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neurodynamic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-23 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -76,17 +76,20 @@ files:
76
76
  - ".gitignore"
77
77
  - CHANGELOG.md
78
78
  - CODE_OF_CONDUCT.md
79
+ - FEATURES.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
82
83
  - Rakefile
83
84
  - bin/console
84
85
  - bin/setup
86
+ - images/rrw_demo_short.gif
85
87
  - lib/react_rails_webpack.rb
86
88
  - lib/react_rails_webpack/app/controllers/react_example_controller.rb
87
89
  - lib/react_rails_webpack/app/helpers/react_helper.rb
88
90
  - lib/react_rails_webpack/app/views/react_example/greeting.html.erb
89
91
  - lib/react_rails_webpack/client/.babelrc
92
+ - lib/react_rails_webpack/client/copy_fonts.rb
90
93
  - lib/react_rails_webpack/client/environment.json
91
94
  - lib/react_rails_webpack/client/package.json
92
95
  - lib/react_rails_webpack/client/src/app.js
@@ -96,8 +99,10 @@ files:
96
99
  - lib/react_rails_webpack/client/src/app/initializeReduxStore.js
97
100
  - lib/react_rails_webpack/client/src/app/renderingComponentsInDivs.js
98
101
  - lib/react_rails_webpack/client/src/app/wrapWithProvider.jsx
102
+ - lib/react_rails_webpack/client/src/components/FeatureWidgets.jsx
99
103
  - lib/react_rails_webpack/client/src/components/Hello.jsx
100
104
  - lib/react_rails_webpack/client/src/components/HelloWithRedux.jsx
105
+ - lib/react_rails_webpack/client/src/images/react_logo.svg
101
106
  - lib/react_rails_webpack/client/src/redux/reducer.js
102
107
  - lib/react_rails_webpack/client/test/redux/actions/set_greeting_spec.js
103
108
  - lib/react_rails_webpack/client/test/test_helper.js