react_on_rails 11.2.1 → 12.0.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +320 -0
  3. data/.eslintignore +2 -1
  4. data/.eslintrc +23 -1
  5. data/.github/FUNDING.yml +1 -0
  6. data/.gitignore +3 -1
  7. data/.prettierignore +10 -1
  8. data/.prettierrc +3 -0
  9. data/.rubocop.yml +37 -11
  10. data/.travis.yml +10 -20
  11. data/CHANGELOG.md +85 -9
  12. data/CONTRIBUTING.md +60 -71
  13. data/Gemfile +3 -4
  14. data/{COMM-LICENSE → REACT-ON-RAILS-PRO-LICENSE} +6 -9
  15. data/README.md +121 -71
  16. data/Rakefile +0 -7
  17. data/SUMMARY.md +9 -12
  18. data/book.json +5 -5
  19. data/docs/additional-reading/asset-pipeline.md +8 -16
  20. data/docs/additional-reading/react-helmet.md +30 -10
  21. data/docs/additional-reading/react-router.md +52 -75
  22. data/docs/additional-reading/server-rendering-tips.md +12 -7
  23. data/docs/api/javascript-api.md +3 -3
  24. data/docs/api/redux-store-api.md +4 -2
  25. data/docs/api/view-helpers-api.md +8 -9
  26. data/docs/basics/configuration.md +68 -59
  27. data/docs/basics/deployment.md +1 -2
  28. data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +49 -0
  29. data/docs/basics/i18n.md +44 -22
  30. data/docs/basics/installation-into-an-existing-rails-app.md +2 -2
  31. data/docs/basics/minitest-configuration.md +31 -0
  32. data/docs/basics/react-server-rendering.md +1 -1
  33. data/docs/basics/{generator-functions-and-railscontext.md → render-functions-and-railscontext.md} +59 -21
  34. data/docs/basics/rspec-configuration.md +29 -17
  35. data/docs/basics/upgrading-react-on-rails.md +67 -3
  36. data/docs/basics/webpack-configuration.md +15 -1
  37. data/docs/contributor-info/errors-with-hooks.md +45 -0
  38. data/docs/contributor-info/pull-requests.md +44 -0
  39. data/docs/misc/doctrine.md +1 -1
  40. data/docs/{misc-pending → outdated}/code-splitting.md +12 -8
  41. data/docs/{additional-reading → outdated}/heroku-deployment.md +0 -6
  42. data/docs/{basics → outdated}/how-react-on-rails-works.md +3 -3
  43. data/docs/{misc-pending → outdated}/manual-installation-overview.md +5 -5
  44. data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
  45. data/docs/{misc-pending → outdated}/rails-assets.md +4 -7
  46. data/docs/{misc → outdated}/rails3.md +0 -0
  47. data/docs/testimonials/resortpass.md +13 -0
  48. data/docs/testimonials/testimonials.md +11 -1
  49. data/docs/tutorial.md +96 -70
  50. data/jest.config.js +4 -0
  51. data/lib/generators/react_on_rails/base_generator.rb +2 -2
  52. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
  53. data/lib/generators/react_on_rails/generator_helper.rb +4 -6
  54. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +3 -1
  55. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +26 -0
  56. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -40
  57. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +2 -1
  58. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +4 -8
  59. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
  60. data/lib/react_on_rails.rb +3 -1
  61. data/lib/react_on_rails/configuration.rb +13 -22
  62. data/lib/react_on_rails/error.rb +2 -0
  63. data/lib/react_on_rails/helper.rb +100 -143
  64. data/lib/react_on_rails/json_parse_error.rb +2 -0
  65. data/lib/react_on_rails/locales/base.rb +150 -0
  66. data/lib/react_on_rails/locales/to_js.rb +37 -0
  67. data/lib/react_on_rails/locales/to_json.rb +27 -0
  68. data/lib/react_on_rails/prerender_error.rb +11 -15
  69. data/lib/react_on_rails/react_component/render_options.rb +4 -0
  70. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +41 -46
  71. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
  72. data/lib/react_on_rails/utils.rb +14 -19
  73. data/lib/react_on_rails/version.rb +1 -1
  74. data/lib/react_on_rails/version_checker.rb +1 -0
  75. data/lib/react_on_rails/webpacker_utils.rb +13 -2
  76. data/lib/tasks/assets.rake +19 -44
  77. data/lib/tasks/locale.rake +4 -2
  78. data/package-scripts.yml +11 -8
  79. data/package.json +29 -28
  80. data/rakelib/dummy_apps.rake +1 -9
  81. data/rakelib/example_type.rb +3 -1
  82. data/rakelib/examples.rake +3 -0
  83. data/rakelib/lint.rake +2 -7
  84. data/rakelib/node_package.rake +2 -2
  85. data/rakelib/release.rake +0 -6
  86. data/rakelib/run_rspec.rake +5 -18
  87. data/react_on_rails.gemspec +3 -5
  88. data/tsconfig.json +14 -0
  89. data/webpackConfigLoader.js +3 -2
  90. data/yarn.lock +4170 -2197
  91. metadata +34 -57
  92. data/Gemfile.rails32 +0 -73
  93. data/docs/additional-reading/babel.md +0 -5
  94. data/docs/additional-reading/hot-reloading-rails-development-asset-pipeline.md +0 -47
  95. data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
  96. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
  97. data/lib/react_on_rails/assets_precompile.rb +0 -153
  98. data/lib/react_on_rails/locales_to_js.rb +0 -138
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "11.2.1".freeze
4
+ VERSION = "12.0.0-beta.2"
5
5
  end
