in lib/generators/react/install_generator.rb [74:95]
def setup_react_sprockets
require_react = "//= require react\n//= require react_ujs\n//= require components\n"
if manifest.exist?
manifest_contents = File.read(manifest)
if match = manifest_contents.match(/\/\/=\s+require\s+turbolinks\s+\n/)
inject_into_file manifest, require_react, { after: match[0] }
elsif match = manifest_contents.match(/\/\/=\s+require_tree[^\n]*/)
inject_into_file manifest, require_react, { before: match[0] }
else
append_file manifest, require_react
end
else
create_file manifest, require_react
end
components_js = "//= require_tree ./components\n"
components_file = File.join(javascript_dir, 'components.js')
create_file components_file, components_js
end