react_webpack_rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +23 -6
- data/Rakefile +22 -2
- data/lib/generators/react_webpack_rails/install_generator.rb +3 -0
- data/lib/generators/react_webpack_rails/templates/package.json.erb +3 -0
- data/lib/generators/react_webpack_rails/templates/partial/_react_hot_assets.html.erb +3 -0
- data/lib/generators/react_webpack_rails/templates/react/components/hello-world.jsx +1 -3
- data/lib/generators/react_webpack_rails/templates/webpack/hot-dev.config.js +13 -0
- data/lib/generators/react_webpack_rails/templates/webpack.config.js +8 -4
- data/lib/react_webpack_rails/engine.rb +1 -1
- data/lib/react_webpack_rails/railtie.rb +1 -1
- data/lib/react_webpack_rails/version.rb +1 -1
- data/lib/react_webpack_rails.rb +2 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9c67fecd5f3e1b72d2ebc46ec7dfb8d05ab75e4
|
4
|
+
data.tar.gz: 05a6301021820dab1ccb64564b424f0bc3ba69de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e44ea83f26566d10ebca037c2c5cfe38fe998c88559ee2bb7345ad401ec0ceb76c51cc3a540fa5f82e801ded6d7023aee3aaae3e62c10a9a0ce1432399b0bd
|
7
|
+
data.tar.gz: 1e413493cca65abd5f4100b20291545a517712a53599345a7a774a0e848604f7f45c68c1b9c45ba2c2ea590db46fec4d7c46ca2bd7c03f96a8d304ef99be4359
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
## 0.0.5 (November 26, 2015)
|
2
|
+
* Add Hot Reload support
|
3
|
+
* Dependencies:
|
4
|
+
* webpack-dev-server
|
5
|
+
* react-hot-loader
|
6
|
+
* Second development server (webpack-dev-server) with hot-auto-reload:
|
7
|
+
* Setup and add tests
|
8
|
+
|
9
|
+
### migration 0.0.4 -> 0.0.5
|
10
|
+
* make sure your package.json is up-to-date.
|
11
|
+
* install `react-hot-loader ^1.3.0`
|
12
|
+
* install `webpack-dev-server" ^1.12.1`
|
13
|
+
* add to application.html.erb <body>:
|
14
|
+
```erb
|
15
|
+
<% if Rails.env.development? %>
|
16
|
+
<script src='http://localhost:8080/assets/react_bundle.js'></script>
|
17
|
+
<% end %>
|
18
|
+
```
|
19
|
+
* copy file `hot-dev.config.js` from https://github.com/netguru/react_webpack_rails/tree/master/lib/generators/react_webpack_rails/templates/webpack to your `/webpack` directory.
|
20
|
+
* make sure that you have `react_bundle.js` in your `/app/assets/javascripts` directory. If not, to use hot-reloading server please create empty `react_bundle.js` in your `/app/assets/javascripts` directory or just run `$ npm start` or `$ npm build` in your terminal.
|
21
|
+
|
22
|
+
|
1
23
|
## 0.0.4 (October 26, 2015)
|
2
24
|
* Add [react-router [v1]](https://github.com/rackt/react-router) integration:
|
3
25
|
* js helpers:
|
data/README.md
CHANGED
@@ -26,16 +26,23 @@ This will create following files:
|
|
26
26
|
|
27
27
|
```
|
28
28
|
├── app
|
29
|
-
│
|
30
|
-
│
|
31
|
-
│
|
32
|
-
│
|
33
|
-
│
|
29
|
+
│ ├── react
|
30
|
+
│ │ ├── components
|
31
|
+
│ │ │ ├── hello-world.jsx
|
32
|
+
│ │ │ └── hello-world-test.jsx
|
33
|
+
│ │ └── index.js
|
34
|
+
│ ├── views
|
35
|
+
│ │ └── layouts
|
36
|
+
│ │ └── _react_hot_assets.html.erb
|
37
|
+
│ └── assets
|
38
|
+
│ └── javascripts
|
39
|
+
│ └──react_bundle.js
|
34
40
|
├── webpack
|
35
41
|
│ ├── dev.config.js
|
42
|
+
│ ├── hot-dev.config.js
|
36
43
|
│ ├── production.config.js
|
37
44
|
│ └── tests.config.js
|
38
|
-
|
45
|
+
├── .babelrc
|
39
46
|
├── karma.conf.js
|
40
47
|
├── package.json
|
41
48
|
└── webpack.config.js
|
@@ -62,6 +69,12 @@ By default, `react-webpack-rails` uses Babel Stage 1 - Proposal. If you want to
|
|
62
69
|
|
63
70
|
## Usage
|
64
71
|
##### Check [docs](https://github.com/netguru/react_webpack_rails/tree/master/docs) for detailed api description.
|
72
|
+
### to use hot-reloading add partial in your application.html.erb to `<body>`:
|
73
|
+
(it's not needed when you want to use just webpack in watch mode without hot-reloading)
|
74
|
+
```erb
|
75
|
+
<%= render 'layouts/react_hot_assets' %>
|
76
|
+
```
|
77
|
+
|
65
78
|
#### Register component in index.js
|
66
79
|
|
67
80
|
```js
|
@@ -87,6 +100,10 @@ Run webpack in watch mode using script:
|
|
87
100
|
|
88
101
|
$ npm start
|
89
102
|
|
103
|
+
Run webpack in hot-auto-reloading mode using script (to use it you have to add `react_hot_assets` partial as mentioned before):
|
104
|
+
|
105
|
+
$ npm run start-hot-dev
|
106
|
+
|
90
107
|
Or manually:
|
91
108
|
|
92
109
|
$ webpack -w --config YOUR_CONFIG
|
data/Rakefile
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
|
4
|
+
namespace :spec do
|
5
|
+
desc 'Run all tests'
|
6
|
+
task all: [:gem, :rails3, :rails4] do
|
7
|
+
puts 'Finished all tests, yay!'
|
8
|
+
end
|
5
9
|
|
6
|
-
|
10
|
+
desc 'Run gem tests'
|
11
|
+
task :gem do
|
12
|
+
sh %Q(rspec spec/react_webpack_rails_spec.rb)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run rspec for rails3 application'
|
16
|
+
task :rails3 do
|
17
|
+
sh %Q(cd spec/rails3_dummy_app && rspec)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Run rspec for rails4 application'
|
21
|
+
task :rails4 do
|
22
|
+
sh %Q(cd spec/rails4_dummy_app && rspec)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
task default: 'spec:all'
|
@@ -9,10 +9,13 @@ module ReactWebpackRails
|
|
9
9
|
copy_file '.babelrc', '.babelrc'
|
10
10
|
copy_file 'webpack.config.js', 'webpack.config.js'
|
11
11
|
copy_file 'webpack/dev.config.js', 'webpack/dev.config.js'
|
12
|
+
copy_file 'webpack/hot-dev.config.js', 'webpack/hot-dev.config.js'
|
12
13
|
copy_file 'webpack/production.config.js', 'webpack/production.config.js'
|
13
14
|
copy_file 'karma.conf.js', 'karma.conf.js'
|
14
15
|
copy_file 'webpack/tests.config.js', 'webpack/tests.config.js'
|
16
|
+
copy_file 'partial/_react_hot_assets.html.erb', 'app/views/layouts/_react_hot_assets.html.erb'
|
15
17
|
template 'react/index.js.erb', 'app/react/index.js'
|
18
|
+
create_file 'app/assets/javascripts/react_bundle.js'
|
16
19
|
if options.example
|
17
20
|
copy_file 'react/components/hello-world.jsx', 'app/react/components/hello-world.jsx'
|
18
21
|
copy_file 'react/components/hello-world-test.jsx', 'app/react/components/hello-world-test.jsx'
|
@@ -11,6 +11,8 @@
|
|
11
11
|
"karma-sinon": "^1.0.4",
|
12
12
|
"karma-sourcemap-loader": "^0.3.6",
|
13
13
|
"karma-webpack": "^1.7.0",
|
14
|
+
"react-hot-loader": "^1.3.0",
|
15
|
+
"webpack-dev-server": "^1.12.1",
|
14
16
|
"webpack-notifier": "^1.2.1"
|
15
17
|
},
|
16
18
|
"dependencies": {
|
@@ -28,6 +30,7 @@
|
|
28
30
|
"scripts": {
|
29
31
|
"test": "karma start",
|
30
32
|
"start": "webpack -w --config webpack/dev.config.js",
|
33
|
+
"start-hot-dev": "webpack-dev-server --hot --inline --config webpack/hot-dev.config.js",
|
31
34
|
"build": "webpack -p --config webpack/production.config.js"
|
32
35
|
},
|
33
36
|
"license": "",
|
@@ -0,0 +1,13 @@
|
|
1
|
+
var config = require('./dev.config');
|
2
|
+
|
3
|
+
var jsxLoader = config.module.loaders.filter(function(loader) { return loader.key == 'jsx' })[0]
|
4
|
+
jsxLoader.loaders.unshift('react-hot');
|
5
|
+
|
6
|
+
config.output.publicPath = 'http://localhost:8080/assets/'
|
7
|
+
|
8
|
+
config.entry.main.push(
|
9
|
+
'webpack/hot/only-dev-server',
|
10
|
+
'webpack-dev-server/client?http://localhost:8080'
|
11
|
+
)
|
12
|
+
|
13
|
+
module.exports = config;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2
2
|
|
3
3
|
module.exports = {
|
4
|
-
|
5
|
-
|
4
|
+
entry: {
|
5
|
+
main: ['./app/react/index.js']
|
6
|
+
},
|
6
7
|
output: {
|
7
8
|
path: __dirname + '/app/assets/javascripts',
|
8
9
|
filename: 'react_bundle.js'
|
@@ -10,15 +11,18 @@ module.exports = {
|
|
10
11
|
module: {
|
11
12
|
loaders: [
|
12
13
|
{
|
14
|
+
key: 'jsx',
|
13
15
|
test: /\.jsx?$/,
|
14
|
-
exclude: /node_modules/,
|
15
|
-
|
16
|
+
exclude: /(node_modules)/,
|
17
|
+
loaders: ['babel-loader']
|
16
18
|
},
|
17
19
|
{
|
20
|
+
key: 'scss',
|
18
21
|
test: /\.scss$/,
|
19
22
|
loader: ExtractTextPlugin.extract('css!sass')
|
20
23
|
},
|
21
24
|
{
|
25
|
+
key: 'css',
|
22
26
|
test: /\.css$/,
|
23
27
|
loader: ExtractTextPlugin.extract('css!sass')
|
24
28
|
}
|
data/lib/react_webpack_rails.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
1
|
require 'react_webpack_rails/version'
|
2
|
-
require 'react_webpack_rails/engine'
|
3
|
-
require 'react_webpack_rails/railtie'
|
4
|
-
require 'react_webpack_rails/view_helpers'
|
2
|
+
require 'react_webpack_rails/engine' if defined?(Rails)
|
3
|
+
require 'react_webpack_rails/railtie' if defined?(Rails)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_webpack_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafał Gawlik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -93,11 +93,13 @@ files:
|
|
93
93
|
- lib/generators/react_webpack_rails/templates/.babelrc
|
94
94
|
- lib/generators/react_webpack_rails/templates/karma.conf.js
|
95
95
|
- lib/generators/react_webpack_rails/templates/package.json.erb
|
96
|
+
- lib/generators/react_webpack_rails/templates/partial/_react_hot_assets.html.erb
|
96
97
|
- lib/generators/react_webpack_rails/templates/react/components/hello-world-test.jsx
|
97
98
|
- lib/generators/react_webpack_rails/templates/react/components/hello-world.jsx
|
98
99
|
- lib/generators/react_webpack_rails/templates/react/index.js.erb
|
99
100
|
- lib/generators/react_webpack_rails/templates/webpack.config.js
|
100
101
|
- lib/generators/react_webpack_rails/templates/webpack/dev.config.js
|
102
|
+
- lib/generators/react_webpack_rails/templates/webpack/hot-dev.config.js
|
101
103
|
- lib/generators/react_webpack_rails/templates/webpack/production.config.js
|
102
104
|
- lib/generators/react_webpack_rails/templates/webpack/tests.config.js
|
103
105
|
- lib/react_webpack_rails.rb
|