jetpacker 0.3.0 → 0.4.0

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: 7c6db5938f2a3c413822c185088945252016ebc7bfb325a980d23c90aff05e1a
4
- data.tar.gz: 47f673c09ca891026c9aae0b0b7b43de6922ecfa01881621243dcfc8ee0f9582
3
+ metadata.gz: aca46ec407f1dc954d3fc858ea90a4db2087d85b7ea2786164083b9ef870b0ea
4
+ data.tar.gz: baf982ed4847c5c85291f44e7d1fe127374c788e982cd9047d44deed651987c5
5
5
  SHA512:
6
- metadata.gz: d6245a051cdfbd09f553b5727997d6fd6962791fba7a45e9b2a567ca3842d9d45e1bf7363f65c055fb0fa5f4f1605b17cb6d7a0a063a27c2094b54eb02183dbb
7
- data.tar.gz: fd3eb411512e9c99e657261518122d8c8495478013c1e9c5aa32df73a487b9db3c78bee7b605f13856260dcd1a4b2e0ad7d7b508dff66e3468db815c76f36bfb
6
+ metadata.gz: f366e1fd65079cb369f87cae31b4e858e7a0ff9c69deba2a0b3eb821d060cb829fe59c8d3047dd8af84985fb8f19dfc73bfaf05b4edddd9095554bb86686e51a
7
+ data.tar.gz: 22875916f46fab1d18acc77eb2fba5ac04471fcb97f93ddb6e61440572fbcf43f6fd1126fcac2c1b48a3ddb846c77b23cb945ed5bbd361e8043c9152a12211f3
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.4.0]
7
+ - add jets turbine to load webpacker, but dont run yarn check on lambda
8
+ - default extract_css: true
9
+
6
10
  ## [0.3.0]
7
11
  - dont install javascript/packs/application.js, jets adds a custom one
8
12
 
@@ -6,12 +6,12 @@ Gem::Specification.new do |s|
6
6
  s.version = Jetpacker::VERSION
7
7
  s.authors = [ "Tung Nguyen" ]
8
8
  s.email = [ "tongueroo@gmail.com" ]
9
- # Only commented out, so people do not accidentally contact incorrect person for jetspacker specific related issues.
9
+ # Only commented out, so people do not accidentally contact the incorrect person for jetspacker specific related issues.
10
10
  # Credit goes to original authors of the work:
11
11
  # s.authors = [ "David Heinemeier Hansson", "Gaurav Tiwari" ]
12
12
  # s.email = [ "david@basecamp.com", "gaurav@gauravtiwari.co.uk" ]
13
13
  s.summary = "Use webpack to manage app-like JavaScript modules in Jets"
14
- s.homepage = "https://github.com/tonguero/jetpacker"
14
+ s.homepage = "https://github.com/tongueroo/jetpacker"
15
15
  s.license = "MIT"
16
16
 