@@ -5,6 +5,7 @@ module ReactOnRails
5
5
  # against each otherat runtime.
6
6
  class VersionChecker
7
7
  attr_reader :node_package_version
8
+
8
9
  MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/.freeze
9
10
 
10
11
  def self.build
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ReactOnRails
2
4
  module WebpackerUtils
3
5
  def self.using_webpacker?
@@ -10,7 +12,9 @@ module ReactOnRails
10
12
  Webpacker.dev_server.running?
11
13
  end
12
14
 
13
- # This returns either a URL for the webpack-dev-server or a file path
15
+ # This returns either a URL for the webpack-dev-server, non-server bundle or
16
+ # the hashed server bundle if using the same bundle for the client.
17
+ # Otherwise returns a file path.
14
18
  def self.bundle_js_uri_from_webpacker(bundle_name)
15
19
  # Note Webpacker 3.4.3 manifest lookup is inside of the public_output_path
16
20
  # [2] (pry) ReactOnRails::WebpackerUtils: 0> Webpacker.manifest.lookup("app-bundle.js")
@@ -18,7 +22,14 @@ module ReactOnRails
18
22
  # Next line will throw if the file or manifest does not exist
19
23
  hashed_bundle_name = Webpacker.manifest.lookup!(bundle_name)
20
24
 
21
- if Webpacker.dev_server.running?
25
+ # support for hashing the server-bundle and having that built
26
+ # by a webpack watch process and not served by the webpack-dev-server, then we
27
+ # need an extra config value "same_bundle_for_client_and_server" where a value of false
28
+ # would mean that the bundle is created by a separate webpack watch process.
29
+ is_server_bundle = bundle_name == ReactOnRails.configuration.server_bundle_js_file
30
+
31
+ if Webpacker.dev_server.running? && (!is_server_bundle ||
32
+ ReactOnRails.configuration.same_bundle_for_client_and_server)
22
33
  "#{Webpacker.dev_server.protocol}://#{Webpacker.dev_server.host_with_port}#{hashed_bundle_name}"
23
34
  else
24
35
  File.expand_path(File.join("public", hashed_bundle_name)).to_s
