react_on_rails 4.0.0.beta.1 → 4.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintignore +1 -0
  3. data/.gitignore +2 -1
  4. data/.jscsrc +1 -0
  5. data/.rubocop.yml +3 -0
  6. data/.travis.yml +1 -1
  7. data/CHANGELOG.md +12 -4
  8. data/Gemfile +0 -5
  9. data/README.md +10 -3
  10. data/Rakefile +3 -0
  11. data/app/helpers/react_on_rails_helper.rb +21 -18
  12. data/docs/additional_reading/manual_installation.md +2 -2
  13. data/docs/additional_reading/optional_configuration.md +1 -1
  14. data/docs/additional_reading/rspec_configuration.md +3 -1
  15. data/docs/additional_reading/turbolinks.md +4 -3
  16. data/docs/contributing.md +1 -1
  17. data/docs/tutorial-v2.md +1 -1
  18. data/lib/generators/react_on_rails/base_generator.rb +20 -16
  19. data/lib/generators/react_on_rails/bootstrap_generator.rb +1 -1
  20. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hot.tt +1 -1
  21. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +1 -1
  22. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +1 -1
  23. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +11 -1
  24. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt +1 -1
  25. data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +1 -1
  26. data/lib/react_on_rails/configuration.rb +51 -11
  27. data/lib/react_on_rails/controller.rb +2 -2
  28. data/lib/react_on_rails/server_rendering_pool.rb +2 -2
  29. data/lib/react_on_rails/test_helper.rb +31 -25
  30. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +84 -34
  31. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +20 -12
  32. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +35 -32
  33. data/lib/react_on_rails/test_helper/webpack_process_checker.rb +17 -13
  34. data/lib/react_on_rails/utils.rb +5 -0
  35. data/lib/react_on_rails/version.rb +1 -1
  36. data/package.json +1 -2
  37. data/rakelib/node_package.rake +1 -8
  38. data/rakelib/run_rspec.rake +29 -10
  39. metadata +3 -3
@@ -21,6 +21,6 @@ namespace :assets do
21
21
  end
22
22
 
23
23
  task :clobber do
24
- rm_r Dir.glob(Rails.root.join("app/assets/javascripts/generated/*"))
24
+ rm_r Dir.glob(Rails.root.join("app/assets/webpack/*"))
25
25
  end
26
26
  end
@@ -16,7 +16,7 @@ module.exports = {
16
16
  ],
17
17
  output: {
18
18
  filename: 'server-bundle.js',
19
- path: '../app/assets/javascripts/generated',
19
+ path: '../app/assets/webpack',
20
20
  },
21
21
  resolve: {
22
22
  extensions: ['', '.js', '.jsx'],
@@ -1,15 +1,50 @@
1
1
  module ReactOnRails
2
2
  def self.configure
3
3
  yield(configuration)
4
+ setup_config_values
4
5
  end
5
6
 
6
- DEFAULT_GENERATED_ASSETS_DIRS = [
7
- %w(app assets webpack)
8
- ].map { |dirs| File.join(*dirs) }.freeze
7
+ DEFAULT_GENERATED_ASSETS_DIR = File.join(%w(app assets webpack)).freeze
8
+
9
+ def self.setup_config_values
10
+ if @configuration.webpack_generated_files.empty?
11
+ files = ["client-bundle.js"]
12
+ if @configuration.server_bundle_js_file.present?
13
+ files << @configuration.server_bundle_js_file
14
+ end
15
+ @configuration.webpack_generated_files = files
16
+ end
17
+
18
+ if @configuration.generated_assets_dirs.present?
19
+ puts "[DEPRECATION] ReactOnRails: Use config.generated_assets_dir rather than "\
20
+ "generated_assets_dirs"
21
+ if @configuration.generated_assets_dir.blank?
22
+ @configuration.generated_assets_dir = @configuration.generated_assets_dirs
23
+ else
24
+ puts "[DEPRECATION] ReactOnRails. You have both generated_assets_dirs and "\
25
+ "generated_assets_dir defined. Define ONLY generated_assets_dir"
26
+ end
27
+ end
28
+
29
+ if @configuration.generated_assets_dir.blank?
30
+ @configuration.generated_assets_dir = DEFAULT_GENERATED_ASSETS_DIR
31
+ puts "ReactOnRails: Set generated_assets_dir to default: #{DEFAULT_GENERATED_ASSETS_DIR}"
32
+ end
33
+
34
+ if @configuration.server_bundle_js_file.include?(File::SEPARATOR)
35
+ puts "[DEPRECATION] ReactOnRails: remove path from server_bundle_js_file in configuration. "\
36
+ "All generated files must go in #{@configuration.generated_assets_dir}"
37
+ @configuration.server_bundle_js_file = File.basename(@configuration.server_bundle_js_file)
38
+ end
39
+ end
9
40
 
10
41
  def self.configuration
11
42
  @configuration ||= Configuration.new(
12
- generated_assets_dirs: DEFAULT_GENERATED_ASSETS_DIRS,
43
+ generated_assets_dirs: nil,
44
+
45
+ # generated_assets_dirs is deprecated
46
+ generated_assets_dir: "",
47
+
13
48
  server_bundle_js_file: "",
14
49
  prerender: false,
15
50
  replay_console: true,
@@ -19,7 +54,9 @@ module ReactOnRails
19
54
  development_mode: Rails.env.development?,
20
55
  server_renderer_pool_size: 1,
21
56
  server_renderer_timeout: 20,
22
- skip_display_none: false)
57
+ skip_display_none: false,
58
+ webpack_generated_files: []
59
+ )
23
60
  end
