sewing_kit 0.95.4 → 0.96.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -7
- data/lib/sewing_kit/configuration.rb +2 -1
- data/lib/sewing_kit/version.rb +1 -1
- data/lib/sewing_kit/webpack/dev.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c9a4d05fadcda6b90c207bb14c7652c1e16725be38391f53ba66b2af982550
|
4
|
+
data.tar.gz: 7848dba3af77dcf21232061744a33afe61a7e6ed5a67a46ffdaf5c0ce04c7fb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 820de0241ba40a9735a6aca803b2c74adda0ae2575541e5975a0ea28adb3c9c660564e50f184cb39fbb4e51828f29e00e8815acdd6a863a89b5c29a79ccaff34
|
7
|
+
data.tar.gz: 247dda76a13df81da377d05810508abb6d722e95809d462c4679c734173a3d1b86760ac4f75aab2bb36b78e677da776dd57b6d2af822faaa6c112e19642b64fd
|
data/README.md
CHANGED
@@ -4,12 +4,6 @@ Zero configuration, high performance front end development at organization scale
|
|
4
4
|
|
5
5
|
`sewing_kit` facilitates legacy Rails integration using ERB tags. For a more complete modern stack with performance-as-a-feature, consider [quilt_rails](https://github.com/Shopify/quilt/tree/master/gems/quilt_rails). For details of the `sewing-kit` node package's configuration and usage, see the [sewing-kit README](/README.md).
|
6
6
|
|
7
|
-
## Use `quilt_rails` for React Server-Side-Rendering
|
8
|
-
|
9
|
-
For React applications with a Rails backend, the best-practice for user-experience is server-side-rendering (SSR). **For building out React applications using SSR and Sewing-Kit, see [`quilt_rails`](https://github.com/Shopify/quilt/tree/master/gems/quilt_rails)**.
|
10
|
-
|
11
|
-
If you are building a conventional Rails application using `.erb` files and just want modern JavaScript / TypeScript compilation, continue reading this document.
|
12
|
-
|
13
7
|
## Quick Start
|
14
8
|
|
15
9
|
Create a Rails project using `dev init` then:
|
@@ -54,6 +48,28 @@ The `main` bundle is imported into `erb` files using Rails helpers:
|
|
54
48
|
└─- application.html.erb (must link to JS / CSS using sewing_kit_script_tag / sewing_kit_link_tag
|
55
49
|
```
|
56
50
|
|
51
|
+
## Configuring development mode
|
52
|
+
|
53
|
+
`SewingKit.configure` provides a `development_options` attribute that adjusts the behaviour of sewing-kit's development mode. See [the `dev` command's documentation](/docs/commands/dev.md) for a full list of options.
|
54
|
+
|
55
|
+
### Usage
|
56
|
+
|
57
|
+
```rb
|
58
|
+
# config/initializers/sewing_kit.rb
|
59
|
+
SewingKit.configure do |config|
|
60
|
+
# Disable hot module reloading
|
61
|
+
config.development_options[:hot] = false
|
62
|
+
|
63
|
+
# Launch development mode with extra memory (helpful if source maps are
|
64
|
+
# occupying more than Node's default 1.4GB heap allocation)
|
65
|
+
config.development_options[:heap] = 4000
|
66
|
+
|
67
|
+
# Disable source maps (very large apps may need to builds sans source maps to
|
68
|
+
# reduce development mode's memory usage)
|
69
|
+
config.development_options[:source_maps] = false
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
57
73
|
## Testing the front end
|
58
74
|
|
59
75
|
For fast tests with consistent results, test front-end components using Jest instead of Rails integration tests.
|
@@ -79,7 +95,7 @@ The default behaviour is equivalent to this configuration:
|
|
79
95
|
```rb
|
80
96
|
# config/initializers/sewing_kit.rb
|
81
97
|
SewingKit.configure do |config|
|
82
|
-
config.test_manifest_mode = :
|
98
|
+
config.test_manifest_mode = :return_no_assets
|
83
99
|
end
|
84
100
|
```
|
85
101
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module SewingKit
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :build_options, :dev_server_sewing_kit_bin, :manifest_name,
|
4
|
+
attr_accessor :development_options, :build_options, :dev_server_sewing_kit_bin, :manifest_name,
|
5
5
|
:manifest_path
|
6
6
|
attr_reader :test_manifest_mode, :log_level
|
7
7
|
|
@@ -24,6 +24,7 @@ module SewingKit
|
|
24
24
|
|
25
25
|
def initialize
|
26
26
|
@build_options = nil
|
27
|
+
@development_options = {}
|
27
28
|
@manifest_name = 'sewing-kit-manifest.json'
|
28
29
|
@manifest_path = nil
|
29
30
|
@dev_server_sewing_kit_bin = 'node_modules/.bin/sewing-kit'
|
data/lib/sewing_kit/version.rb
CHANGED
@@ -54,7 +54,7 @@ module SewingKit
|
|
54
54
|
'dev',
|
55
55
|
'--logLevel',
|
56
56
|
log_level,
|
57
|
-
]
|
57
|
+
].concat(options)
|
58
58
|
|
59
59
|
if debug_mode?
|
60
60
|
command_list.push(['--debug'])
|
@@ -64,7 +64,12 @@ module SewingKit
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def sewing_kit_bin
|
67
|
-
|
67
|
+
heap_size = SewingKit.configuration.development_options[:heap]
|
68
|
+
heap_config = if heap_size
|
69
|
+
"node --max-old-space-size=#{heap_size} "
|
70
|
+
end
|
71
|
+
|
72
|
+
bin = "#{heap_config}#{SewingKit.configuration.dev_server_sewing_kit_bin}"
|
68
73
|
raise NodeSewingKitNotInstalled unless File.exist?(bin)
|
69
74
|
bin
|
70
75
|
end
|
@@ -77,6 +82,15 @@ module SewingKit
|
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
85
|
+
def options
|
86
|
+
development_options = SewingKit.configuration.development_options
|
87
|
+
return [] unless development_options
|
88
|
+
|
89
|
+
development_options
|
90
|
+
.reject { |key| key == :heap }
|
91
|
+
.map { |key, value| ["--#{key}", value] }.flatten
|
92
|
+
end
|
93
|
+
|
80
94
|
def log_level_from_rails
|
81
95
|
case Rails.logger.level
|
82
96
|
when 0
|
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.
|
4
|
+
version: 0.96.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: 2019-
|
11
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|