react_on_rails 13.4.0 → 14.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -2
  3. data/Gemfile.development_dependencies +10 -9
  4. data/Gemfile.lock +434 -0
  5. data/README.md +25 -17
  6. data/lib/generators/react_on_rails/base_generator.rb +3 -2
  7. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
  8. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +1 -1
  9. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +2 -2
  10. data/lib/generators/react_on_rails/templates/dev_tests/spec/system/hello_world_spec.rb +1 -1
  11. data/lib/react_on_rails/configuration.rb +39 -25
  12. data/lib/react_on_rails/git_utils.rb +3 -3
  13. data/lib/react_on_rails/helper.rb +3 -4
  14. data/lib/react_on_rails/json_output.rb +0 -17
  15. data/lib/react_on_rails/locales/base.rb +4 -4
  16. data/lib/react_on_rails/locales/to_js.rb +1 -1
  17. data/lib/react_on_rails/packs_generator.rb +5 -6
  18. data/lib/react_on_rails/react_component/render_options.rb +1 -1
  19. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +9 -9
  20. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +3 -3
  21. data/lib/react_on_rails/test_helper.rb +2 -2
  22. data/lib/react_on_rails/utils.rb +2 -8
  23. data/lib/react_on_rails/version.rb +1 -1
  24. data/lib/react_on_rails/version_checker.rb +2 -2
  25. data/lib/react_on_rails/webpacker_utils.rb +6 -0
  26. data/lib/tasks/assets.rake +1 -1
  27. data/react_on_rails.gemspec +4 -4
  28. metadata +5 -132
  29. data/.bookignore +0 -15
  30. data/.circleci/config.yml +0 -338
  31. data/.coveralls.yml +0 -1
  32. data/.dockerignore +0 -2
  33. data/.eslintignore +0 -17
  34. data/.eslintrc +0 -53
  35. data/.github/FUNDING.yml +0 -1
  36. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
  37. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  38. data/.github/PULL_REQUEST_TEMPLATE.md +0 -19
  39. data/.github/workflows/lint-js-and-ruby.yml +0 -54
  40. data/.github/workflows/main.yml +0 -183
  41. data/.github/workflows/package-js-tests.yml +0 -35
  42. data/.github/workflows/rspec-package-specs.yml +0 -46
  43. data/.gitignore +0 -33
  44. data/.npmignore +0 -22
  45. data/.prettierignore +0 -14
  46. data/.prettierrc +0 -20
  47. data/.rspec +0 -2
  48. data/.rubocop.yml +0 -134
  49. data/.scss-lint.yml +0 -205
  50. data/.travis.yml +0 -61
  51. data/book.json +0 -18
  52. data/docs/additional-details/generator-details.md +0 -56
  53. data/docs/additional-details/manual-installation-overview.md +0 -30
  54. data/docs/additional-details/migrating-from-react-rails.md +0 -17
  55. data/docs/additional-details/recommended-project-structure.md +0 -69
  56. data/docs/additional-details/tips-for-usage-with-sp6.md +0 -15
  57. data/docs/additional-details/updating-dependencies.md +0 -31
  58. data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +0 -10
  59. data/docs/api/javascript-api.md +0 -99
  60. data/docs/api/redux-store-api.md +0 -102
  61. data/docs/api/view-helpers-api.md +0 -133
  62. data/docs/contributor-info/errors-with-hooks.md +0 -45
  63. data/docs/contributor-info/generator-testing.md +0 -11
  64. data/docs/contributor-info/linters.md +0 -68
  65. data/docs/contributor-info/pull-requests.md +0 -42
  66. data/docs/contributor-info/releasing.md +0 -76
  67. data/docs/deployment/elastic-beanstalk.md +0 -63
  68. data/docs/deployment/heroku-deployment.md +0 -39
  69. data/docs/getting-started.md +0 -196
  70. data/docs/guides/client-vs-server-rendering.md +0 -27
  71. data/docs/guides/configuration.md +0 -289
  72. data/docs/guides/deployment.md +0 -5
  73. data/docs/guides/file-system-based-automated-bundle-generation.md +0 -197
  74. data/docs/guides/hmr-and-hot-reloading-with-the-webpack-dev-server.md +0 -104
  75. data/docs/guides/how-react-on-rails-works.md +0 -44
  76. data/docs/guides/how-to-conditionally-server-render-based-on-device-type.md +0 -40
  77. data/docs/guides/how-to-use-different-files-for-client-and-server-rendering.md +0 -98
  78. data/docs/guides/i18n.md +0 -87
  79. data/docs/guides/installation-into-an-existing-rails-app.md +0 -66
  80. data/docs/guides/minitest-configuration.md +0 -31
  81. data/docs/guides/rails-webpacker-react-integration-options.md +0 -213
  82. data/docs/guides/react-on-rails-overview.md +0 -29
  83. data/docs/guides/react-server-rendering.md +0 -32
  84. data/docs/guides/render-functions-and-railscontext.md +0 -205
  85. data/docs/guides/rspec-configuration.md +0 -73
  86. data/docs/guides/tutorial.md +0 -371
  87. data/docs/guides/upgrading-react-on-rails.md +0 -304
  88. data/docs/guides/webpack-configuration.md +0 -42
  89. data/docs/home.md +0 -23
  90. data/docs/javascript/angular-js-integration-migration.md +0 -28
  91. data/docs/javascript/asset-pipeline.md +0 -12
  92. data/docs/javascript/capistrano-deployment.md +0 -18
  93. data/docs/javascript/code-splitting.md +0 -165
  94. data/docs/javascript/converting-from-custom-webpack-config-to-rails-webpacker-config.md +0 -10
  95. data/docs/javascript/credits.md +0 -10
  96. data/docs/javascript/foreman-issues.md +0 -15
  97. data/docs/javascript/images.md +0 -57
  98. data/docs/javascript/node-dependencies-and-npm.md +0 -19
  99. data/docs/javascript/react-and-redux.md +0 -36
  100. data/docs/javascript/react-helmet.md +0 -100
  101. data/docs/javascript/react-router.md +0 -90
  102. data/docs/javascript/server-rendering-tips.md +0 -55
  103. data/docs/javascript/troubleshooting-when-using-shakapacker.md +0 -77
  104. data/docs/javascript/troubleshooting-when-using-webpacker.md +0 -90
  105. data/docs/javascript/webpack-v1-notes.md +0 -23
  106. data/docs/javascript/webpack.md +0 -22
  107. data/docs/misc/articles.md +0 -20
  108. data/docs/misc/code_of_conduct.md +0 -13
  109. data/docs/misc/doctrine.md +0 -77
  110. data/docs/misc/style.md +0 -33
  111. data/docs/misc/tips.md +0 -10
  112. data/docs/outdated/deferred-rendering.md +0 -39
  113. data/docs/outdated/rails-assets-relative-paths.md +0 -195
  114. data/docs/outdated/rails-assets.md +0 -77
  115. data/docs/outdated/rails3.md +0 -9
  116. data/docs/rails/convert-rails-5-api-only-app.md +0 -19
  117. data/docs/rails/rails-engine-integration.md +0 -32
  118. data/docs/rails/rails_view_rendering_from_inline_javascript.md +0 -36
  119. data/docs/rails/turbolinks.md +0 -124
  120. data/docs/react-on-rails-pro/react-on-rails-pro.md +0 -43
  121. data/docs/testimonials/hvmn.md +0 -25
  122. data/docs/testimonials/resortpass.md +0 -13
  123. data/docs/testimonials/testimonials.md +0 -28
  124. data/jest.config.js +0 -4
  125. data/package-scripts.yml +0 -49
  126. data/package.json +0 -96
  127. data/rakelib/docker.rake +0 -26
  128. data/rakelib/dummy_apps.rake +0 -30
  129. data/rakelib/example_type.rb +0 -96
  130. data/rakelib/examples.rake +0 -64
  131. data/rakelib/examples_config.yml +0 -14
  132. data/rakelib/lint.rake +0 -30
  133. data/rakelib/node_package.rake +0 -15
  134. data/rakelib/release.rake +0 -92
  135. data/rakelib/run_rspec.rake +0 -103
  136. data/rakelib/task_helpers.rb +0 -62
  137. data/script/bootstrap +0 -33
  138. data/script/release +0 -3
  139. data/script/setup +0 -23
  140. data/script/test +0 -38
  141. data/webpackConfigLoader.js +0 -71
  142. data/yarn.lock +0 -7010
data/script/bootstrap DELETED
@@ -1,33 +0,0 @@
1
- #!/bin/sh
2
-
3
- # script/bootstrap: Resolve all dependencies that the application requires to
4
- # run.
5
-
6
- set -e
7
-
8
- cd "$(dirname "$0")/.."
9
-
10
- if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
11
- brew update
12
-
13
- brew bundle check 2>&1 >/dev/null || {
14
- echo "==> Installing Homebrew dependencies…"
15
- brew bundle
16
- }
17
- fi
18
-
19
- if [ -f ".ruby-version" ] && [ -z "$(rbenv version-name 2>/dev/null)" ]; then
20
- echo "==> Installing Ruby…"
21
- rbenv install --skip-existing
22
- which bundle 2>&1 >/dev/null || {
23
- gem install bundler
24
- rbenv rehash
25
- }
26
- fi
27
-
28
- if [ -f "Gemfile" ]; then
29
- echo "==> Installing gem dependencies…"
30
- bundle check --path vendor/gems 2>&1 >/dev/null || {
31
- bundle install --path vendor/gems --quiet --without production
32
- }
33
- fi
data/script/release DELETED
@@ -1,3 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo "See `rake -D release`"
data/script/setup DELETED
@@ -1,23 +0,0 @@
1
- #!/bin/sh
2
-
3
- # script/setup: Set up application for the first time after cloning, or set it
4
- # back to the initial first unused state.
5
-
6
- set -e
7
-
8
- cd "$(dirname "$0")/.."
9
-
10
- script/bootstrap
11
-
12
- echo "===> Setting up DB..."
13
- # reset database to a fresh state.
14
- bin/rake db:create db:reset
15
-
16
- if [ -z "$RAILS_ENV" ] && [ -z "$RACK_ENV" ]; then
17
- # Only things for a development environment will run inside here
18
- # Do things that need to be done to the application to set up for the first
19
- # time. Or things needed to be run to to reset the application back to first
20
- # use experience. These things are scoped to the application's domain.
21
- fi
22
-
23
- echo "==> App is now ready to go!"
data/script/test DELETED
@@ -1,38 +0,0 @@
1
- #!/bin/sh
2
-
3
- # script/test: Run test suite for application. Optionally pass in a path to an
4
- # individual test file to run a single test.
5
-
6
-
7
- set -e
8
-
9
- cd "$(dirname "$0")/.."
10
-
11
- [ -z "$DEBUG" ] || set -x
12
-
13
- export RACK_ROOT=$(cd "$(dirname $0)"/.. && pwd)
14
-
15
- if [ "$RAILS_ENV" = "test" ] || [ "$RACK_ENV" = "test" ]; then
16
- # if executed and the environment is already set to `test`, then we want a
17
- # clean from scratch application. This almost always means a ci environment,
18
- # since we set the environment to `test` directly in `script/cibuild`.
19
- script/setup
20
- else
21
- # if the environment isn't set to `test`, set it to `test` and update the
22
- # application to ensure all dependencies are met as well as any other things
23
- # that need to be up to date, like db migrations. The environement not having
24
- # already been set to `test` almost always means this is being called on it's
25
- # own from a `development` environment.
26
- export RAILS_ENV="test" RACK_ENV="test"
27
-
28
- script/update
29
- fi
30
-
31
- echo "===> Running tests..."
32
-
33
- if [ -n "$1" ]; then
34
- # pass arguments to test call. This is useful for calling a single test.
35
- bin/rake test "$1"
36
- else
37
- bin/rake test
38
- fi
@@ -1,71 +0,0 @@
1
- /**
2
- * TODO: THIS SHOULD BE REMOVED
3
- *
4
- * Allow defaults for the config/webpacker.yml. Thee values in this file MUST match values
5
- * in https://github.com/rails/webpacker/blob/master/lib/install/config/webpacker.yml
6
- *
7
- * NOTE: for HMR reloading, env.WEBPACKER_HMR value will override any config value. This env value
8
- * should be set to TRUE to turn this on.
9
- */
10
-
11
- const { join, resolve } = require('path');
12
- const { env } = require('process');
13
- const { safeLoad } = require('js-yaml');
14
- const { readFileSync } = require('fs');
15
-
16
- function removeOuterSlashes(string) {
17
- return string.replace(/^\/*/, '').replace(/\/*$/, '');
18
- }
19
-
20
- function formatPublicPath(settings) {
21
- if (settings.dev_server) {
22
- const { host } = settings.dev_server;
23
- const { port } = settings.dev_server;
24
- const path = settings.public_output_path;
25
- const hostWithHttp = `http://${host}:${port}`;
26
-
27
- let formattedHost = removeOuterSlashes(hostWithHttp);
28
- if (formattedHost && !/^http/i.test(formattedHost)) {
29
- formattedHost = `//${formattedHost}`;
30
- }
31
- const formattedPath = removeOuterSlashes(path);
32
- return `${formattedHost}/${formattedPath}/`;
33
- }
34
-
35
- const publicOuterPathWithoutOutsideSlashes = removeOuterSlashes(settings.public_output_path);
36
- return `//${publicOuterPathWithoutOutsideSlashes}/`;
37
- }
38
-
39
- /**
40
- * @param configPath, location where webpacker.yml will be found
41
- * Return values are consistent with Webpacker's js helpers
42
- * For example, you might define:
43
- * const isHMR = settings.dev_server && settings.dev_server.hmr
44
- * @returns {{
45
- settings,
46
- resolvedModules,
47
- output: { path, publicPath, publicPathWithHost }
48
- }}
49
- */
50
- const configLoader = (configPath) => {
51
- // Some test environments might not have the NODE_ENV set, so we'll have fallbacks.
52
- const configEnv = env.NODE_ENV || env.RAILS_ENV || 'development';
53
- const ymlConfigPath = join(configPath, 'webpacker.yml');
54
- const settings = safeLoad(readFileSync(ymlConfigPath, 'utf8'))[configEnv];
55
-
56
- // NOTE: Rails path is hard coded to `/public`
57
- const output = {
58
- // Next line differs from the webpacker definition as we use the configPath to create
59
- // the relative path.
60
- path: resolve(configPath, '..', 'public', settings.public_output_path),
61
- publicPath: `/${settings.public_output_path}/`.replace(/([^:]\/)\/+/g, '$1'),
62
- publicPathWithHost: formatPublicPath(settings),
63
- };
64
-
65
- return {
66
- settings,
67
- output,
68
- };
69
- };
70
-
71
- module.exports = configLoader;