17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/railspack/cli.rb', line 17
def generate
run_npm_install = options[:install]
build_package_json
copy_file("index.js", "frontend/index.js")
copy_file("registerComponent.js", "frontend/registerComponent.js")
copy_file("react_helper.rb", "app/helpers/react_helper.rb")
copy_file("babelrc.js", ".babelrc")
copy_file("webpack.js", "webpack.config.babel.js")
if run_npm_install
unless npm_available?
puts "NPM is not installed, please install and then run `npm install` manually"
return
end
puts "Running `npm install`"
exec("npm install")
end
end
|