@@ -1,48 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "react_on_rails/assets_precompile"
4
- require "active_support"
5
-
6
- if defined?(Sprockets)
7
- namespace :react_on_rails do
8
- namespace :assets do
9
- desc "Creates non-digested symlinks for the assets in the public asset dir"
10
- task symlink_non_digested_assets: :"assets:environment" do
11
- ReactOnRails::AssetsPrecompile.new.symlink_non_digested_assets
12
- end
3
+ # Important: The default assets:precompile is modified ONLY if the rails/webpacker webpack config
4
+ # does not exist!
13
5
 
14
- desc "Cleans all broken symlinks for the assets in the public asset dir"
15
- task delete_broken_symlinks: :"assets:environment" do
16
- ReactOnRails::AssetsPrecompile.new.delete_broken_symlinks
17
- end
18
-
19
- # In this task, set prerequisites for the assets:precompile task
20
- desc <<-DESC.strip_heredoc
21
- Create webpack assets before calling assets:environment
22
- The webpack task must run before assets:environment task.
23
- Otherwise Sprockets cannot find the files that webpack produces.
24
- This is the secret sauce for how a Heroku deployment knows to create the webpack generated JavaScript files.
25
- DESC
26
- task compile_environment: :webpack do
27
- Rake::Task["assets:environment"].invoke
28
- end
6
+ require "active_support"
29
7
 
30
- desc "Delete assets created with webpack, in the generated assetst directory (/app/assets/webpack)"
31
- task clobber: :environment do
32
- ReactOnRails::AssetsPrecompile.new.clobber
33
- end
8
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
9
+ ENV["NODE_ENV"] ||= "development"
10
+ webpacker_webpack_config_abs_path = File.join(Rails.root, "config/webpack/#{ENV["NODE_ENV"]}.js")
11
+ webpack_config_path = Pathname.new(webpacker_webpack_config_abs_path).relative_path_from(Rails.root).to_s
12
+
13
+ unless File.exists?(webpacker_webpack_config_abs_path)
14
+ if Rake::Task.task_defined?("assets:precompile")
15
+ Rake::Task["assets:precompile"].enhance do
16
+ Rake::Task["react_on_rails:assets:webpack"].invoke
17
+ puts "Invoking task wepacker:clean from React on Rails"
18
+ Rake::Task["webpacker:clean"].invoke
34
19
  end
20
+ else
21
+ Rake::Task.define_task("assets:precompile" => ["react_on_rails:assets:webpack"])
35
22
  end
36
-
37
- # These tasks run as pre-requisites of assets:precompile.
38
- # Note, it's not possible to refer to ReactOnRails configuration values at this point.
39
- Rake::Task["assets:precompile"]
40
- .clear_prerequisites
41
- .enhance([:environment, "react_on_rails:assets:compile_environment"])
42
- .enhance do
43
- Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
44
- Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
45
- end
46
23
  end
47
24
 
48
25
  # Sprockets independent tasks
@@ -53,13 +30,11 @@ namespace :react_on_rails do
53
30
  Uses command defined with ReactOnRails.configuration.build_production_command
54
31
 
55
32
  sh "#{ReactOnRails::Utils.prepend_cd_node_modules_directory('<ReactOnRails.configuration.build_production_command>')}"
33
+
34
+ Note: This command is not automatically added to assets:precompile if the rails/webpacker
35
+ configuration file #{webpack_config_path} exists.
56
36
  DESC
57
37
  task webpack: :locale do
58
- if Rake::Task.task_defined?("webpacker:compile")
59
- # TODO: Eventually, this will need reconsideration if we use any of the Webpacker compilation
60
- Rake::Task["webpacker:compile"].clear
61
- end
62
-
63
38
  if ReactOnRails.configuration.build_production_command.present?
