jsbundling-rails 0.1.5 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/install/esbuild/install.rb +7 -1
- data/lib/install/install.rb +7 -3
- data/lib/install/rollup/install.rb +7 -1
- data/lib/install/webpack/install.rb +7 -1
- data/lib/jsbundling/version.rb +1 -1
- data/lib/tasks/jsbundling/build.rake +3 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5bde01f1cfb6e2fac2f04eda05dba4a31121ec4b45ed30c7fd1962499fd1b11
|
4
|
+
data.tar.gz: 8db0f168b477075d235c36a66239eb9a37ade5c1a711ea7668efcfe18290e095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30cc0891d989fc9cdc45784ac861d523c94d291a68430e64c753d718bf0e071eee8cd1c0ca64bbefca85110a2c56286c19917427dd4d59f9338dd4ca95796553
|
7
|
+
data.tar.gz: 730a3011e7a338a682f004df50ea68950d50a88eba314a344d346497536f06d64670a36f2ff68f6a90595dd9e31b46fe01edbdf1d6c5f07b8544712f58c53b99
|
@@ -2,4 +2,10 @@ say "Install esbuild"
|
|
2
2
|
run "yarn add esbuild"
|
3
3
|
|
4
4
|
say "Add build script"
|
5
|
-
|
5
|
+
build_script = "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
|
6
|
+
|
7
|
+
if (`npx -v`.to_f < 7.1 rescue "Missing")
|
8
|
+
say %(Add "scripts": { "build": "#{build_script}" to your package.json), :green
|
9
|
+
else
|
10
|
+
run %(npm set-script build "#{build_script}")
|
11
|
+
end
|
data/lib/install/install.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
say "Compile into app/assets/builds"
|
2
2
|
empty_directory "app/assets/builds"
|
3
3
|
keep_file "app/assets/builds"
|
4
|
-
|
4
|
+
|
5
|
+
if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist?
|
6
|
+
append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n)
|
7
|
+
end
|
5
8
|
|
6
9
|
if Rails.root.join(".gitignore").exist?
|
7
|
-
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n
|
10
|
+
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
|
11
|
+
append_to_file(".gitignore", %(\n/node_modules\n))
|
8
12
|
end
|
9
13
|
|
10
14
|
if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
|
@@ -28,7 +32,7 @@ unless Rails.root.join("package.json").exist?
|
|
28
32
|
end
|
29
33
|
|
30
34
|
if Rails.root.join("Procfile.dev").exist?
|
31
|
-
append_to_file "Procfile.dev", "js: yarn build --watch"
|
35
|
+
append_to_file "Procfile.dev", "js: yarn build --watch\n"
|
32
36
|
else
|
33
37
|
say "Add default Procfile.dev"
|
34
38
|
copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
|
@@ -3,4 +3,10 @@ copy_file "#{__dir__}/rollup.config.js", "rollup.config.js"
|
|
3
3
|
run "yarn add rollup @rollup/plugin-node-resolve"
|
4
4
|
|
5
5
|
say "Add build script"
|
6
|
-
|
6
|
+
build_script = "rollup -c rollup.config.js"
|
7
|
+
|
8
|
+
if (`npx -v`.to_f < 7.1 rescue "Missing")
|
9
|
+
say %(Add "scripts": { "build": "#{build_script}" to your package.json), :green
|
10
|
+
else
|
11
|
+
run %(npm set-script build "#{build_script}")
|
12
|
+
end
|
@@ -3,4 +3,10 @@ copy_file "#{__dir__}/webpack.config.js", "webpack.config.js"
|
|
3
3
|
run "yarn add webpack webpack-cli"
|
4
4
|
|
5
5
|
say "Add build script"
|
6
|
-
|
6
|
+
build_script = "webpack --config webpack.config.js"
|
7
|
+
|
8
|
+
if (`npx -v`.to_f < 7.1 rescue "Missing")
|
9
|
+
say %(Add "scripts": { "build": "#{build_script}" to your package.json), :green
|
10
|
+
else
|
11
|
+
run %(npm set-script build "#{build_script}")
|
12
|
+
end
|
data/lib/jsbundling/version.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
namespace :javascript do
|
2
2
|
desc "Build your JavaScript bundle"
|
3
3
|
task :build do
|
4
|
-
system "yarn install && yarn build"
|
4
|
+
unless system "yarn install && yarn build"
|
5
|
+
raise "jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors"
|
6
|
+
end
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsbundling-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 6.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sprockets-rails
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 2.0.0
|
41
27
|
description:
|
42
28
|
email: david@loudthinking.com
|
43
29
|
executables: []
|