jsbundling-rails 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/install/install.rb +1 -1
- data/lib/install/webpack/webpack.config.js +4 -2
- data/lib/jsbundling/version.rb +1 -1
- data/lib/tasks/jsbundling/build.rake +6 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b113c6e1687d0f4adf95e471b46bd54fc0096b3f999d62f11145f14253a656e
|
4
|
+
data.tar.gz: b59b92d84c86299b4ced4902c41f954e97131c5ea4a94edbc8390e65ba16ce31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d017b80b7a35e3bb10679dc4c996a484a19b3cd0083c2d0f16bb52caafe48ade12ab4d92eb06210526471cf784ee8b6476a4fee04a12223c95d8473971fba3
|
7
|
+
data.tar.gz: c72ec41731afdad48d9b2e5e852b2d3a3ea95a915b0e0a7ffcbbb20784625afcdd727fc3bf2687261cca0d0a70acd2d867f0dd2923598789f8e1a8354ec76a7e
|
data/README.md
CHANGED
@@ -8,10 +8,14 @@ When you deploy your application to production, the `javascript:build` task atta
|
|
8
8
|
|
9
9
|
This also happens in testing where the bundler attaches to the `test:prepare` task to ensure the JavaScript has been bundled before testing commences. (Note that this currently only applies to rails `test:*` tasks (like `test:all` or `test:controllers`), not "rails test", as that doesn't load `test:prepare`).
|
10
10
|
|
11
|
+
If your testing library of choice does not define a `test:prepare` Rake task, ensure that your test suite runs `javascript:build` to bundle JavaScript before testing commences.
|
12
|
+
|
11
13
|
That's it!
|
12
14
|
|
13
15
|
You can configure your bundler options in the `build` script in `package.json` or via the installer-generated `rollup.config.js` for rollup.js or `webpack.config.json` for Webpack (esbuild does not have a default configuration format).
|
14
16
|
|
17
|
+
If you're already using [`webpacker`](https://github.com/rails/webpacker) and you're wondering if you should migrate to `jsbundling-rails`, have a look at [the high-level comparison](./docs/comparison_with_webpacker.md).
|
18
|
+
|
15
19
|
|
16
20
|
## Installation
|
17
21
|
|
data/lib/install/install.rb
CHANGED
@@ -4,7 +4,7 @@ keep_file "app/assets/builds"
|
|
4
4
|
append_to_file "app/assets/config/manifest.js", %(//= link_tree ../builds\n)
|
5
5
|
|
6
6
|
if Rails.root.join(".gitignore").exist?
|
7
|
-
append_to_file(".gitignore", %(/app/assets/builds
|
7
|
+
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n/node_modules\n))
|
8
8
|
end
|
9
9
|
|
10
10
|
if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
|
@@ -3,9 +3,11 @@ const webpack = require('webpack')
|
|
3
3
|
|
4
4
|
module.exports = {
|
5
5
|
mode: "production",
|
6
|
-
entry:
|
6
|
+
entry: {
|
7
|
+
application: "./app/javascript/application.js"
|
8
|
+
},
|
7
9
|
output: {
|
8
|
-
filename: "
|
10
|
+
filename: "[name].js",
|
9
11
|
path: path.resolve(__dirname, "app/assets/builds"),
|
10
12
|
},
|
11
13
|
plugins: [
|
data/lib/jsbundling/version.rb
CHANGED
@@ -6,4 +6,9 @@ namespace :javascript do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
Rake::Task["assets:precompile"].enhance(["javascript:build"])
|
9
|
-
|
9
|
+
|
10
|
+
if Rake::Task.task_defined?("test:prepare")
|
11
|
+
Rake::Task["test:prepare"].enhance(["javascript:build"])
|
12
|
+
elsif Rake::Task.task_defined?("db:test:prepare")
|
13
|
+
Rake::Task["db:test:prepare"].enhance(["javascript:build"])
|
14
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
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.5
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -24,6 +24,20 @@ 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
|
27
41
|
description:
|
28
42
|
email: david@loudthinking.com
|
29
43
|
executables: []
|