esbuild-rails 0.1.3 → 0.1.4

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: 8c374c77f9f500a218b0f34d0e87aeb94bba7e17481f71a1e149023ed6917f81
4
- data.tar.gz: e869ad2dae5c772d14d6403d8200895dc2703ba3eec347c963481b7901cc0ad0
3
+ metadata.gz: bef9049287a92769cfe3fd83b58b7f3a4786c99cf5eb1e282afbc96585733b4a
4
+ data.tar.gz: 15c8ead90aa291b6d5bbf1a495f7f92f6dbf6173dfa8016d5a2a9229f18ed8e5
5
5
  SHA512:
6
- metadata.gz: 5752a20e9cd306fbdf601f44df91998178dd9b32e03a32ee3308e0e5d7640c769ad97fab72033c13912d4dfec05ec592815f4f6229765c3b45bcb7d7abe264d5
7
- data.tar.gz: 85f4e550cf3d05790fbf1c0322deee0a967e9d7fedbaff5af1d90e54f0d5b3c785ea79712688662dcea3773dde469e456d9906a566bb822684c1dd7ffa5fdb5b
6
+ metadata.gz: 14ecd25d2e85ab98eecb18ec7686e49e74e33444f30808a290bba7551ee5ef1bb1fb1d13848d1bb5baea992db2371a47e2205e61ce428aca562518f4541cbab7
7
+ data.tar.gz: 3b7d99522da45bd89a72b3d126c7c292cd74528b723c35dc56d1b03905d10f7fea291adcd297541f7997bbc3168b013a19d0db03264a581bec3cdf5b9eb52814
data/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  Use [esbuild](https://esbuild.github.io) to bundle your JavaScript, then deliver it via the asset pipeline in Rails. This gem provides an installer to get you going with esbuild in a new Rails application, and a convention to use `app/assets/builds` to hold your bundled output as artifacts that are not checked into source control (the installer adds this directory to `.gitignore` by default).
4
4
 
5
- You develop using this approach by running esbuild in watch mode in a terminal with `yarn build --watch` (and your Rails server in another, if you're not using something like [puma-dev](https://github.com/puma/puma-dev)). Whenever esbuild detects changes to any of the JavaScript files in your project, it'll bundle `app/javascript/application.js` into `app/assets/builds/javascript.js`. You can refer to the build output in your layout using the standard asset pipeline approach with `<%= javascript_include_tag "application" %>`.
5
+ You develop using this approach by running esbuild in watch mode in a terminal with `yarn build --watch` (and your Rails server in another, if you're not using something like [puma-dev](https://github.com/puma/puma-dev)). Whenever esbuild detects changes to any of the JavaScript files in your project, it'll bundle `app/javascript/application.js` into `app/assets/builds/javascript.js` (and all other entry points placed in the root of `app/javascript`). You can refer to the build output in your layout using the standard asset pipeline approach with `<%= javascript_include_tag "application" %>`.
6
6
 
7
- When you deploy your application to production, esbuild attaches to the `assets:precompile` task to ensure that all your package dependencies from `package.json` have been installed via npm, and then runs `yarn build` to process `app/javascript/application.js` into `app/assets/builds/javascript.js`. The latter file is then picked up by the asset pipeline, digested, and copied into public/assets, as any other asset pipeline file.
7
+ When you deploy your application to production, esbuild attaches to the `assets:precompile` task to ensure that all your package dependencies from `package.json` have been installed via npm, and then runs `yarn build` to process all the entry points, as it would in development. The latter files are then picked up by the asset pipeline, digested, and copied into public/assets, as any other asset pipeline file.
8
+
9
+ This also happens in testing where esbuild attaches to the `test:prepare` task to ensure the JavaScript has been compiled 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`).
8
10
 
9
11
  That's it!
10
12
 
@@ -1,3 +1,3 @@
1
1
  module Esbuild
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -2,6 +2,6 @@
2
2
  "name": "myapp",
3
3
  "private": "true",
4
4
  "scripts": {
5
- "build": "esbuild app/javascript/application.js --outfile=app/assets/builds/application.js --bundle"
5
+ "build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
6
6
  }
7
7
  }
@@ -6,3 +6,4 @@ namespace :esbuild do
6
6
  end
7
7
 
8
8
  Rake::Task["assets:precompile"].enhance(["esbuild:compile"])
9
+ Rake::Task["test:prepare"].enhance(["esbuild:compile"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esbuild-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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-04 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails