react_rails_webpack 2.0.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2ef9e66888a52a0c16e75cd67602d919edf4263
4
- data.tar.gz: 6e66dd5544c12a10d44fbd991e1af2f658d65e4f
3
+ metadata.gz: a14f21ceb9ab3f83319a1cbd212421eb9f9c8a8d
4
+ data.tar.gz: ae9f1405f883f6f27524353742c560c1a2bdd160
5
5
  SHA512:
6
- metadata.gz: c8592836f948f1b851462acfdc7cc2d9c89182d1dbc020d33e63ea0acd81bcf8ac211c01e394510286ab22060abda1a83db31434ef762797c91c0905774daba8
7
- data.tar.gz: 3fb21fd2eafe796b2ca4257d617ba8f996b1de9929dd285044d55e4e5c0694f36c88e23deae6976f0aebfc2666f21f99b82d53323ee710de67ede247a50dae29
6
+ metadata.gz: 8aa6609422e0d2f36b7fb9ee19ca4240a981d3e32b4d9b52c9c9e56faf1e018773255b90c8f56c0ed110f7f655d18ee698deb2fcd59896f62530b424429f1172
7
+ data.tar.gz: f53810888632ab2b93bfbd47de30773f66865e293ef95b6cf1002cee032a51297c6daed87ac75966cdadb3a4af75a41f9f88e7adf8043fd538b5cb5a918c6a16
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ## Changelog
2
+
3
+ ### 3.0.0
4
+ - MANY BIG CHANGES
5
+ - Trim package.json dependencies
6
+ - Update package.json dependency versions
7
+ - Remove npm "prebuild" command from package.json
8
+ - Replace "minify" webpack option with custom UglifyJS options
9
+ - Depend on main hjs-webpack repo instead of customized fork (UglifyJS options enabled this)
10
+ - Add .babelrc file
11
+ - Correct broken redux test
12
+ - Start keeping a changelog
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["es2015", "react"]
3
+ }
@@ -4,45 +4,40 @@
4
4
  "description": "react client-side",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "start": "webpack-dev-server",
8
- "prebuild": "rm -rf ../app/assets/webpack && mkdir ../app/assets/webpack",
7
+ "start": "hjs-dev-server",
9
8
  "build": "NODE_ENV=production webpack",
10
9
  "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js 'test/**/*.@(js|jsx)'"
11
10
  },
12
11
  "author": "",
13
12
  "license": "ISC",
14
13
  "dependencies": {
15
- "autoprefixer": "^6.0.3",
16
- "babel": "^5.8.23",
17
- "babel-loader": "^5.3.2",
18
- "css-loader": "^0.21.0",
19
- "file-loader": "^0.8.4",
20
- "history": "^1.12.5",
21
- "hjs-webpack": "neurodynamic/hjs-webpack",
22
- "json-loader": "^0.5.3",
23
- "postcss-loader": "^0.7.0",
24
- "react": "^0.14.6",
25
- "react-dom": "^0.14.0",
26
- "react-hot-loader": "^1.3.0",
27
- "react-redux": "^4.0.6",
28
- "react-script-loader": "0.0.1",
29
- "react-tap-event-plugin": "^0.2.1",
30
- "redux": "^3.0.4",
31
- "redux-form": "^4.0.7",
32
- "style-loader": "^0.13.0",
33
- "url-loader": "^0.5.6",
34
- "webpack": "^1.12.6",
35
- "webpack-dev-server": "^1.12.1"
14
+ "react": "^15.0.0"
36
15
  },
37
16
  "devDependencies": {
17
+ "autoprefixer": "^6.3.6",
18
+ "babel": "^6.5.2",
19
+ "babel-core": "^6.7.6",
20
+ "babel-loader": "^6.2.4",
21
+ "babel-preset-es2015": "^6.6.0",
22
+ "babel-preset-react": "^6.5.0",
23
+ "babel-preset-react-hmre": "^1.1.1",
38
24
  "chai": "^3.4.0",
39
25
  "chai-immutable": "^1.3.0",
26
+ "css-loader": "^0.23.1",
27
+ "hjs-webpack": "^8.3.0",
40
28
  "jsdom": "^7.0.2",
41
29
  "mocha": "^2.3.3",
42
30
  "node-sass": "^3.4.2",
43
- "redux-devtools": "^3.0.1",
44
- "redux-devtools-dock-monitor": "^1.0.1",
45
- "redux-devtools-log-monitor": "^1.0.2",
46
- "sass-loader": "^3.1.1"
31
+ "postcss-loader": "^0.8.2",
32
+ "react-dom": "^15.0.1",
33
+ "react-redux": "^4.4.5",
34
+ "react-tap-event-plugin": "^1.0.0",
35
+ "redux": "^3.5.2",
36
+ "redux-devtools": "^3.3.1",
37
+ "redux-devtools-dock-monitor": "^1.1.1",
38
+ "redux-devtools-log-monitor": "^1.0.11",
39
+ "sass-loader": "^3.1.1",
40
+ "style-loader": "^0.13.1",
41
+ "webpack": "^1.12.15"
47
42
  }
48
43
  }
@@ -5,13 +5,13 @@ import {setGreeting} from '../../../src/redux/reducer'
5
5
 
6
6
  describe('setGreeting', () => {
7
7
  it('sets the greeting', () => {
8
- const initialState = 'Heck off'
8
+ const initialState = { greeting: 'Heck off' }
9
+ const betterGreeting = 'Lovely to meet you'
9
10
 
10
- const action = setGreeting('Lovely to meet you')
11
+ const action = setGreeting(betterGreeting)
11
12
 
12
13
  const nextState = reducer(initialState, action)
13
- const expectedState = 'Lovely to meet you'
14
14
 
15
- expect(nextState).to.equal(expectedState)
15
+ expect(nextState.greeting).to.equal(betterGreeting)
16
16
  })
17
17
  })
@@ -1,31 +1,54 @@
1
1
  /*
2
2
  Welcome to the Webpack configuration file!
3
+
4
+ The react_rails_webpack gem uses the hjs-webpack npm package to configure webpack.
5
+
6
+ Any options available in hjs-webpack are available here.
7
+
8
+ hjs-webpack repo: https://github.com/HenrikJoreteg/hjs-webpack
9
+ hjs-webpack tutorial (for an outdated version, but concepts are relatively unchanged): http://learn.humanjavascript.com/react-ampersand/setting-up-webpack
3
10
  */
4
11
 
5
12
  require('webpack')
6
13
  var getConfig = require('hjs-webpack') // This setup is largely based on the hjs-webpack npm package
7
14
  var environment = require('./environment.json')
8
15
 