24
61
 
25
62
  class Configuration
@@ -27,18 +64,19 @@ module ReactOnRails
27
64
  :trace, :development_mode,
28
65
  :logging_on_server, :server_renderer_pool_size,
29
66
  :server_renderer_timeout, :raise_on_prerender_error,
30
- :skip_display_none, :generated_assets_dirs
67
+ :skip_display_none, :generated_assets_dirs, :generated_assets_dir,
68
+ :webpack_generated_files
31
69
 
32
70
  def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil,
33
71
  trace: nil, development_mode: nil,
34
72
  logging_on_server: nil, server_renderer_pool_size: nil,
35
73
  server_renderer_timeout: nil, raise_on_prerender_error: nil,
36
- skip_display_none: nil, generated_assets_dirs: DEFAULT_GENERATED_ASSETS_DIRS)
37
- self.server_bundle_js_file = if File.exist?(server_bundle_js_file)
38
- server_bundle_js_file
39
- end
40
-
74
+ skip_display_none: nil, generated_assets_dirs: nil,
75
+ generated_assets_dir: nil, webpack_generated_files: nil)
76
+ self.server_bundle_js_file = server_bundle_js_file
41
77
  self.generated_assets_dirs = generated_assets_dirs
78
+ self.generated_assets_dir = generated_assets_dir
79
+
42
80
  self.prerender = prerender
43
81
  self.replay_console = replay_console
44
82
  self.logging_on_server = logging_on_server
@@ -54,6 +92,8 @@ module ReactOnRails
54
92
  # Server rendering:
55
93
  self.server_renderer_pool_size = self.development_mode ? 1 : server_renderer_pool_size
56
94
  self.server_renderer_timeout = server_renderer_timeout # seconds
95
+
96
+ self.webpack_generated_files = webpack_generated_files
57
97
  end
58
98
  end
59
99
  end
@@ -12,8 +12,8 @@ module ReactOnRails
12
12
  def redux_store(store_name, props)
13
13
  redux_store_data = { store_name: store_name,
14
14
  props: props }
15
- @registered_stores_via_controller ||= []
16
- @registered_stores_via_controller << redux_store_data
15
+ @registered_stores_defer_render ||= []
16
+ @registered_stores_defer_render << redux_store_data
17
17
  end
18
18
  end
19
19
  end
@@ -13,7 +13,7 @@ module ReactOnRails
13
13
 
14
14
  def self.reset_pool_if_server_bundle_was_modified
15
15
  return unless ReactOnRails.configuration.development_mode
16
- file_mtime = File.mtime(ReactOnRails.configuration.server_bundle_js_file)
16
+ file_mtime = File.mtime(ReactOnRails::Utils.default_server_bundle_js_file_path)
17
17
  @server_bundle_timestamp ||= file_mtime
18
18
  return if @server_bundle_timestamp == file_mtime
