react_on_rails 6.1.0 → 6.1.1.rc.1

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: 72ff43753d92d5152c1904fefec146611cb131c0
4
- data.tar.gz: dc1a7c39e2bc236ddd8c3332658591fa898a0e39
3
+ metadata.gz: 8c1a4b95d529e2b5d95bd5cd92822138f8a5017c
4
+ data.tar.gz: c77aeda6b4a99c2be1b02719729be8e49fd53179
5
5
  SHA512:
6
- metadata.gz: e23da97d02dcfe67f2696d227af396041622fbed07d9d5da70440c8adb5bfac51d807e099e66d4481b25de215e85e92a1c79e7cd9309539969e4e02a1ddb5b63
7
- data.tar.gz: c92cc09eab269a74d6920144eca5ee5803a6521ffca285a6f8588ab9ae7d9dbc58524f01231ceae9afb6c0f2c67d8dce656c4e90158b3a35d5aa4b814b84ed62
6
+ metadata.gz: 58c496affefbff52af047529ab85cea488f78bfd325cc2d12ee85fd0106340ff2ab174d82a9c92c8d0e8ceba007c987cd4047222546b9c867f038fefe6cef216
7
+ data.tar.gz: 774fd6cf92855b04a79e6eea058212e7744677b10c492e083ff169746f4a432d4c38be0bc93d19b3530548450f6eb2d6b49ea465808767c120df14ee861baa38
data/.bookignore ADDED
@@ -0,0 +1,16 @@
1
+ # Directories to ignore
2
+ app/*
3
+ gen-examples/*
4
+ lib/*
5
+ node_package/"
6
+ rakelib/*
7
+ script/*
8
+ spec/*
9
+
10
+ # files in repo root to ignore
11
+ Gemfile
12
+ npm-shrinkwrap.json
13
+ package.json
14
+ Rakefile
15
+ react_on_rails.gemspec
16
+ ruby-lint.yml
data/CONTRIBUTING.md CHANGED
@@ -36,6 +36,12 @@ From [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/
36
36
  bundle && npm i && rake examples:prepare_all && rake node_package && rake
37
37
  ```
38
38
 
39
+ In order to run tests in browser
40
+ ```
41
+ npm i -g browserify babelify tape-run faucet
42
+ browserify -t babelify node_package/tests/*.js | tape-run | faucet
43
+ ```
44
+
39
45
  See Dev Initial Setup, below for, well... initial setup.
40
46
 
41
47
  # IDE/IDE SETUP
data/NEWS.md CHANGED
@@ -3,6 +3,7 @@
3
3
  *We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
4
4
 
5
5
  * Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes.
6
+ * 2016-08-27: We now have a [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference.
6
7
  * 2016-08-21: v6.1 ships with serveral new features and bug fixes. See the [Changelog](CHANGELOG.md).
7
8
  * 2016-06-13: 6.0.4 shipped with a critical fix regarding a missing polyfill for `clearTimeout`, used by babel-polyfill.
8
9
  * 2016-06-06: 6.0.2 shipped with a critical fix if you are fragment caching the server generated React.
data/README.md CHANGED
@@ -13,6 +13,7 @@ Your support keeps this project going.
13
13
  (Want to become a contributor? [Contact us](mailto:contact@shakacode.com) for an Slack team invite! Also, see ["easy" issues](https://github.com/shakacode/react_on_rails/labels/easy) and [issues for the full tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy).)
14
14
 
15
15
  # NEWS
16
+ * 2016-08-27: We now have a [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference.
16
17
  * 2016-08-21: v6.1 ships with serveral new features and bug fixes. See the [Changelog](CHANGELOG.md).
17
18
  * 2016-07-28: If you're doing server rendering, be sure to use mini\_racer! See [issues/428](https://github.com/shakacode/react_on_rails/issues/428). It's supposedly much faster than `therubyracer`.
18
19
  * *See [NEWS.md](NEWS.md) for more notes over time.*
@@ -75,7 +76,7 @@ We're definitely not doing that. With react_on_rails, webpack is mainly generati
75
76
  1. Add the following to your Gemfile and bundle install.
76
77
 
77
78
  ```ruby
78
- gem "react_on_rails", "~> 5"
79
+ gem "react_on_rails", "~> 6"
79
80
  ```
80
81
 
81
82
  2. Commit this to git (you cannot run the generator unless you do this).
@@ -447,7 +448,8 @@ If you are using [jquery-ujs](https://github.com/rails/jquery-ujs) for AJAX call
447
448
  ## Integration with Node
448
449
  Node.js can be used as the backend for server-side rendering instead of [execJS](https://github.com/rails/execjs). Before you try this, consider the tradeoff of extra complexity with your deployments versus *potential* performance gains. We've found that using ExecJS with [mini_racer](https://github.com/discourse/mini_racer) to be "fast enough" so far. That being said, we've heard of other large websites using Node.js for better server rendering performance. See [Node.js for Server Rendering](docs/additional-reading/node-server-rendering.md) for more information.
449
450
 
450
- ## Additional Documentation
451
+ ## Additional Documentation
452
+ **Try out our new [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference!**
451
453
  + **Rails**
452
454
  + [Rails Assets](docs/additional-reading/rails-assets.md)
453
455
  + [Rails View Rendering from Inline JavaScript](docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
data/SUMMARY.md ADDED
@@ -0,0 +1,49 @@
1
+ # Table of Content
2
+
3
+ ### **Rails**
4
+ * [Rails Assets](docs/additional-reading/rails-assets.md)
5
+ * [Rails View Rendering from Inline JavaScript](docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
6
+ * [RSpec Configuration](docs/additional-reading/rspec-configuration.md)
7
+ * [Turbolinks](docs/additional-reading/turbolinks.md)
8
+
9
+ ### **Javascript**
10
+ * [Node Dependencies and NPM](docs/additional-reading/node-dependencies-and-npm.md)
11
+ * [Babel](docs/additional-reading/babel.md)
12
+ * [React Router](docs/additional-reading/react-router.md)
13
+ * [React & Redux](docs/additional-reading/react-and-redux.md)
14
+ * [Webpack](docs/additional-reading/webpack.md)
15
+ * [Webpack Configuration](docs/additional-reading/webpack.md)
16
+ * [Webpack Cookbook](https://christianalfoni.github.io/react-webpack-cookbook/index.html)
17
+ * [Developing with the Webpack Dev Server](docs/additional-reading/webpack-dev-server.md)
18
+ * [Node Server Rendering](docs/additional-reading/node-server-rendering.md)
19
+ * [Server Rendering Tips](docs/additional-reading/server-rendering-tips.md)
20
+
21
+ ### **Development**
22
+ * [React on Rails Basic Installation Tutorial](docs/tutorial.md) ([live demo](https://hello-react-on-rails.herokuapp.com))
23
+ * [Installation Overview](docs/basics/installation-overview.md)
24
+ * [Migration from react-rails](docs/basics/migrating-from-react-rails.md)
25
+ * [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
26
+ * [Generator Tips](docs/basics/generator.md)
27
+ * [Hot Reloading of Assets For Rails Development](docs/additional-reading/hot-reloading-rails-development.md)
28
+ * [Heroku Deployment](docs/additional-reading/heroku-deployment.md)
29
+ * [Updating Dependencies](docs/additional-reading/updating-dependencies.md)
30
+
31
+ ### **API**
32
+ * [JavaScript API](docs/api/javascript-api.md)
33
+ * [Ruby API](docs/api/ruby-api.md)
34
+ * [Setting up Hot Reloading during Rails Development, API docs](docs/api/ruby-api-hot-reload-view-helpers.md)
35
+
36
+ ### **CONTRIBUTING**
37
+ * [Contributing](CONTRIBUTING.MD)
38
+ * [Generator Testing](docs/contributor-info/generator-testing.md)
39
+ * [Linting](docs/contributor-info/linters.md)
40
+ * [Releasing](docs/contributor-info/releasing.md)
41
+
42
+ ### **Misc**
43
+ * [Tips](docs/additional-reading/tips.md)
44
+ * [Changelog](CHANGELOG.md)
45
+ * [Projects](PROJECTS.md)
46
+ * [Shaka Code Style](docs/coding-style/style.md)
47
+ * [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v4032)
48
+ * [Code of Conduct](docs/misc/code_of_conduct.md)
49
+ * [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
data/book.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "gitbook": "3.1.1",
3
+ "title": "React on Rails Documentation",
4
+ "plugins": ["prism", "-highlight", "github"],
5
+ "pluginsConfig": {
6
+ "github": {
7
+ "url": "https://github.com/shakacode/react_on_rails/"
8
+ },
9
+ "sharing": {
10
+ "facebook": true,
11
+ "twitter": true,
12
+ "google": true,
13
+ "weibo": true,
14
+ "instapaper": true,
15
+ "vk": true
16
+ }
17
+ }
18
+ }
@@ -1,5 +1,7 @@
1
1
  module ReactOnRails
2
2
  class AssetsPrecompile
3
+ class SymlinkTargetDoesNotExistException < StandardError; end
4
+
3
5
  # Used by the rake task
4
6
  def default_asset_path
5
7
  dir = File.join(Rails.configuration.paths["public"].first,
@@ -20,30 +22,35 @@ module ReactOnRails
20
22
  def symlink_file(target, symlink)
21
23
  target_path = @assets_path.join(target)
22
24
  symlink_path = @assets_path.join(symlink)
25
+
23
26
  target_exists = File.exist?(target_path)
27
+ raise SymlinkTargetDoesNotExistException, "Target Path was: #{target_path}" unless target_exists
24
28
 
25
29
  # File.exist?(symlink_path) will check the file the sym is pointing to is existing
26
30
  # File.lstat(symlink_path).symlink? confirms that this is a symlink
27
- symlink_already_there_and_valid = File.exist?(symlink_path) &&
28
- File.lstat(symlink_path).symlink?
29
- if symlink_already_there_and_valid
30
- puts "React On Rails: Digested #{symlink} already exists indicating #{target} did not change."
31
- elsif target_exists
32
- if File.exist?(symlink_path) && File.lstat(symlink_path).symlink?
33
- puts "React On Rails: Removing invalid symlink #{symlink_path}"
34
- `cd #{@assets_path} && rm #{symlink}`
35
- end
36
- # Might be like:
37
- # "images/5cf5db49df178f9357603f945752a1ef.png":
38
- # "images/5cf5db49df178f9357603f945752a1ef-033650e1d6193b70d59bb60e773f47b6d9aefdd56abc7cc.png"
39
- # need to cd to directory and then symlink
40
- target_sub_path, _divider, target_filename = target.rpartition("/")
41
- _symlink_sub_path, _divider, symlink_filename = symlink.rpartition("/")
42
- puts "React On Rails: Symlinking \"#{target}\" to \"#{symlink}\""
43
- dest_path = File.join(@assets_path, target_sub_path)
44
- FileUtils.chdir(dest_path) do
45
- File.symlink(target_filename, symlink_filename)
46
- end
31
+ valid_symlink_already_exists = File.exist?(symlink_path) && File.lstat(symlink_path).symlink?
32
+
33
+ if valid_symlink_already_exists
34
+ puts "React On Rails: Digested version of #{symlink} already exists indicating #{target} did not change."
35
+ return
36
+ end
37
+
38
+ if file_or_symlink_exists_at_path?(symlink_path)
39
+ puts "React On Rails: Removing existing invalid symlink or file #{symlink_path}"
40
+ `rm -f "#{symlink_path}"`
41
+ end
42
+
43
+ # Might be like:
44
+ # "images/5cf5db49df178f9357603f945752a1ef.png":
45
+ # "images/5cf5db49df178f9357603f945752a1ef-033650e1d6193b70d59bb60e773f47b6d9aefdd56abc7cc.png"
46
+ # need to cd to directory and then symlink
47
+ target_sub_path, _divider, target_filename = target.rpartition("/")
48
+ _symlink_sub_path, _divider, symlink_filename = symlink.rpartition("/")
49
+ dest_path = File.join(@assets_path, target_sub_path)
50
+
51
+ puts "React On Rails: Symlinking \"#{target}\" to \"#{symlink}\""
52
+ FileUtils.chdir(dest_path) do
53
+ File.symlink(target_filename, symlink_filename)
47
54
  end
48
55
  end
49
56
 
@@ -74,8 +81,10 @@ module ReactOnRails
74
81
  # already been symlinked by Webpack
75
82
  symlink_file(rails_digested_filename, original_filename)
76
83
 
77
- # We want the gz ones as well
78
- symlink_file("#{rails_digested_filename}.gz", "#{original_filename}.gz")
84
+ # We want the gz ones as well if they exist
85
+ if File.exist?(@assets_path.join("#{rails_digested_filename}.gz"))
86
+ symlink_file("#{rails_digested_filename}.gz", "#{original_filename}.gz")
87
+ end
79
88
  end
80
89
  end
81
90
  end
@@ -108,5 +117,14 @@ module ReactOnRails
108
117
  puts "Could not find generated_assets_dir #{dir} defined in react_on_rails initializer: "
109
118
  end
110
119
  end
120
+
121
+ private
122
+
123
+ def file_or_symlink_exists_at_path?(path)
124
+ File.lstat(path)
125
+ true
126
+ rescue
127
+ false
128
+ end
111
129
  end
112
130
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ReactOnRails
3
- VERSION = "6.1.0".freeze
3
+ VERSION = "6.1.1.rc.1".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "6.1.0",
3
+ "version": "6.1.1-rc.1",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -11,6 +11,7 @@
11
11
  "babel-core": "^6.7.4",
12
12
  "babel-loader": "^6.2.4",
13
13
  "babel-plugin-react-transform": "^2.0.2",
14
+ "babel-plugin-transform-flow-strip-types": "^6.8.0",
14
15
  "babel-plugin-transform-runtime": "^6.6.0",
15
16
  "babel-preset-es2015": "^6.6.0",
16
17
  "babel-preset-react": "^6.5.0",
@@ -25,6 +26,7 @@
25
26
  "eslint-plugin-import": "^1.13.0",
26
27
  "eslint-plugin-jsx-a11y": "^2.1.0",
27
28
  "eslint-plugin-react": "^6.1.2",
29
+ "flow-bin": "^0.30.0",
28
30
  "jscs": "^2.11.0",
29
31
  "jsdom": "^8.2.0",
30
32
  "react": "^15.0.0",
@@ -45,14 +47,16 @@
45
47
  "node_package/lib"
46
48
  ],
47
49
  "scripts": {
48
- "test": "node_package/scripts/test",
49
- "clean": "node_package/scripts/clean",
50
+ "test": "babel-tape-runner node_package/tests/*.js | tap-spec",
51
+ "clean": "rm -rf node_package/lib",
50
52
  "prepublish": "npm run build",
51
- "build": "node_package/scripts/build",
53
+ "babel": "babel --out-dir node_package/lib node_package/src",
54
+ "build": "npm run clean && npm run babel",
52
55
  "build-watch": "babel --watch --out-dir node_package/lib node_package/src",
53
56
  "eslint": "eslint .",
54
57
  "jscs": "jscs -e -v .",
55
- "lint": "npm run eslint && npm run jscs",
58
+ "flow": "flow check node_package",
59
+ "lint": "npm run eslint && npm run jscs && npm run flow",
56
60
  "lint:fix": "node_package/scripts/lint-fix",
57
61
  "check": "npm run lint && npm run test",
58
62
  "prerelease": "npm run check && npm run clean && npm run build",
data/rakelib/lint.rake CHANGED
@@ -28,8 +28,13 @@ namespace :lint do
28
28
  sh_in_dir(gem_root, "npm run jscs")
29
29
  end
30
30
 
31
- desc "Run all eslint, jscs, rubocop linters. Skip ruby-lint and scss"
32
- task lint: [:eslint, :jscs, :rubocop] do
31
+ desc "Run flow from shell"
32
+ task :flow do
33
+ sh_in_dir(gem_root, "npm run flow")
34
+ end
35
+
36
+ desc "Run all eslint, jscs, flow, rubocop linters. Skip ruby-lint and scss"
37
+ task lint: [:eslint, :jscs, :flow, :rubocop] do
33
38
  puts "Completed all linting"
34
39
  end
35
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.1.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -311,6 +311,7 @@ executables: []
311
311
  extensions: []
312
312
  extra_rdoc_files: []
313
313
  files:
314
+ - ".bookignore"
314
315
  - ".coveralls.yml"
315
316
  - ".dockerignore"
316
317
  - ".eslintignore"
@@ -330,7 +331,9 @@ files:
330
331
  - PROJECTS.md
331
332
  - README.md
332
333
  - Rakefile
334
+ - SUMMARY.md
333
335
  - app/helpers/react_on_rails_helper.rb
336
+ - book.json
334
337
  - docs/LICENSE
335
338
  - docs/additional-reading/babel.md
336
339
  - docs/additional-reading/heroku-deployment.md
@@ -452,9 +455,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
452
455
  version: '0'
453
456
  required_rubygems_version: !ruby/object:Gem::Requirement
454
457
  requirements:
455
- - - ">="
458
+ - - ">"
456
459
  - !ruby/object:Gem::Version
457
- version: '0'
460
+ version: 1.3.1
458
461
  requirements: []
459
462
  rubyforge_project:
460
463
  rubygems_version: 2.5.1