16
+ // I disable most of the UglifyJS minification by default
17
+ // so that if any weird errors happen on the Rails side
18
+ // it is still possible to track them down in the
19
+ // compiled code. Rails will uglify assets on its own.
20
+ var uglifyOpts = {
21
+ compress: false,
22
+ mangle: false,
23
+ beautify: { semicolons: false },
24
+ sourceMap: false,
25
+ output: { comments: true }
26
+ }
27
+
9
28
  var config = getConfig({
10
29
  in: 'src/app.js', // Tells webpack to look in the src/app.js file to find the code for components and rendering
11
30
  out: '../app/assets/webpack', // Tells webpack to put compiled files into ../app/assets/webpack when it runs
12
- minify: false, // Tells Webpack not to minify stuff, since in this case we'll let the Rails asset pipeline deal with that
13
- html: function (context) {
31
+ clearBeforeBuild: true, // Tells webpack to destroy and remake pre-existing OUT folder before compiling files to it
32
+ uglify: uglifyOpts, // Tells webpack to destroy and remake pre-existing OUT folder before compiling files to it
33
+ html: function (data) {
34
+ var sourceFileNote = "<aside class='source'>Find the source for this page in client/webpack.config.js</aside>"
35
+
36
+ // The divs below will get detected by React because they have the "react-component-target" class
37
+ // If you want to test a new component, you'll have to edit one of these accordingly or
38
+ // add another div with the "react-component-target" class and pass it the appropriate
39
+ // component name and props in the "data-componentname" and "data-componentprops" attributes
40
+ // just like the ones below.
41
+ var plainReactComponent = "<div class=\"react-component-target\" data-componentname=\"Hello\" data-componentprops='{ \"details\": \"My initial greeting was set with getInitialState in the client/src/components/Hello.jsx file.\" }'></div>"
42
+ var reduxComponent = "<div class=\"react-component-target\" data-componentname=\"HelloWithRedux\" data-componentprops='{ \"details\": \"My initial greeting was set with initialState in the client/src/redux/reducer.js file.\" }'></div>"
43
+
14
44
  return {
15
45
  'index.html':
16
- context.defaultTemplate(
46
+ data.defaultTemplate(
17
47
  {
48
+ // Other options you could pass include 'title' and 'head':
18
49
  // title: 'Site Title'
19
50
  // head: '<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>',
20
- html: "<aside class='source'>Find the source for this page in client/webpack.config.js</aside>" +
21
-
22
- // The divs below will get detected by React because they have the "react-component-target" class
23
- // If you want to test a new component, you'll have to edit one of these accordingly or
24
- // add another div with the "react-component-target" class and pass it the appropriate
25
- // component name and props in the "data-componentname" and "data-componentprops" attributes
26
- // just like the ones below.
27
- "<div class=\"react-component-target\" data-componentname=\"Hello\" data-componentprops='{ \"details\": \"My initial greeting was set with getInitialState in the client/src/components/Hello.jsx file.\" }'></div>" +
28
- "<div class=\"react-component-target\" data-componentname=\"HelloWithRedux\" data-componentprops='{ \"details\": \"My initial greeting was set with initialState in the client/src/redux/reducer.js file.\" }'></div>"
51
+ html: (sourceFileNote + plainReactComponent + reduxComponent)
29
52
  }
30
53
  )
31
54
  }
@@ -36,8 +59,7 @@ var config = getConfig({
36
59
  // On a Mac, to see your computer's name on your network,
37
60
  // go to System Preferences, and then the "Sharing" menu,
38
61
  // and you should see it in the "Computer Name" input field
39
- hostname: environment.hostname,
40
- isDev: process.env.NODE_ENV !== 'production'
62
+ hostname: environment.hostname
41
63
  })
42
64
 
43
65
  module.exports = config
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "scripts": {
3
3
  "start": "cd client && npm run start",
4
- "prebuild": "cd client && npm run prebuild",
5
4
  "build": "cd client && npm run build",
6
5
  "install": "cd client && npm install",
7
6
  "test": "cd client && npm run test"
@@ -1,3 +1,3 @@
1
1
  module ReactRailsWebpack
2
- VERSION = "2.0.9"
2
+ VERSION = "3.0.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: 2.0.9
4
+ version: 3.0.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-19 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
+ - CHANGELOG.md
77
78
  - CODE_OF_CONDUCT.md
78
79
  - Gemfile
79
80
  - LICENSE.txt
@@ -85,6 +86,7 @@ files:
85
86
  - lib/react_rails_webpack/app/controllers/react_example_controller.rb
86
87
  - lib/react_rails_webpack/app/helpers/react_helper.rb
87
88
  - lib/react_rails_webpack/app/views/react_example/greeting.html.erb
89
+ - lib/react_rails_webpack/client/.babelrc
88
90
  - lib/react_rails_webpack/client/environment.json
89
91
  - lib/react_rails_webpack/client/package.json
90
92
  - lib/react_rails_webpack/client/src/app.js