Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/install/esbuild/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
say "Add build script"
build_script = "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets"

if (`npx -v`.to_f < 7.1 rescue "Missing")
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
else
case `npx -v`.to_f
when 7.1...8.0
run %(npm set-script build "#{build_script}")
run %(yarn build)
when 8.0..
run %(npm pkg set scripts.build="#{build_script}")
run %(yarn build)
else
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
end
10 changes: 7 additions & 3 deletions lib/install/rollup/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
say "Add build script"
build_script = "rollup -c rollup.config.js"

if (`npx -v`.to_f < 7.1 rescue "Missing")
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
else
case `npx -v`.to_f
when 7.1...8.0
run %(npm set-script build "#{build_script}")
run %(yarn build)
when 8.0..
run %(npm pkg set scripts.build="#{build_script}")
run %(yarn build)
else
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
end
10 changes: 7 additions & 3 deletions lib/install/webpack/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
say "Add build script"
build_script = "webpack --config webpack.config.js"

if (`npx -v`.to_f < 7.1 rescue "Missing")
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
else
case `npx -v`.to_f
when 7.1...8.0
run %(npm set-script build "#{build_script}")
run %(yarn build)
when 8.0..
run %(npm pkg set scripts.build="#{build_script}")
run %(yarn build)
else
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
end