19
19
  ReactOnRails::ServerRenderingPool.reset_pool
@@ -70,7 +70,7 @@ module ReactOnRails
70
70
  end
71
71
 
72
72
  def create_js_context
73
- server_js_file = ReactOnRails.configuration.server_bundle_js_file
73
+ server_js_file = ReactOnRails::Utils.default_server_bundle_js_file_path
74
74
  if server_js_file.present? && File.exist?(server_js_file)
75
75
  bundle_js_code = File.read(server_js_file)
76
76
  base_js_code = <<-JS
@@ -13,9 +13,10 @@ module ReactOnRails
13
13
  # RSpec.configure do |config|
14
14
  # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
15
15
  #
16
- # You can pass an RSpec metatag as an optional second parameter to this helper method
17
- # if you want this helper to run on examples other than where `js: true` (default). The helper
18
- # will compile webpack files at most once per test run.
16
+ # You can pass an RSpec metatag as an list of parameter to this helper method
17
+ # if you want this helper to run on examples other than where `js: true` or
18
+ # `server_rendering: true` (default). The helper will compile webpack files at most
19
+ # once per test run.
19
20
  #
20
21
  # If you do not want to be slowed down by re-compiling webpack assets from scratch every test
21
22
  # run, you can call `npm run build:client` (and `npm run build:server` if doing server
@@ -24,8 +25,17 @@ module ReactOnRails
24
25
  # to be running.
25
26
  #
26
27
  # See docs/additional_reading/rspec_configuration.md for more info
27
- def self.configure_rspec_to_compile_assets(config, metatag = :js)
28
- config.before(:example, metatag) { ReactOnRails::TestHelper.ensure_assets_compiled }
28
+ #
29
+ # Params:
30
+ # config - config for rspec
31
+ # metatags - metatags to add the ensure_assets_compiled check.
32
+ # Default is :js, :server_rendering
33
+ def self.configure_rspec_to_compile_assets(config, *metatags)
34
+ metatags = [:js, :server_rendering] if metatags.empty?
35
+
36
+ metatags.each do |metatag|
37
+ config.before(:example, metatag) { ReactOnRails::TestHelper.ensure_assets_compiled }
38
+ end
29
39
  end
30
40
 
31
41
  # Main entry point to ensuring assets are compiled. See `configure_rspec_to_compile_assets` for
@@ -38,36 +48,32 @@ module ReactOnRails
38
48
  # defaults to ReactOnRails::TestHelper::WebpackProcessChecker
39
49
  # webpack_assets_compiler: provide one method: `def compile`
40
50
  # defaults to ReactOnRails::TestHelper::WebpackAssetsCompiler
41
- # server_bundle_js_file: The server rendering file, defaulting to server_bundle_js_file in
42
- # your config
43
- # client_dir and compiled_dirs are passed into the default webpack_assets_status_checker if you
44
- # don't provide one.
51
+ # client_dir and generated_assets_dir are passed into the default webpack_assets_status_checker if you
52
+ # don't provide one.
53
+ # webpack_generated_files List of files to check for up-to-date-status, defaulting to
54
+ # webpack_generated_files in your configuration
45
55
  def self.ensure_assets_compiled(webpack_assets_status_checker: nil,
46
- webpack_assets_compiler: nil,
47
- webpack_process_checker: nil,
48
- client_dir: nil,
49
- compiled_dirs: nil,
50
- server_bundle_js_file: nil)
56
+ webpack_assets_compiler: nil,
57
+ webpack_process_checker: nil,
58
+ client_dir: nil,
59
+ generated_assets_dir: nil,
60
+ webpack_generated_files: nil)
51
61
 
52
62
  if webpack_assets_status_checker.nil?
53
63
  client_dir ||= Rails.root.join("client")
54
- compiled_dirs ||= ReactOnRails.configuration.generated_assets_dirs
55
- server_bundle_js_file ||= ReactOnRails.configuration.server_bundle_js_file
64
+ generated_assets_dir ||= ReactOnRails.configuration.generated_assets_dir
65
+ webpack_generated_files ||= ReactOnRails.configuration.webpack_generated_files
56
66
 
