@@ -99,9 +99,9 @@ def self.run(argv)
9999
100100 # If this build uses dev server, delegate to DevServerRunner
101101 if loader . uses_dev_server? ( build_config )
102- $stdout . puts "[Shakapacker] Build '#{ build_name } ' requires dev server"
103- $stdout . puts "[Shakapacker] Running: bin/shakapacker-dev-server --build #{ build_name } "
104- $stdout . puts ""
102+ $stderr . puts "[Shakapacker] Build '#{ build_name } ' requires dev server"
103+ $stderr . puts "[Shakapacker] Running: bin/shakapacker-dev-server --build #{ build_name } "
104+ $stderr . puts ""
105105 require_relative "dev_server_runner"
106106 DevServerRunner . run_with_build_config ( remaining_argv , build_config )
107107 return
@@ -179,10 +179,10 @@ def self.run_with_build_config(argv, build_config)
179179 # This ensures the bundler override (from --bundler or build config) is respected
180180 ENV [ "SHAKAPACKER_ASSETS_BUNDLER" ] = build_config [ :bundler ]
181181
182- puts "[Shakapacker] Running build: #{ build_config [ :name ] } "
183- puts "[Shakapacker] Description: #{ build_config [ :description ] } " if build_config [ :description ]
184- puts "[Shakapacker] Bundler: #{ build_config [ :bundler ] } "
185- puts "[Shakapacker] Config file: #{ build_config [ :config_file ] } " if build_config [ :config_file ]
182+ $stderr . puts "[Shakapacker] Running build: #{ build_config [ :name ] } "
183+ $stderr . puts "[Shakapacker] Description: #{ build_config [ :description ] } " if build_config [ :description ]
184+ $stderr . puts "[Shakapacker] Bundler: #{ build_config [ :bundler ] } "
185+ $stderr . puts "[Shakapacker] Config file: #{ build_config [ :config_file ] } " if build_config [ :config_file ]
186186
187187 # Create runner with modified argv and bundler from build_config
188188 # The build_config[:bundler] already has any CLI --bundler override applied
@@ -240,40 +240,40 @@ def package_json
240240 end
241241
242242 def run
243- puts "[Shakapacker] Preparing environment for assets bundler execution..."
243+ $stderr . puts "[Shakapacker] Preparing environment for assets bundler execution..."
244244 env = Shakapacker ::Compiler . env
245245 env [ "SHAKAPACKER_CONFIG" ] = @shakapacker_config
246246 env [ "NODE_OPTIONS" ] = ENV [ "NODE_OPTIONS" ] || ""
247247
248248 cmd = build_cmd
249- puts "[Shakapacker] Base command: #{ cmd . join ( " " ) } "
249+ $stderr . puts "[Shakapacker] Base command: #{ cmd . join ( " " ) } "
250250
251251 if @argv . delete ( "--debug-shakapacker" )
252- puts "[Shakapacker] Debug mode enabled (--debug-shakapacker)"
252+ $stderr . puts "[Shakapacker] Debug mode enabled (--debug-shakapacker)"
253253 env [ "NODE_OPTIONS" ] = "#{ env [ "NODE_OPTIONS" ] } --inspect-brk"
254254 end
255255
256256 if @argv . delete "--trace-deprecation"
257- puts "[Shakapacker] Trace deprecation enabled (--trace-deprecation)"
257+ $stderr . puts "[Shakapacker] Trace deprecation enabled (--trace-deprecation)"
258258 env [ "NODE_OPTIONS" ] = "#{ env [ "NODE_OPTIONS" ] } --trace-deprecation"
259259 end
260260
261261 if @argv . delete "--no-deprecation"
262- puts "[Shakapacker] Deprecation warnings disabled (--no-deprecation)"
262+ $stderr . puts "[Shakapacker] Deprecation warnings disabled (--no-deprecation)"
263263 env [ "NODE_OPTIONS" ] = "#{ env [ "NODE_OPTIONS" ] } --no-deprecation"
264264 end
265265
266266 # Commands are not compatible with --config option.
267267 if ( @argv & assets_bundler_commands ) . empty?
268- puts "[Shakapacker] Adding config file: #{ @webpack_config } "
268+ $stderr . puts "[Shakapacker] Adding config file: #{ @webpack_config } "
269269 cmd += [ "--config" , @webpack_config ]
270270 else
271- puts "[Shakapacker] Skipping config file (running assets bundler command: #{ ( @argv & assets_bundler_commands ) . join ( ", " ) } )"
271+ $stderr . puts "[Shakapacker] Skipping config file (running assets bundler command: #{ ( @argv & assets_bundler_commands ) . join ( ", " ) } )"
272272 end
273273
274274 cmd += @argv
275- puts "[Shakapacker] Final command: #{ cmd . join ( " " ) } "
276- puts "[Shakapacker] Working directory: #{ @app_path } "
275+ $stderr . puts "[Shakapacker] Final command: #{ cmd . join ( " " ) } "
276+ $stderr . puts "[Shakapacker] Working directory: #{ @app_path } "
277277
278278 watch_mode = @argv . include? ( "--watch" ) || @argv . include? ( "-w" )
279279 start_time = Time . now unless watch_mode
@@ -288,7 +288,7 @@ def run
288288 minutes = ( elapsed_time / 60 ) . floor
289289 seconds = ( elapsed_time % 60 ) . round ( 2 )
290290 time_display = minutes > 0 ? "#{ minutes } :#{ format ( '%05.2f' , seconds ) } s" : "#{ elapsed_time . round ( 2 ) } s"
291- puts "[Shakapacker] Completed #{ bundler_name } build in #{ time_display } (#{ elapsed_time . round ( 2 ) } s)"
291+ $stderr . puts "[Shakapacker] Completed #{ bundler_name } build in #{ time_display } (#{ elapsed_time . round ( 2 ) } s)"
292292 end
293293 exit ( $?. exitstatus || 1 ) unless $?. success?
294294 end
@@ -601,10 +601,10 @@ def find_rspack_config_with_fallback
601601 File . join ( @app_path , config_dir , "rspack.config.#{ ext } " )
602602 end
603603
604- puts "[Shakapacker] Looking for Rspack config in: #{ rspack_paths . join ( ", " ) } "
604+ $stderr . puts "[Shakapacker] Looking for Rspack config in: #{ rspack_paths . join ( ", " ) } "
605605 rspack_path = rspack_paths . find { |f | File . exist? ( f ) }
606606 if rspack_path
607- puts "[Shakapacker] Found Rspack config: #{ rspack_path } "
607+ $stderr . puts "[Shakapacker] Found Rspack config: #{ rspack_path } "
608608 return rspack_path
609609 end
610610
@@ -613,7 +613,7 @@ def find_rspack_config_with_fallback
613613 File . join ( @app_path , config_dir , "webpack.config.#{ ext } " )
614614 end
615615
616- puts "[Shakapacker] Rspack config not found, checking for webpack config fallback..."
616+ $stderr . puts "[Shakapacker] Rspack config not found, checking for webpack config fallback..."
617617 webpack_path = webpack_paths . find { |f | File . exist? ( f ) }
618618 if webpack_path
619619 $stderr. puts "⚠️ DEPRECATION WARNING: Using webpack config file for Rspack assets bundler."
@@ -629,7 +629,7 @@ def find_rspack_config_with_fallback
629629 File . join ( @app_path , "config/webpack" , "webpack.config.#{ ext } " )
630630 end
631631
632- puts "[Shakapacker] Checking config/webpack/ for backward compatibility..."
632+ $stderr . puts "[Shakapacker] Checking config/webpack/ for backward compatibility..."
633633 webpack_dir_path = webpack_dir_paths . find { |f | File . exist? ( f ) }
634634 if webpack_dir_path
635635 $stderr. puts "⚠️ DEPRECATION WARNING: Found webpack config in config/webpack/ but assets_bundler is set to 'rspack'."
@@ -656,13 +656,13 @@ def find_webpack_config
656656 possible_paths = %w[ ts js ] . map do |ext |
657657 File . join ( @app_path , config_dir , "webpack.config.#{ ext } " )
658658 end
659- puts "[Shakapacker] Looking for Webpack config in: #{ possible_paths . join ( ", " ) } "
659+ $stderr . puts "[Shakapacker] Looking for Webpack config in: #{ possible_paths . join ( ", " ) } "
660660 path = possible_paths . find { |f | File . exist? ( f ) }
661661 unless path
662662 print_config_not_found_error ( "webpack" , possible_paths . last , config_dir )
663663 exit ( 1 )
664664 end
665- puts "[Shakapacker] Found Webpack config: #{ path } "
665+ $stderr . puts "[Shakapacker] Found Webpack config: #{ path } "
666666 path
667667 end
668668 end
0 commit comments