<commit_before># frozen_string_literal: true

# Important: The default assets:precompile is modified ONLY if the rails/webpacker webpack config
# does not exist!

require "active_support"

ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"]  ||= "development"

unless ReactOnRails::WebpackerUtils.webpacker_webpack_production_config_exists?
  # Ensure that rails/webpacker does not call bin/webpack if we're providing
  # the build command.
  ENV["WEBPACKER_PRECOMPILE"] = "false"

  precompile_tasks = lambda {
    Rake::Task["react_on_rails:assets:webpack"].invoke
    puts "Invoking task webpacker:clean from React on Rails"

    # VERSIONS is per the rails/webpacker clean method definition.
    # We set it very big so that it is not used, and then clean just
    # removes files older than 1 hour.
    versions = 100_000
    Rake::Task["webpacker:clean"].invoke(versions)
  }

  if Rake::Task.task_defined?("assets:precompile")
    Rake::Task["assets:precompile"].enhance do
      precompile_tasks.call
    end
  else
    Rake::Task.define_task("assets:precompile") do
      precompile_tasks.call<commit_msg>Don't set NODE_ENV in assets.rake (#1356)<commit_after># frozen_string_literal: true

# Important: The default assets:precompile is modified ONLY if the rails/webpacker webpack config
# does not exist!

require "active_support"

ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"

unless ReactOnRails::WebpackerUtils.webpacker_webpack_production_config_exists?
  # Ensure that rails/webpacker does not call bin/webpack if we're providing
  # the build command.
  ENV["WEBPACKER_PRECOMPILE"] = "false"

  precompile_tasks = lambda {
    Rake::Task["react_on_rails:assets:webpack"].invoke
    puts "Invoking task webpacker:clean from React on Rails"

    # VERSIONS is per the rails/webpacker clean method definition.
    # We set it very big so that it is not used, and then clean just
    # removes files older than 1 hour.
    versions = 100_000
    Rake::Task["webpacker:clean"].invoke(versions)
  }

  if Rake::Task.task_defined?("assets:precompile")
    Rake::Task["assets:precompile"].enhance do
      precompile_tasks.call
    end
  else
    Rake::Task.define_task("assets:precompile") do
      precompile_tasks.call
{'fraction_non_alphanumeric': 0.09924678777137794, 'fraction_numerical': 0.007975188303057155, 'mean_word_length': 4.659147869674185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5356693', 'n_tokens_mistral': 735, 'n_tokens_neox': 696, 'n_words': 192}