57
- if server_bundle_js_file.present?
58
- dir = File.dirname(server_bundle_js_file)
59
- compiled_dirs ||= []
60
- compiled_dirs << dir unless compiled_dirs.include?(dir)
61
- end
62
67
  webpack_assets_status_checker ||=
63
68
  WebpackAssetsStatusChecker.new(client_dir: client_dir,
64
- compiled_dirs: compiled_dirs,
65
- server_bundle_js_file: server_bundle_js_file)
69
+ generated_assets_dir: generated_assets_dir,
70
+ webpack_generated_files: webpack_generated_files
71
+ )
66
72
 
67
73
  unless @printed_once
68
74
  puts
69
- puts "====> React On Rails: Checking dirs for outdated/missing bundles: "\
70
- "#{webpack_assets_status_checker.compiled_dirs}"
75
+ puts "====> React On Rails: Checking #{webpack_assets_status_checker.generated_assets_dir} for "\
76
+ "outdated/missing bundles"
71
77
  puts
72
78
  @printed_once = true
73
79
  end
@@ -1,6 +1,8 @@
1
1
  module ReactOnRails
2
2
  module TestHelper
3
3
  class EnsureAssetsCompiled
4
+ SECONDS_TO_WAIT = 10
5
+
4
6
  class << self
5
7
  attr_accessor :has_been_run
6
8
  @has_been_run = false
@@ -20,58 +22,106 @@ module ReactOnRails
20
22
  @webpack_process_checker = webpack_process_checker
21
23
  end
22
24
 
25
+ # rubocop:disable Metrics/AbcSize
26
+ # rubocop:disable Metrics/CyclomaticComplexity
27
+ # rubocop:disable Metrics/PerceivedComplexity
28
+
29
+ # Several Scenarios:
30
+ # 1. No webpack watch processes for static assets and files are mising or out of date.
31
+ # 2. Only webpack watch process for server bundle as we're the hot reloading setup.
32
+ # 3. For whatever reason, the watch processes are running, but some clean script removed
33
+ # the generated bundles.
23
34
  def call
35
+ # Only check this ONCE during a test run
24
36
  return if self.class.has_been_run
25
37
 
26
- loop_count = 0
27
- loop do
28
- break if webpack_assets_status_checker.up_to_date?
38
+ # Be sure we don't do this again.
39
+ self.class.has_been_run = true
29
40
 
30
- puts_first_iteration_message(loop_count)
41
+ stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files
31
42
 
32
- if webpack_process_checker.running? && loop_count < MAX_TIME_TO_WAIT
33
- loop_count += 1
34
- sleep 1
35
- else
36
- puts_max_iterations_message(loop_count)
43
+ # All done if no stale files!
44
+ return if stale_gen_files.empty?
45
+
46
+ # Inform the developer that we're ensuring gen assets are ready.
47
+ puts_start_compile_check_message(stale_gen_files)
37
48
 
38
- webpack_assets_compiler.compile
39
- puts
40
- break
49
+ hot_running = webpack_process_checker.hot_running?
50
+ client_running = webpack_process_checker.client_running?
51
+ server_running = webpack_process_checker.server_running?
52
+ already_compiled_client_file = false
53
+
54
+ # Check if running "hot" and not running a process to statically compile the client files.
55
+ if hot_running && !client_running
56
+ puts "Appears you're running hot reloading and are not rebuilding client files "\
57
+ "automatically. We'll try rebuilding only your client files first."
58
+ webpack_assets_compiler.compile_client(stale_gen_files)
59
+ already_compiled_client_file = true
60
+
61
+ stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files
62
+
63
+ # Return if we're all done!
64
+ return if stale_gen_files.empty?
65
+ end
66
+
67
+ loop_count = 0
68
+ if (already_compiled_client_file && server_running) ||
69
+ (!already_compiled_client_file && client_running)
70
+ puts "Waiting #{SECONDS_TO_WAIT} for webpack watch processes to compile files"
71
+ loop do
72
+ sleep 1
73
+ stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files
74
+ loop_count += 1
75
+ break if loop_count == SECONDS_TO_WAIT || stale_gen_files.empty?
41
76
  end
42
77
  end
43
78
 
44
- self.class.has_been_run = true
79
+ final_compilation_check(already_compiled_client_file, client_running, server_running, stale_gen_files)
45
80
  end
46
81
 
47
- def puts_first_iteration_message(loop_count)
48
- return unless loop_count == 0
49
-
50
- puts "\n\nReact on Rails is ensuring your JavaScript generated files are up to date!"
51
- end
82
+ # rubocop:enable Metrics/AbcSize
83
+ # rubocop:enable Metrics/CyclomaticComplexity
84
+ # rubocop:enable Metrics/PerceivedComplexity
52
85
 
53
- def puts_max_iterations_message(loop_count)
54
- if loop_count == MAX_TIME_TO_WAIT
55
- stale_files = webpack_assets_status_checker.whats_not_up_to_date.join("\n")
56
- if stale_files.empty?
57
- puts "Please check your config value for `config.generated_assets_dirs`."
58
- puts "We're not finding your generated files for test runs."
59
- else
60
- puts <<-MSG
86
+ def final_compilation_check(already_compiled_client_file, client_running, server_running, stale_gen_files)
87
+ return unless stale_gen_files.present?
88
+ if client_running || server_running
89
+ puts <<-MSG
90
+ Arghhhhhh! We still have the following stale generated files after waiting for Webpack to compile:
91
+ #{stale_gen_files.join("\n")}
61
92
 
62
- Even though we detected the webpack watch processes are running, we found files modified that are
63
- not causing a rebuild of your generated files:
93
+ This can happen if you removed the generated files after they've been created by your webpack
94
+ watch processes, such by running a clean on your generated bundles before starting your tests.
95
+ MSG
96
+ end
64
97
 
65
- #{stale_files}
98
+ puts <<-MSG
66
99
 
67
- One possibility is that you modified a file in your directory that is not a dependency of
68
- your webpack files: #{webpack_assets_status_checker.client_dir}
100
+ If you are frequently running tests, you can run webpack in watch mode for static assets to
101
+ speed up this process. See the official documentation:
102
+ https://github.com/shakacode/react_on_rails/blob/master/docs/additional_reading/rspec_configuration.md
103
+ MSG
69
104
 
70
- To be sure, we will now rebuild your generated files.
71
- MSG
72
- end
105
+ if already_compiled_client_file
106
+ # So only do serer file
107
+ webpack_assets_compiler.compile_server(stale_gen_files)
108
+ else
109
+ webpack_assets_compiler.compile_as_necessary(stale_gen_files)
73
110
  end
74
111
  end
112
+
113
+ def puts_start_compile_check_message(stale_files)
114
+ server_msg = Utils.server_rendering_is_enabled? ? "and `build:server`" : ""
115
+ puts <<-MSG
116
+
117
+ Detected are the following stale generated files:
118
+ #{stale_files.join("\n")}
119
+
120
+ React on Rails will ensure your JavaScript generated files are up to date, using your
121
+ top level package.json `build:client` #{server_msg} commands.
122
+
123
+ MSG
124
+ end
75
125
  end
76
126
  end
77
127
  end
@@ -3,23 +3,22 @@
3
3
  module ReactOnRails
4
4
  module TestHelper
5
5
  class WebpackAssetsCompiler
6
- def compile
7
- compile_type(:client)
8
- compile_type(:server) if Utils.server_rendering_is_enabled?
6
+ def compile_as_necessary(stale_files)
7
+ compile_client(stale_files)
8
+ compile_server(stale_files)
9
+ end
10
+
11
+ def compile_client(stale_files)
12
+ compile_type(:client) if needs_client_compile?(stale_files)
13
+ end
14
+
15
+ def compile_server(stale_files)
16
+ compile_type(:server) if needs_server_compile?(stale_files)
9
17
  end
10
18
 
11
19
  private
12
20
 
13
21
  def compile_type(type)
14
- unless @printed_msg
15
- puts <<-MSG
16
- If you are frequently running tests, you can run webpack in watch mode to speed up this process.
17
- See the official documentation:
18
- https://github.com/shakacode/react_on_rails/blob/master/docs/additional_reading/rspec_configuration.md
19
- MSG
20
- @printed_msg = true
21
- end
22
-
23
22
  puts "\nBuilding Webpack #{type}-rendering assets..."
24
23
 
25
24
  build_output = `cd client && npm run build:#{type}`
@@ -28,6 +27,15 @@ https://github.com/shakacode/react_on_rails/blob/master/docs/additional_reading/
28
27
 
29
28
  puts "Completed building Webpack #{type}-rendering assets."
30
29
  end
30
+
31
+ def needs_client_compile?(stale_files)
32
+ !stale_files.all? { |name| name.include?("server") }
33
+ end
34
+
35
+ def needs_server_compile?(stale_files)
36
+ return false unless Utils.server_rendering_is_enabled?
37
+ stale_files.any? { |name| name.include?("server") }
38
+ end
31
39
  end
32
40
  end
33
41
  end
@@ -6,51 +6,54 @@ require "fileutils"
6
6
  module ReactOnRails
7
7
  module TestHelper
8
8
  class WebpackAssetsStatusChecker
9
- attr_reader :client_dir, :compiled_dirs, :server_bundle_js_file
9
+ # client_dir is typically /client, where all client files go
10
+ attr_reader :client_dir, :generated_assets_dir
10
11
 
11
- def initialize(args = {})
12
- @compiled_dirs = args.fetch(:compiled_dirs)
13
- @client_dir = args.fetch(:client_dir)
14
- @server_bundle_js_file = args.fetch(:server_bundle_js_file)
15
- @last_stale_files = ""
12
+ def initialize(generated_assets_dir:, client_dir:, webpack_generated_files:)
13
+ @generated_assets_dir = generated_assets_dir
14
+ @client_dir = client_dir
15
+ @webpack_generated_files = webpack_generated_files
16
16
  end
17
17
 
18
- def up_to_date?
19
- return false unless assets_exist?
20
- all_compiled_assets.all? do |asset|
21
- FileUtils.uptodate?(asset, client_files)
22
- end
23
- end
24
-
25
- def whats_not_up_to_date
26
- return [] unless assets_exist?
27
- result = []
28
- all_compiled_assets.all? do |asset|
29
- result += whats_not_up_to_date_worker(asset, client_files)
18
+ def stale_generated_webpack_files
19
+ most_recent_mtime = find_most_recent_mtime
20
+ all_compiled_assets.each_with_object([]) do |webpack_generated_file, stale_gen_list|
21
+ if !File.exist?(webpack_generated_file) ||
22
+ File.mtime(webpack_generated_file) < most_recent_mtime
23
+ stale_gen_list << webpack_generated_file
24
+ end
25
+ stale_gen_list
30
26
  end
31
- result.uniq
32
27
  end
33
28
 
34
29
  private
35
30
 
36
- def whats_not_up_to_date_worker(new, old_list)
37
- # derived from lib/ruby/2.2.0/fileutils.rb:147
38
- not_up_to_date = []
39
- new_time = File.mtime(new)
40
- old_list.each do |old|
41
- if File.exist?(old)
42
- not_up_to_date << old unless new_time > File.mtime(old)
43
- end
31
+ def find_most_recent_mtime
32
+ client_files.reduce(1.year.ago) do |newest_time, file|
33
+ mt = File.mtime(file)
34
+ mt > newest_time ? mt : newest_time
44
35
  end
45
- not_up_to_date
46
36
  end
47
37
 
48
38
  def all_compiled_assets
49
- file_list = make_file_list(make_globs(compiled_dirs)).to_ary
50
- if file_list && !file_list.empty?
51
- file_list.delete(server_bundle_js_file)
39
+ @all_compiled_assets ||= begin
40
+ webpack_generated_files = @webpack_generated_files.map do |file|
41
+ File.join(@generated_assets_dir, file)
42
+ end
43
+ if webpack_generated_files.present?
44
+ webpack_generated_files
45
+ else
46
+ file_list = make_file_list(make_globs(generated_assets_dir)).to_ary
47
+ puts "V" * 80
48
+ puts "Please define config.webpack_generated_files (array) so the test helper knows "\
49
+ "which files are required."
50
+ puts "Detected the possible following files to check for webpack compilation in "\
51
+ "#{generated_assets_dir}"
52
+ puts file_list.join("\n")
53
+ puts "^" * 80
54
+ file_list
55
+ end
52
56
  end
53
- file_list
54
57
  end
55
58
 
56
59
  def client_files