64
39
  sh ReactOnRails::Utils.prepend_cd_node_modules_directory(
65
40
  ReactOnRails.configuration.build_production_command
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "react_on_rails/locales_to_js"
3
+ require "react_on_rails/locales/base"
4
+ require "react_on_rails/locales/to_js"
5
+ require "react_on_rails/locales/to_json"
4
6
  require "active_support"
5
7
 
6
8
  namespace :react_on_rails do
@@ -10,6 +12,6 @@ namespace :react_on_rails do
10
12
  the "ReactOnRails.configuration.i18n_dir".
11
13
  DESC
12
14
  task locale: :environment do
13
- ReactOnRails::LocalesToJs.new
15
+ ReactOnRails::Locales.compile
14
16
  end
15
17
  end
@@ -1,12 +1,12 @@
1
1
  scripts:
2
2
  lint:
3
- description: Run all linters (eslint, flow)
3
+ description: Run all linters (eslint, tsc)
4
4
  script: concurrently --prefix "[{name}]" --names "ESLINT" -c "blue,yellow,magenta,orange" "nps eslint"
5
5
 
6
6
  eslint:
7
7
  default:
8
8
  description: Run eslint.
9
- script: eslint . --ext ".js,.jsx"
9
+ script: eslint . --ext ".js,.jsx,.ts"
10
10
  fix:
11
11
  description: Run eslint and auto-fix.
12
12
  script: nps "eslint --fix"
@@ -17,30 +17,33 @@ scripts:
17
17
  format:
18
18
  default:
19
19
  description: Format files using prettier.
20
- script: concurrently --prefix "[{name}]" --names "js,json" -c "yellow,magenta,green" "nps format.js" "nps format.json"
20
+ script: concurrently --prefix "[{name}]" --names "ts,js,json" -c "yellow,magenta,green" "nps format.js" "nps format.json"
21
21
  listDifferent:
22
22
  description: Check that all files were formatted using prettier.
23
23
  script: |
24
24
  concurrently \
25
25
  --prefix "[{name}]" \
26
- --names "js,css,json" \
27
- -c "yellow,magenta,green" \
26
+ --names "ts,js,json" \
27
+ -c "yellow,magenta" \
28
28
  "nps format.js.listDifferent" \
29
29
  "nps format.json.listDifferent"
30
30
  js:
31
31
  default:
32
32
  description: Run prettier-eslint on JS.
33
- script: prettier "packages/**/*.@(js|jsx)" "spec/dummy/client/app/**/*.@(js|jsx)" "webpack.config.babel.js" "webpack/**/*.js" --write
33
+ #script: prettier "packages/**/*.@(js|jsx)" "spec/dummy/client/app/**/*.@(js|jsx)" "webpack.config.babel.js" "webpack/**/*.js" --write
34
+ script: prettier "**/*.@(js|jsx)" --write
34
35
  listDifferent:
35
36
  description: Check if any JS files would change by running prettier-eslint.
36
- script: prettier "**/*.@(js|jsx)" "webpack.config.babel.js" "webpack/**/*.js" --list-different
37
+ # script: prettier "**/*.@(js|jsx)" "webpack.config.babel.js" "webpack/**/*.js" --list-different
38
+ script: prettier "**/*.@(js|jsx)" --list-different
37
39
  json:
38
40
  default:
39
41
  description: Run prettier on JSON files.
40
42
  script: rm -rf packages/vm-renderer/tests/tmp && prettier "**/*.json" --write
41
43
  listDifferent:
42
44
  description: Check if any JSON files would change by running prettier-eslint.
43
- script: prettier "**/*.json" "../spec/**/*.json" --list-different
45
+ script: prettier "**/*.json" --list-different
46
+
44
47
  renderer:
45
48
  description: Starts the node renderer.
46
49
  script: node renderer.js
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "11.2.1",
3
+ "version": "12.0.0-beta.2",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -9,70 +9,75 @@
9
9
  "devDependencies": {
10
10
  "@babel/cli": "^7.0.0",
11
11
  "@babel/core": "^7.0.0",
12
- "@babel/plugin-transform-flow-strip-types": "^7.0.0",
13
12
  "@babel/plugin-transform-runtime": "^7.0.0",
13
+ "@babel/plugin-transform-typescript": "^7.8.7",
14
14
  "@babel/preset-env": "^7.0.0",
15
15
  "@babel/preset-react": "^7.0.0",
16
16
  "@babel/types": "^7.0.0",
17
+ "@types/jest": "^25.1.4",
18
+ "@types/node": "^13.9.0",
19
+ "@types/react": "^16.9.23",
20
+ "@types/react-dom": "^16.9.5",
21
+ "@types/turbolinks": "^5.2.0",
22
+ "@typescript-eslint/eslint-plugin": "^2.23.0",
23
+ "@typescript-eslint/parser": "^2.23.0",
17
24
  "babel-loader": "^8.0.2",
18
- "babel-tape-runner": "^3.0.0",
19
25
  "babelify": "^10.0.0",
20
26
  "blue-tape": "^1.0.0",
21
27
  "create-react-class": "^15.6.0",
22
- "eslint": "^5.7.0",
23
- "eslint-config-prettier": "^3.1.0",
28
+ "eslint": "^6.8.0",
29
+ "eslint-config-prettier": "^6.10.1",
24
30
  "eslint-config-shakacode": "^16.0.1",
25
31
  "eslint-plugin-import": "^2.6.1",
26
32
  "eslint-plugin-jsx-a11y": "^6.1.2",
27
33
  "eslint-plugin-prettier": "^3.0.0",
28
34
  "eslint-plugin-react": "^7.1.0",
29
- "flow-bin": "^0.83.0",
35
+ "jest": "^25.1.0",
30
36
  "jsdom": "^11.1.0",
31
37
  "nps": "^5.9.3",
32
- "prettier": "^1.14.3",
33
- "prettier-eslint-cli": "^4.7.1",
38
+ "prettier": "^2.0.1",
39
+ "prettier-eslint-cli": "^5.0.0",
34
40
  "prop-types": "^15.5.10",
35
41
  "react": "^16.5.2",
36
42
  "react-dom": "^16.5.2",
37
43
  "react-transform-hmr": "^1.0.4",
38
44
  "redux": "^4.0.1",
39
45
  "release-it": "^8.2.0",
40
- "tap-spec": "^5.0.0",
41
- "tape": "^4.7.0",
46
+ "ts-jest": "^25.2.1",
47
+ "tslint-config-prettier": "^1.18.0",
48
+ "typescript": "^3.8.3",
42
49
  "webpack": "^3.4.1",
43
50
  "webpack-manifest-plugin": "^1.2.1"
44
51
  },
45
52
  "dependencies": {
46
- "@babel/runtime-corejs2": "^7.0.0"
53
+ "@babel/runtime-corejs3": "^7.9.6",
54
+ "concurrently": "^5.1.0"
47
55
  },
48
56
  "peerDependencies": {
49
57
  "js-yaml": ">= 3.0.0",
50
- "react": ">= 0.14",
51
- "react-dom": ">= 0.14"
58
+ "react": ">= 16",
59
+ "react-dom": ">= 16"
52
60
  },
53
61
  "files": [
54
62
  "node_package/lib",
55
63
  "webpackConfigLoader.js"
56
64
  ],
57
65
  "scripts": {
58
- "test": "babel-tape-runner -r node_package/tests/helpers/test_helper.js node_package/tests/*.js | tap-spec",
66
+ "test": "jest node_package/tests",
59
67
  "clean": "rm -rf node_package/lib",
68
+ "start": "nps",
60
69
  "prepare": "yarn run build",
61
- "prepublish": "npm run prepare",
62
- "babel": "babel --out-dir node_package/lib node_package/src",
63
- "build": "yarn run clean && yarn run babel",
64
- "build-watch": "babel --watch --out-dir node_package/lib node_package/src",
65
- "eslint": "eslint .",
66
- "flow": "flow check node_package",
67
- "lint": "yarn run eslint && yarn run flow",
68
- "check": "yarn run lint && yarn run flow && yarn run test",
70
+ "build": "yarn run clean && yarn run tsc --declaration",
71
+ "build-watch": "yarn run clean && yarn run tsc --watch",
72
+ "lint": "nps eslint",
73
+ "check": "yarn run lint && yarn run test && yarn run type-check",
74
+ "type-check": "yarn run tsc --noEmit --noErrorTruncation",
69
75
  "prerelease": "yarn run check && yarn run clean && yarn run build",
70
76
  "release:patch": "node_package/scripts/release patch",
71
77
  "release:minor": "node_package/scripts/release minor",
72
78
  "release:major": "node_package/scripts/release major",
73
79
  "dummy:install": "rake dummy_apps",
74
- "dummy:spec": "rake run_rspec:dummy",
75
- "install-react-on-rails": "yarn link"
80
+ "dummy:spec": "rake run_rspec:dummy"
76
81
  },
77
82
  "repository": {
78
83
  "type": "git",
@@ -91,9 +96,5 @@
91
96
  "bugs": {
92
97
  "url": "https://github.com/shakacode/react_on_rails/issues"
93
98
  },
94
- "jest": {
95
- "verbose": true,
96
- "testURL": "http://localhost/"
97
- },
98
99
  "homepage": "https://github.com/shakacode/react_on_rails#readme"
99
100
  }
@@ -8,6 +8,7 @@ namespace :dummy_apps do
8
8
  task :yarn_install do
9
9
  yarn_install_cmd = "yarn install --mutex network"
10
10
  sh_in_dir(dummy_app_dir, yarn_install_cmd)
11
+ sh_in_dir(dummy_app_dir, "yalc link react-on-rails")
11
12
  end
12
13
 
13
14
  task dummy_app: [:yarn_install] do
@@ -15,15 +16,6 @@ namespace :dummy_apps do
15
16
  bundle_install_in(dummy_app_dir)
16
17
  end
17
18
 
18
- task :dummy_no_webpacker do
19
- npm_install_cmd = "npm install"
20
- install_react_on_rails_cmd = "yarn run install-react-on-rails"
21
- dummy_app_dir = File.join(gem_root, "spec/dummy_no_webpacker")
22
- sh_in_dir(File.join(gem_root, "spec/dummy_no_webpacker/client"), npm_install_cmd)
23
- sh_in_dir(dummy_app_dir, install_react_on_rails_cmd)
24
- sh_in_dir(dummy_app_dir, "BUNDLE_GEMFILE=Gemfile.rails32 bundle install")
25
- end
26
-
27
19
  task dummy_apps: %i[dummy_app node_package] do
28
20
  puts "Prepared all Dummy Apps"
29
21
  end
@@ -49,8 +49,10 @@ module ReactOnRails
49
49
  end
50
50
 
51
51
  # Options we pass when running `rails new` from the command-line.
52
+ attr_writer :rails_options
53
+
52
54
  def rails_options
53
- "--skip-bundle --skip-spring --skip-git --skip-test-unit --skip-active-record"
55
+ @rails_options ||= "--skip-bundle --skip-spring --skip-git --skip-test-unit --skip-active-record"
54
56
  end
55
57
 
56
58
  %w[gen clobber npm_install build_webpack_bundles].each do |task_type|
@@ -6,6 +6,8 @@
6
6
  # Also see example_type.rb
7
7
 
8
8
  require "yaml"
9
+ require 'rails/version'
10
+
9
11
  require_relative "example_type"
10
12
  require_relative "task_helpers"
11
13
 
@@ -28,6 +30,7 @@ namespace :examples do # rubocop:disable Metrics/BlockLength
28
30
  desc "Generates #{example_type.name_pretty}"
29
31
  task example_type.gen_task_name_short => example_type.clobber_task_name do
30
32
  mkdir_p(example_type.dir)
33
+ example_type.rails_options += " --webpack" if Rails.version >= "5.1" && Rails.version < "6"
31
34
  sh_in_dir(examples_dir, "rails new #{example_type.name} #{example_type.rails_options}")
32
35
  sh_in_dir(example_type.dir, "touch .gitignore")
33
36
  sh_in_dir(example_type.dir, "rake webpacker:install")
@@ -26,13 +26,8 @@ namespace :lint do # rubocop:disable Metrics/BlockLength
26
26
  sh_in_dir(gem_root, "yarn run eslint")
27
27
  end
28
28
 
29
- desc "Run flow from shell"
30
- task :flow do
31
- sh_in_dir(gem_root, "yarn run flow")
32
- end
33
-
34
- desc "Run all eslint, flow, rubocop linters. Skip ruby-lint and scss"
35
- task lint: %i[eslint flow rubocop] do
29
+ desc "Run all eslint & rubocop linters. Skip ruby-lint and scss"
30
+ task lint: %i[eslint rubocop] do
36
31
  puts "Completed all linting"
37
32
  end
38
33
  end
@@ -6,8 +6,8 @@ namespace :node_package do
6
6
  include ReactOnRails::TaskHelpers
7
7
 
8
8
  task :build do
9
- puts "Building Node Package and running 'yarn link'"
10
- sh "yarn run build && yarn link"
9
+ puts "Building Node Package and running 'yalc publish'"
10
+ sh "yarn run build && yalc publish"
11
11
  end
12
12
  end
13
13
 
@@ -69,12 +69,6 @@ task :release, %i[gem_version dry_run tools_install] do |_t, args|
69
69
  # Release the new gem version
70
70
  unless is_dry_run
71
71
  sh_in_dir(gem_root, "gem release")
72
-
73
- # Update master with new npm version
74
- sleep 5 # short pause to make sure npmjs has time to update
75
- sh_in_dir(File.join(gem_root, "spec", "dummy", "client"), "yarn add react-on-rails@#{npm_version} --exact")
76
- sh_in_dir(gem_root, "git commit -am 'Updated spec/dummy/client/package.json latest version'")
77
- sh_in_dir(gem_root, "git push")
78
72
  end
79
73
  end
80
74
  # rubocop:enable Metrics/BlockLength
@@ -18,16 +18,6 @@ namespace :run_rspec do
18
18
  run_tests_in("", rspec_args: File.join("spec", "react_on_rails"))
19
19
  end
20
20
 
21
- desc "Run RSpec with rails32 gemfile"
22
- task :gem_rails32 do
23
- rspec_args = "spec/react_on_rails --tag ~webpacker --exclude-pattern "\
24
- "\"**/generators/*_spec.rb,"\
25
- "**/test_helper/webpack_*_spec.rb\""
26
- run_tests_in("",
27
- rspec_args: rspec_args,
28
- env_vars: "BUNDLE_GEMFILE=spec/dummy_no_webpacker/Gemfile.rails32")
29
- end
30
-
31
21
  desc "Runs dummy rspec with turbolinks"
32
22
  task dummy: ["dummy_apps:dummy_app"] do
33
23
  clean_gen_assets(spec_dummy_dir)
@@ -44,14 +34,6 @@ namespace :run_rspec do
44
34
  command_name: "dummy_no_turbolinks")
45
35
  end
46
36
 
47
- desc "Runs dummy_no_webpacker rspec"
48
- task :dummy_no_webpacker do
49
- dummy_app_dir = File.join(gem_root, "spec/dummy_no_webpacker")
50
- clean_gen_assets(dummy_app_dir)
51
- run_tests_in(dummy_app_dir,
52
- env_vars: "BUNDLE_GEMFILE=Gemfile.rails32")
53
- end
54
-
55
37
  # Dynamically define Rake tasks for each example app found in the examples directory
56
38
  ExampleType.all.each do |example_type|
57
39
  desc "Runs RSpec for #{example_type.name_pretty} only"
@@ -77,6 +59,11 @@ namespace :run_rspec do
77
59
  puts "Completed all RSpec tests"
78
60
  end
79
61
 
62
+ desc "run all dummy tests"
63
+ task all_dummy: %i[dummy_no_turbolinks dummy] do
64
+ puts "Completed all RSpec tests"
65
+ end
66
+
80
67
  desc "run all tests"
81
68
  task run_rspec: %i[all_but_examples examples] do
82
69
  puts "Completed all RSpec tests"