17
17
  s.metadata = {
@@ -17,7 +17,13 @@ default: &default
17
17
  cache_manifest: false
18
18
 
19
19
  # Extract and emit a css file
20
- extract_css: false
20
+ # Note: Different from original webpacker default which is extract_css: false
21
+ # Unsure if this is really a better default. But want to maintain backward compatiblity when folks upgrade Jets.
22
+ # Notes:
23
+ # https://github.com/rails/webpacker/issues/2059
24
+ # https://github.com/rails/webpacker/issues/2202
25
+ # https://github.com/rails/webpacker/issues/2342
26
+ extract_css: true
21
27
 
22
28
  static_assets_extensions:
23
29
  - .jpg
@@ -0,0 +1 @@
1
+ require_relative "webpacker"
@@ -1,4 +1,4 @@
1
1
  # Separate version from Webpacker version for the jetpacker gem
2
2
  module Jetpacker
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
@@ -43,4 +43,4 @@ require "webpacker/compiler"
43
43
  require "webpacker/commands"
44
44
  require "webpacker/dev_server"
45
45
 
46
- # require "webpacker/railtie" if defined?(Rails)
46
+ require "webpacker/turbine" if defined?(Jets)
@@ -0,0 +1,76 @@
1
+ require "webpacker/helper"
2
+ require "webpacker/dev_server_proxy"
3
+
4
+ module Webpacker
5
+ class Turbine < ::Jets::Turbine
6
+ initializer "webpacker.set_configs" do |app|
7
+ # Allows Webpacker config values to be set via Jets env config files
8
+ app.config.webpacker ||= ActiveSupport::OrderedOptions.new # TODO: all config access outside initializer block
9
+
10
+ if app.config.webpacker.key?(:check_yarn_integrity)
11
+ Webpacker.config.check_yarn_integrity = app.config.webpacker.check_yarn_integrity
12
+ end
13
+ end
14
+
15
+ # ================================
16
+ # Check Yarn Integrity Initializer
17
+ # ================================
18
+ #
19
+ # development (on by default):
20
+ #
21
+ # to turn off:
22
+ # - edit config/environments/development.rb
23
+ # - add `config.webpacker.check_yarn_integrity = false`
24
+ #
25
+ # production (off by default):
26
+ #
27
+ # to turn on:
28
+ # - edit config/environments/production.rb
29
+ # - add `config.webpacker.check_yarn_integrity = true`
30
+ initializer "webpacker.yarn_check" do |app|
31
+ if File.exist?("yarn.lock") && Webpacker.config.config_path.exist? && Webpacker.config.check_yarn_integrity?
32
+ output = `yarn check --integrity && yarn check --verify-tree 2>&1`
33
+
34
+ unless $?.success?
35
+ $stderr.puts "\n\n"
36
+ $stderr.puts "========================================"
37
+ $stderr.puts " Your Yarn packages are out of date!"
38
+ $stderr.puts " Please run `yarn install --check-files` to update."
39
+ $stderr.puts "========================================"
40
+ $stderr.puts "\n\n"
41
+ $stderr.puts "To disable this check, please change `check_yarn_integrity`"
42
+ $stderr.puts "to `false` in your webpacker config file (config/webpacker.yml)."
43
+ $stderr.puts "\n\n"
44
+ $stderr.puts output
45
+ $stderr.puts "\n\n"
46
+
47
+ exit(1)
48
+ end
49
+ end
50
+ end unless ENV['AWS_LAMBDA_FUNCTION_NAME'] # dont run yarn check on lambda
51
+
52
+ # TODO: add support load middleware in a Turbine
53
+ # initializer "webpacker.proxy" do |app|
54
+ # insert_middleware = Webpacker.config.dev_server.present? rescue nil
55
+ # if insert_middleware
56
+ # app.middleware.insert_before 0, Webpacker::DevServerProxy
57
+ # end
58
+ # end
59
+
60
+ initializer "webpacker.helper" do
61
+ ActiveSupport.on_load :action_controller do
62
+ ActionController::Base.helper Webpacker::Helper
63
+ end
64
+
65
+ ActiveSupport.on_load :action_view do
66
+ include Webpacker::Helper
67
+ end
68
+ end
69
+
70
+ initializer "webpacker.set_source" do |app|
71
+ if Webpacker.config.config_path.exist?
72
+ app.config.javascript_path = Webpacker.config.source_path.relative_path_from(Jets.root.join("app")).to_s
73
+ end
74
+ end
75
+ end
76
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jetpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
@@ -188,6 +188,7 @@ files:
188
188
  - lib/install/template.rb
189
189
  - lib/install/typescript.rb
190
190
  - lib/install/vue.rb
191
+ - lib/jetpacker.rb
191
192
  - lib/jetpacker/version.rb
192
193
  - lib/tasks/installers.rake
193
194
  - lib/tasks/webpacker.rake
@@ -216,6 +217,7 @@ files:
216
217
  - lib/webpacker/railtie.rb
217
218
  - lib/webpacker/rake_tasks.rb
218
219
  - lib/webpacker/runner.rb
220
+ - lib/webpacker/turbine.rb
219
221
  - lib/webpacker/version.rb
220
222
  - lib/webpacker/webpack_runner.rb
221
223
  - package.json
@@ -283,12 +285,12 @@ files:
283
285
  - test/webpack_runner_test.rb
284
286
  - test/webpacker_test.rb
285
287
  - yarn.lock
286
- homepage: https://github.com/tonguero/jetpacker
288
+ homepage: https://github.com/tongueroo/jetpacker
287
289
  licenses:
288
290
  - MIT
289
291
  metadata:
290
- source_code_uri: https://github.com/tongueroo/jetpacker/tree/v0.3.0
291
- changelog_uri: https://github.com/tongueroo/jetpacker/blob/v0.3.0/CHANGELOG.md
292
+ source_code_uri: https://github.com/tongueroo/jetpacker/tree/v0.4.0
293
+ changelog_uri: https://github.com/tongueroo/jetpacker/blob/v0.4.0/CHANGELOG.md
292
294
  post_install_message:
293
295
  rdoc_options: []
294
296
  require_paths: