sewing_kit 0.4.6 → 0.5.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
  SHA1:
3
- metadata.gz: 431a33c19363e493c74124b1f416b5d471b36e0a
4
- data.tar.gz: 61cf9620bea767548234570e668e06e5959bddcc
3
+ metadata.gz: 572e93602f9961fb642d6442358b815f4a5cce4a
4
+ data.tar.gz: a8b7d2400687bc64d59cd76e8221567ea6faabe8
5
5
  SHA512:
6
- metadata.gz: 0ef8fb8b4705914731c8bf9bd1a5f923ccac21f77b51f334dbde35d53ec79f19c7b7070fb788144e17222869d044775816bbc1ca0a99748072d495ec7c2d4613
7
- data.tar.gz: ca77a8b18313019c03ed0524688663c13016d3994573288d20a837410fbd35baf1ebdc14c1cf56285cd486418c1c69e90394169b3ac6268310ebdbf301954a1e
6
+ metadata.gz: 8451f4f5db6387aef5612594aad04fde8776e6b8ca530331397534a9f8ac15393e9b526b66eb42ab3286eb31b75bd9d18a72a68a6279a5b19eef223e6a288edd
7
+ data.tar.gz: e3995a07ca05a8d39fd8e36260b94794a0f26816745108a4504465653803879b83575701bbea455aec852d19a346146211f32c4d71a863900404e3ab9abfe542
@@ -19,12 +19,6 @@ module SewingKit
19
19
  end
20
20
  end
21
21
 
22
- config.sewing_kit = ActiveSupport::OrderedOptions.new
23
- config.sewing_kit.webpack = ActiveSupport::OrderedOptions.new
24
- config.sewing_kit.webpack.manifest_dir = 'tmp/sewing-kit'
25
- config.sewing_kit.webpack.manifest_filename = 'sewing-kit-manifest.json'
26
- config.sewing_kit.webpack.verbose = false
27
-
28
22
  rake_tasks do
29
23
  load "tasks/sewing_kit.rake"
30
24
  end
@@ -1,3 +1,3 @@
1
1
  module SewingKit
2
- VERSION = "0.4.6"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -22,12 +22,8 @@ module SewingKit
22
22
  def command
23
23
  [
24
24
  'node_modules/.bin/sewing-kit',
25
- 'compile',
26
- '--config-file',
27
- 'config/sewing-kit.config.js',
28
- '--target',
29
- 'client',
30
- '--env',
25
+ 'build',
26
+ '--mode',
31
27
  node_env,
32
28
  ].reject(&:empty?)
33
29
  end
@@ -10,33 +10,11 @@ module SewingKit
10
10
 
11
11
  private
12
12
 
13
- def command
14
- cmd = [
15
- 'node_modules/.bin/sewing-kit',
16
- 'dev',
17
- '--config-file',
18
- 'config/sewing-kit.config.js',
19
- '--target',
20
- 'client',
21
- '--env',
22
- node_env
23
- ]
24
-
25
- if hmr?
26
- cmd += ['--hot', '--hot-host', hot_host]
27
- else
28
- cmd += ['--lazy', '--super-speed']
29
- end
30
-
31
- cmd += ['--verbose'] if ::Rails.configuration.sewing_kit.webpack.verbose
32
-
33
- cmd
34
- end
35
-
36
13
  def spawn
37
14
  Kernel.spawn(
38
- { 'NODE_ENV' => node_env },
39
- *command,
15
+ { 'NODE_ENV' => 'development' },
16
+ 'node_modules/.bin/sewing-kit',
17
+ 'dev',
40
18
  chdir: Rails.root.to_s,
41
19
  out: $stdout,
42
20
  err: $stderr,
@@ -46,27 +24,6 @@ module SewingKit
46
24
  def detach
47
25
  Process.detach pid
48
26
  end
49
-
50
- def hmr?
51
- @hmr ||= ENV['SK_DISABLE_HMR'] != 'true'
52
- end
53
-
54
- def hot_host
55
- if host = ::Rails.configuration.sewing_kit.webpack.asset_host
56
- if host.is_a?(Proc) || host.respond_to?(:call)
57
- host.call(nil, nil)
58
- else
59
- host
60
- end
61
- else
62
- "/"
63
- end
64
- end
65
-
66
- private
67
- def node_env
68
- ENV['NODE_ENV'] || Rails.env.to_s
69
- end
70
27
  end
71
28
  end
72
29
  end
@@ -7,7 +7,7 @@ module SewingKit
7
7
  module Helper
8
8
  include ActionView::Helpers
9
9
 
10
- def webpack_asset_paths(source, extension: 'js')
10
+ def sewing_kit_asset_paths(source, extension: 'js')
11
11
  return '' unless source.present?
12
12
 
13
13
  paths = SewingKit::Webpack::Manifest.asset_paths(source)
@@ -43,21 +43,13 @@ module SewingKit
43
43
  end
44
44
 
45
45
  def load_manifest
46
- data = load_static_manifest
47
- JSON.parse(data)
48
- end
49
-
50
- def load_static_manifest
51
- File.read(static_manifest_path)
46
+ JSON.parse(`node_modules/.bin/sewing-kit manifest --mode #{mode}`)
52
47
  rescue => e
53
- raise ManifestLoadError.new("Could not load compiled manifest from #{static_manifest_path} - have you run `rake sewing_kit:compile`?", e)
48
+ raise ManifestLoadError.new("Could not load compiled manifest - have you run `rake sewing_kit:build`?", e)
54
49
  end
55
50
 
56
- def static_manifest_path
57
- ::Rails.root.join(
58
- ::Rails.configuration.sewing_kit.webpack.manifest_dir,
59
- ::Rails.configuration.sewing_kit.webpack.manifest_filename
60
- )
51
+ def mode
52
+ ENV['NODE_ENV'] || Rails.env.to_s || 'production'
61
53
  end
62
54
  end
63
55
  end
@@ -7,7 +7,7 @@ namespace :sewing_kit do
7
7
  end
8
8
 
9
9
  desc "Build webpack asset bundles"
10
- task :compile => :environment do
10
+ task :build => :environment do
11
11
  compiler = SewingKit::Webpack::Compiler.new
12
12
  compiler.compile
13
13
  end
@@ -15,6 +15,6 @@ end
15
15
 
16
16
  if Rake::Task.task_defined?('assets:precompile')
17
17
  Rake::Task['assets:precompile'].enhance do
18
- Rake::Task['sewing_kit:compile'].invoke
18
+ Rake::Task['sewing_kit:build'].invoke
19
19
  end
20
20
  end
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.6
4
+ version: 0.5.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: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties