jsbundling-rails 1.2.1 → 1.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bf6310c232f781ceda13fc2e44c0196884afdfe50318f6136a6e95c403f2521
4
- data.tar.gz: 296b8a667e1fe8295b7efe1f59185a4ca4a4aa7ccd18697e8e4a1e93c02d2257
3
+ metadata.gz: 3cd9756300244b2e031344a063f93d4e6ed124fc2cb324a6d70ee6e69385304f
4
+ data.tar.gz: 2618a978134e255ec4b69a6cefddeb593ba0c8dfba9d1e12fc37215b556968bb
5
5
  SHA512:
6
- metadata.gz: d851108dd46513415cc8645a11992fff06181d94580e9681615d12e0ec8ce1ef7b9ed542c807933c7ad66ac60f710e2037533e003a4d30a65026f4b687e9b8eb
7
- data.tar.gz: efbffe3102d9cd3a746d76f55241413c0015d3bd8b7fe6120f6a4ac9b2e64c6d3a563d2a2182e44f33983977a75315c257230bf91a2da040e44482b10926f73d
6
+ metadata.gz: dbcf7c0772469872dfea9667f852a0dc64012b55896c3a8cef480a57ae49adbd7d8e001faee1b48c8b99de659e39e27c45e1b086470c4d7070fbec442735c8b8
7
+ data.tar.gz: 07d134a6c2b6765c83cac64b85314ceb91666ef6ca93c7d997c820e6c588f7085be61bbad3a0fae8c250be8cb29ed314dbf76890bb975b8b64b998b70fef7ebc
data/lib/install/dev CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- if ! gem list foreman -i --silent; then
3
+ if gem list --no-installed --exact --silent foreman; then
4
4
  echo "Installing foreman..."
5
5
  gem install foreman
6
6
  fi
@@ -2,7 +2,7 @@ say "Install esbuild"
2
2
  run "yarn add esbuild"
3
3
 
4
4
  say "Add build script"
5
- build_script = "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets"
5
+ build_script = "esbuild app/javascript/*.* --bundle --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets"
6
6
 
7
7
  case `npx -v`.to_f
8
8
  when 7.1...8.0
@@ -14,10 +14,10 @@ end
14
14
  if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
15
15
  say "Add JavaScript include tag in application layout"
16
16
  insert_into_file app_layout_path.to_s,
17
- %(\n <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>), before: /\s*<\/head>/
17
+ %(\n <%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>), before: /\s*<\/head>/
18
18
  else
19
19
  say "Default application.html.erb is missing!", :red
20
- say %( Add <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> within the <head> tag in your custom layout.)
20
+ say %( Add <%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %> within the <head> tag in your custom layout.)
21
21
  end
22
22
 
23
23
  unless (app_js_entrypoint_path = Rails.root.join("app/javascript/application.js")).exist?
@@ -4,7 +4,7 @@ export default {
4
4
  input: "app/javascript/application.js",
5
5
  output: {
6
6
  file: "app/assets/builds/application.js",
7
- format: "iife",
7
+ format: "esm",
8
8
  inlineDynamicImports: true,
9
9
  sourcemap: true
10
10
  },
@@ -10,6 +10,7 @@ module.exports = {
10
10
  output: {
11
11
  filename: "[name].js",
12
12
  sourceMapFilename: "[file].map",
13
+ chunkFormat: "module",
13
14
  path: path.resolve(__dirname, "app/assets/builds"),
14
15
  },
15
16
  plugins: [
@@ -1,3 +1,3 @@
1
1
  module Jsbundling
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -24,13 +24,15 @@ module Jsbundling
24
24
 
25
25
  def install_command
26
26
  return "bun install" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
27
- return "yarn install" if File.exist?('yarn.lock') || tool_exists?('yarn')
27
+ return "yarn install" if File.exist?('yarn.lock') || (tool_exists?('yarn') && !File.exist?('package-lock.json'))
28
+ return "npm install" if File.exist?('package-lock.json') || tool_exists?('npm')
28
29
  raise "jsbundling-rails: No suitable tool found for installing JavaScript dependencies"
29
30
  end
30
31
 
31
32
  def build_command
32
33
  return "bun run build" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
33
- return "yarn build" if File.exist?('yarn.lock') || tool_exists?('yarn')
34
+ return "yarn build" if File.exist?('yarn.lock') || (tool_exists?('yarn') && !File.exist?('package-lock.json'))
35
+ return "npm run build" if File.exist?('package-lock.json') || tool_exists?('npm')
34
36
  raise "jsbundling-rails: No suitable tool found for building JavaScript"
35
37
  end
36
38
 
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: 1.2.1
4
+ version: 1.2.2
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: 2023-09-13 00:00:00.000000000 Z
11
+ date: 2024-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -71,8 +71,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.4.10
74
+ rubygems_version: 3.4.14
75
75
  signing_key:
76
76
  specification_version: 4
77
- summary: Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
77
+ summary: Bundle and transpile JavaScript in Rails with bun, esbuild, rollup.js, or
78
+ Webpack.
78
79
  test_files: []