sewing_kit 0.28.0 → 0.29.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
  SHA1:
3
- metadata.gz: 0bea84b065d0c7713ba5973213988b614db786e3
4
- data.tar.gz: 2bd89efe8f95ca2c9868f211c3051854d934ac23
3
+ metadata.gz: d23f8144c067f32539e07da4cb8e106f70f8eeb4
4
+ data.tar.gz: 55e53bf2912ae6059099c9a0ebcbc7bcd94353cc
5
5
  SHA512:
6
- metadata.gz: 7869086387d0f21dc8e22d49ad1863c4aefd8b57a01902bbb336c1f52910862388a60d759e27026f7d4d2b69b434d9b1dde90e07fb8abd5bd7e769bfa6f7cc23
7
- data.tar.gz: d5d3805841c1a0d33a50cbb822d178bb2ec9f5c68239cd6feb649b3fb69af6829095c27051207f4547d27d414e41e22148c645900c896e4a9a271570b65ac17e
6
+ metadata.gz: d45d0879e97f5c38f9d76a7c3f32bb1d7703a5792cb73c78cef0351255e8acbd7a1bb7c5c104b34c26401adcfcf0fbfd4851ed4ea9d16c76ca7f394877764c33
7
+ data.tar.gz: bd33f6fa33df9f136ffacb4ca02a6fb103ee40388e0bb9e88de999109ba02d5b56de1078ddbe5732a9e8f89e28ce6c542dbd28301e8b94eafa578faed1dae91b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # sewing_kit
1
+ # sewing_kit [![Build status](https://badge.buildkite.com/e7cdc87e61b9fe80e91e8686b6bfba53ca26a36366eb811a50.svg)](https://buildkite.com/shopify/sewing-kit-1)
2
2
 
3
3
  Zero configuration, high performance front end development at organization scale.
4
4
 
@@ -95,3 +95,7 @@ Minimally, it is required that the project does not have its own `babel-*` libra
95
95
  * In an `erb` view, add a placeholder for React content ([example](https://github.com/Shopify/rails_sewing_kit_example/blob/master/app/views/home/index.html.erb#L4))
96
96
  * In `index.js`, render a React component into the placeholder element ([example](https://github.com/Shopify/rails_sewing_kit_example/blob/master/app/ui/index.js))
97
97
  * Use `sewing_kit_script_tag`/`sewing_kit_link_tag` helpers to link erb/js ([example](https://github.com/Shopify/rails_sewing_kit_example/blob/master/app/views/layouts/application.html.erb#L8))
98
+
99
+ ## FAQ
100
+ ### How can I fix production builds that are failing due to missing devDependencies?
101
+ By moving everything into `package.json#dependencies`. This is necessary because Rails 5.2 prunes `devDependencies` during asset compilation.
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SewingKit
3
- VERSION = "0.28.0"
3
+ VERSION = "0.29.1"
4
4
  end
@@ -4,7 +4,21 @@ require 'sewing_kit/webpack/webpack'
4
4
  module SewingKit
5
5
  module Webpack
6
6
  class Compiler
7
+ class NodeNotInstalled < StandardError
8
+ def initialize
9
+ super(
10
+ "nodejs is not installed. " \
11
+ "Try creating a `.buildpack` file in the root of the project with following content:
12
+
13
+ https://github.com/heroku/heroku-buildpack-nodejs.git
14
+ https://github.com/heroku/heroku-buildpack-ruby.git
15
+ "
16
+ )
17
+ end
18
+ end
19
+
7
20
  def compile
21
+ raise NodeNotInstalled unless node_installed?
8
22
  raise NodeSewingKitNotRunnable, node_env unless File.exist?('node_modules/.bin/sewing-kit')
9
23
 
10
24
  result = Kernel.system(
@@ -29,13 +43,17 @@ module SewingKit
29
43
  'node_modules/.bin/sewing-kit',
30
44
  'build',
31
45
  '--mode',
32
- node_env
46
+ node_env,
33
47
  ].reject(&:empty?)
34
48
  end
35
49
 
36
50
  def node_env
37
51
  ENV['NODE_ENV'] || Rails.env.to_s
38
52
  end
53
+
54
+ def node_installed?
55
+ Kernel.system('node --version')
56
+ end
39
57
  end
40
58
  end
41
59
  end
@@ -1,4 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require 'English'
4
+
2
5
  module SewingKit
3
6
  module Webpack
4
7
  class Dev
@@ -15,6 +18,7 @@ module SewingKit
15
18
 
16
19
  def start
17
20
  @pid = spawn
21
+ at_exit { handle_exit }
18
22
  detach
19
23
  end
20
24
 
@@ -38,6 +42,13 @@ module SewingKit
38
42
  ) || exit(1)
39
43
  end
40
44
 
45
+ def handle_exit
46
+ return if $ERROR_INFO.nil?
47
+ Process.kill 'SIGTERM', pid
48
+ rescue Errno::ESRCH
49
+ nil
50
+ end
51
+
41
52
  def detach
42
53
  Process.detach pid
43
54
  end
@@ -11,7 +11,12 @@ module SewingKit
11
11
 
12
12
  # :nodoc:
13
13
  def asset_dependencies(entrypoint_name)
14
- metadata['entrypoints'][entrypoint_name]
14
+ current_metadata = metadata
15
+ if current_metadata.key?('development')
16
+ current_metadata['development']['hangTight']
17
+ else
18
+ current_metadata['entrypoints'][entrypoint_name]
19
+ end
15
20
  end
16
21
 
17
22
  def clear_cache!
@@ -28,7 +28,7 @@ module SewingKit
28
28
  end
29
29
 
30
30
  result = load_metadata_from_node
31
- raise LegacyManifestError, result unless result['entrypoints']
31
+ raise LegacyManifestError, result unless result['entrypoints'] || result['development']
32
32
 
33
33
  @metadata_path = result && result['path']
34
34
  result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sewing_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Sauve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0.51'
61
+ version: '0.56'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0.51'
68
+ version: '0.56'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop-git
57
71
  requirement: !ruby/object:Gem::Requirement