jsbundling-rails 0.2.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b3886c122782f8cee3ae39317eee237ffe67500f2b6e8e4d0e46192d3214c5b
4
- data.tar.gz: ede0353d4327d3dff14c7f119271cc40883d76e7bb2fdaf442ba8b508e33961b
3
+ metadata.gz: 8ce188ae363db40e27c1a8f004caeaf9adf86c0b131fe99a9c77364c489e42bb
4
+ data.tar.gz: d772728a1e1032449e3d24663c6d5f83386209837351f37ae55606e544fcb199
5
5
  SHA512:
6
- metadata.gz: 989e1c975ed68bcbb5ed1beb7fdda1b46ec7f8dd764ebf1c0871300541bd651fe74aefd8ac5c4379e347141d7e21553052d03f0ac31e3e580e72d9acabe92daa
7
- data.tar.gz: e17204a1e4e953ada58ccead4e26b4f636075592b97f12b0bba0644d55a54431086b1ca944855f679db5c200870869a4a838371517097d873f2b0dfa67fe4858
6
+ metadata.gz: 6961a70f2ced4686fb65ab8b16a97bd744604e22f7f7aeb23b42f98c13f9f72164b38d741f4710a7d79982166ae4f7923045406826d40281e5927202669c9f5e
7
+ data.tar.gz: e6d21762f3b86eeef19fdff1b2ddd9d3cba6035673ccb5d94948e377f0c788d25c464e9a1216c68c131908e7536a7dd45a628f374972bfe8d62603cd1be2c1bf
data/README.md CHANGED
@@ -16,8 +16,9 @@ That's it!
16
16
 
17
17
  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, and we don't intend to use esbuild as an API in order to hack around it).
18
18
 
19
- 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).
19
+ 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). If you're looking to migrate from webpacker, see the [migration guide](https://github.com/rails/jsbundling-rails/blob/main/docs/switch_from_webpacker.md).
20
20
 
21
+ If you want to use webpack features like [code splitting](https://webpack.js.org/guides/code-splitting/) and [hot module reloading](https://webpack.js.org/concepts/hot-module-replacement/), consider using the official fork of `webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
21
22
 
22
23
  ## Installation
23
24
 
@@ -38,7 +39,7 @@ The default build script for esbuild relies on the `app/javascript/*.*` glob pat
38
39
 
39
40
  ## Why does esbuild overwrite my application.css?
40
41
 
41
- If you [import CSS](https://esbuild.github.io/content-types/#css-from-js) in your application.js while using esbuild, you'll be creating both an `app/assets/builds/application.js` _and_ `app/assets/builds/application.css` file when bundling. The latter can conflict with the `app/assets/builds/application.js` produced by [cssbundling-rails](https://github.com/rails/cssbundling-rails). The solution is to either change the output file for esbuild (and the references for that) or for cssbundling. Both are specified in `package.json`.
42
+ If you [import CSS](https://esbuild.github.io/content-types/#css-from-js) in your application.js while using esbuild, you'll be creating both an `app/assets/builds/application.js` _and_ `app/assets/builds/application.css` file when bundling. The latter can conflict with the `app/assets/builds/application.css` produced by [cssbundling-rails](https://github.com/rails/cssbundling-rails). The solution is to either change the output file for esbuild (and the references for that) or for cssbundling. Both are specified in `package.json`.
42
43
 
43
44
 
44
45
  ## License
data/lib/install/dev CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if ! command -v foreman &> /dev/null
3
+ if ! gem list --silent --installed foreman
4
4
  then
5
5
  echo "Installing foreman..."
6
6
  gem install foreman
7
7
  fi
8
8
 
9
- foreman start -f Procfile.dev
9
+ foreman start -f Procfile.dev "$@"
@@ -8,4 +8,5 @@ if (`npx -v`.to_f < 7.1 rescue "Missing")
8
8
  say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
9
9
  else
10
10
  run %(npm set-script build "#{build_script}")
11
+ run %(yarn build)
11
12
  end
@@ -9,4 +9,5 @@ if (`npx -v`.to_f < 7.1 rescue "Missing")
9
9
  say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
10
10
  else
11
11
  run %(npm set-script build "#{build_script}")
12
+ run %(yarn build)
12
13
  end
@@ -9,4 +9,5 @@ if (`npx -v`.to_f < 7.1 rescue "Missing")
9
9
  say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
10
10
  else
11
11
  run %(npm set-script build "#{build_script}")
12
+ run %(yarn build)
12
13
  end
@@ -1,3 +1,3 @@
1
1
  module Jsbundling
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,13 +1,15 @@
1
1
  namespace :javascript do
2
2
  desc "Build your JavaScript bundle"
3
- task build: [ "yarn:install" ] do
4
- unless system "yarn build"
3
+ task :build do
4
+ unless system "yarn install && yarn build"
5
5
  raise "jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors"
6
6
  end
7
7
  end
8
8
  end
9
9
 
10
- Rake::Task["assets:precompile"].enhance(["javascript:build"])
10
+ if Rake::Task.task_defined?("assets:precompile")
11
+ Rake::Task["assets:precompile"].enhance(["javascript:build"])
12
+ end
11
13
 
12
14
  if Rake::Task.task_defined?("test:prepare")
13
15
  Rake::Task["test:prepare"].enhance(["javascript:build"])
@@ -0,0 +1,10 @@
1
+ namespace :javascript do
2
+ desc "Remove JavaScript builds"
3
+ task :clobber do
4
+ rm_rf Dir["app/assets/builds/[^.]*.js"], verbose: false
5
+ end
6
+ end
7
+
8
+ if Rake::Task.task_defined?("assets:clobber")
9
+ Rake::Task["assets:clobber"].enhance(["javascript:clobber"])
10
+ end
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.2.0
4
+ version: 1.0.1
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-11-15 00:00:00.000000000 Z
11
+ date: 2022-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -46,7 +46,7 @@ files:
46
46
  - lib/jsbundling/engine.rb
47
47
  - lib/jsbundling/version.rb
48
48
  - lib/tasks/jsbundling/build.rake
49
- - lib/tasks/jsbundling/clean.rake
49
+ - lib/tasks/jsbundling/clobber.rake
50
50
  - lib/tasks/jsbundling/install.rake
51
51
  homepage: https://github.com/rails/jsbundling-rails
52
52
  licenses:
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.2.22
70
+ rubygems_version: 3.2.32
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
@@ -1,8 +0,0 @@
1
- namespace :javascript do
2
- desc "Remove JavaScript builds"
3
- task :clean do
4
- rm_rf Dir["app/assets/builds/[^.]*.js"], verbose: false
5
- end
6
- end
7
-
8
- Rake::Task["assets:clean"].enhance(["javascript:clean"])