sewing_kit 0.27.3 → 0.28.0

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
  SHA1:
3
- metadata.gz: 54caa1fe8a4c60c1040e465c857f5d255c111964
4
- data.tar.gz: 80662d8a0a5c5995ab9a4294ff2ee3b002aa759a
3
+ metadata.gz: 0bea84b065d0c7713ba5973213988b614db786e3
4
+ data.tar.gz: 2bd89efe8f95ca2c9868f211c3051854d934ac23
5
5
  SHA512:
6
- metadata.gz: 69db1d5bb726b8dd4189175b1556f5b053688f5a7252a26f990d10e09a58c3e3843afab12e83704e8118c7db12a5fd18ba18fd361c53ccda241cd6602bda2708
7
- data.tar.gz: 57cce427b05e3de2b2b795ad0ef0cf7bc137b927f4a9121a5c64915cc6d8bbf77bdefbe04a2c616006f3eeb4151ae95ce85364a97eed1e0edb68d2ce86937289
6
+ metadata.gz: 7869086387d0f21dc8e22d49ad1863c4aefd8b57a01902bbb336c1f52910862388a60d759e27026f7d4d2b69b434d9b1dde90e07fb8abd5bd7e769bfa6f7cc23
7
+ data.tar.gz: d5d3805841c1a0d33a50cbb822d178bb2ec9f5c68239cd6feb649b3fb69af6829095c27051207f4547d27d414e41e22148c645900c896e4a9a271570b65ac17e
data/README.md CHANGED
@@ -11,8 +11,7 @@ Create a Rails project using `dev init` then:
11
11
  ```sh
12
12
  # Add Ruby/Node dependencies
13
13
  bundle add sewing_kit
14
- yarn add --dev @shopify/sewing-kit
15
- yarn add --dev react-hot-loader@3.0.0-beta.7
14
+ yarn add @shopify/sewing-kit
16
15
 
17
16
  # Optional - add Polaris
18
17
  yarn add @shopify/polaris react react-dom
@@ -91,13 +90,6 @@ If sewing-kit makes a breaking change, this gem's minor version will be bumped t
91
90
  It is currently not recommended to use `sprockets-commoner` and `sewing_kit` in the same project.
92
91
  Minimally, it is required that the project does not have its own `babel-*` libraries that `sewing-kit` currently has as [dependencies](https://github.com/Shopify/sewing-kit/blob/master/package.json#L97~L102).
93
92
 
94
- ## Build Pipeline Gotchas
95
- While sewing-kit is a dev dependency, it is needed for production builds. This means that the production build will break if the environment variable `YARN_INSTALL` is set to true, because it will prevent `devDependencies` from being installed.
96
-
97
- To work around this in Buildkite, set `YARN_PRODUCTION=false` in the Environment Variables section of Pipeline Settings:
98
-
99
- ![image](https://user-images.githubusercontent.com/2354121/36445473-64f6c4a2-164c-11e8-90fd-4e1b7835d7a2.png)
100
-
101
93
  ## React Boilerplate
102
94
  * Create a React app in `app/ui/App.js` ([example](https://github.com/Shopify/rails_sewing_kit_example/blob/master/app/ui/App.jsx))
103
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))
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SewingKit
3
- VERSION = "0.27.3"
3
+ VERSION = "0.28.0"
4
4
  end
@@ -6,7 +6,7 @@ module SewingKit
6
6
  def initialize
7
7
  super(
8
8
  "sewing-kit is not installed. " \
9
- "Try `yarn add --dev @shopify/sewing-kit`"
9
+ "Try `yarn add @shopify/sewing-kit`"
10
10
  )
11
11
  end
12
12
  end
@@ -8,15 +8,18 @@ module SewingKit
8
8
  module Helper
9
9
  include ActionView::Helpers
10
10
 
11
- class UnknownJavaScriptAssetError < StandardError
11
+ class UnknownAssetError < StandardError
12
12
  end
13
13
 
14
14
  Asset = Struct.new(:path, :integrity)
15
15
 
16
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
16
17
  def sewing_kit_assets(entrypoint_name, extension: 'js')
17
18
  return '' unless entrypoint_name.present?
18
19
 
19
20
  assets = SewingKit::Webpack::Manifest.asset_dependencies(entrypoint_name)
21
+
22
+ raise UnknownAssetError, "#{entrypoint_name} was not found in manifest." if raise_unknown_error? assets
20
23
  return [] unless assets && assets[extension]
21
24
 
22
25
  dependencies = assets[extension]
@@ -25,6 +28,7 @@ module SewingKit
25
28
  Asset.new(raw_asset['path'], raw_asset['integrity'])
26
29
  end
27
30
  end
31
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
28
32
 
29
33
  def sewing_kit_link_tag(*assets)
30
34
  options = assets.extract_options!
@@ -74,6 +78,10 @@ module SewingKit
74
78
  Rails.env.development?
75
79
  end
76
80
 
81
+ def raise_unknown_error?(assets)
82
+ assets.nil? && serve_development_assets?
83
+ end
84
+
77
85
  def dll_asset
78
86
  Asset.new('/webpack/assets/dll/vendor.js')
79
87
  end
@@ -10,7 +10,7 @@ module SewingKit
10
10
  class NodeSewingKitNotRunnable < StandardError
11
11
  def initialize(mode, cause = nil)
12
12
  env_message = if 'development' == mode
13
- "Try `yarn add --dev @shopify/sewing-kit`"
13
+ "Try `yarn add @shopify/sewing-kit`"
14
14
  else
15
15
  "\nIf this is a container build, try:\n" \
16
16
  " - Adding #{highlight('https://github.com/heroku/heroku-buildpack-nodejs')} to your " \
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.27.3
4
+ version: 0.28.0
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-04-08 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties