vite_ruby 3.2.8 → 3.2.9

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
  SHA256:
3
- metadata.gz: a60bbaf0cc05f9069adf63ab3b37c5a5be8128b33a9c78af1d879e3da8a6efad
4
- data.tar.gz: 8b9c020b238f9dbef92d0502e5bd52efbf94b296c5dbf8344697def581098670
3
+ metadata.gz: 20ac624f70c7542fa8b7ca1c607ef176472b092e528351cd2a0ebd7b88ec4814
4
+ data.tar.gz: 02b3d2e24e44744a8aff0cb9a86b8994fa5418c565053c578a8a761a47d69016
5
5
  SHA512:
6
- metadata.gz: 86ebf0abc853c732c84cd78c3c667ded2271ed2833751609f71b78c3a2c35a8d443aff7368174005cd10306b8fc31358c56a039daf875657efb7d5b66b13b8b4
7
- data.tar.gz: 2ba6da60334959ee8ce5a9a98410a436c6140a06f9d23f4adcf6805ca92e98fd7d090391dc82fad8c4608f9037072229cafcc4b556dddd489a3a8cffbc1abfcf
6
+ metadata.gz: 4cfe7af9d34936166ca6c0576ec1d5f84e445d64232d726f53ff79b92c767744aba2a3d72b7874301946ebddc51c2f1567645f5af3b8c82f8c6195ff364d52aa
7
+ data.tar.gz: ad7b30b2f29c1c649f938266766096e1b99860f4d5f69b7efb0aa744078a0f72992585e21840d5976be80d5bd736b87e9bb3fd92639076b1bfd88705fdada696
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.2.9](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.2.8...vite_ruby@3.2.9) (2022-11-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * allow different ViteRuby instances to set different env vars ([25628a7](https://github.com/ElMassimo/vite_ruby/commit/25628a752cbd4828547c1f454cc4cb2217a591e0))
7
+ * output exit code when vite process fails ([#294](https://github.com/ElMassimo/vite_ruby/issues/294)) ([eb8f678](https://github.com/ElMassimo/vite_ruby/commit/eb8f678248a02b693fffe5a49309984fed92a051)), closes [#292](https://github.com/ElMassimo/vite_ruby/issues/292)
8
+
9
+
10
+
1
11
  ## [3.2.8](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.2.7...vite_ruby@3.2.8) (2022-10-28)
2
12
 
3
13
 
@@ -14,10 +14,10 @@ class ViteRuby::Builder
14
14
  last_build = last_build_metadata(ssr: args.include?('--ssr'))
15
15
 
16
16
  if args.delete('--force') || last_build.stale? || config.manifest_paths.empty?
17
- stdout, stderr, success = build_with_vite(*args)
18
- log_build_result(stdout, stderr, success)
19
- record_build_metadata(last_build, errors: stderr, success: success)
20
- success
17
+ stdout, stderr, status = build_with_vite(*args)
18
+ log_build_result(stdout, stderr, status)
19
+ record_build_metadata(last_build, errors: stderr, success: status.success?)
20
+ status.success?
21
21
  elsif last_build.success
22
22
  logger.debug "Skipping vite build. Watched files have not changed since the last build at #{ last_build.timestamp }"
23
23
  true
@@ -70,11 +70,12 @@ private
70
70
  #
71
71
  # NOTE: By default it also outputs the manifest entries.
72
72
  def log_build_result(_stdout, stderr, status)
73
- if status
73
+ if status.success?
74
74
  logger.info "Build with Vite complete: #{ config.build_output_dir }"
75
75
  logger.error stderr unless stderr.empty?
76
76
  else
77
77
  logger.error stderr
78
+ logger.error status
78
79
  logger.error 'Build with Vite failed! ❌'
79
80
  logger.error '❌ Check that vite and vite-plugin-ruby are in devDependencies and have been installed. ' if stderr.include?('ERR! canceled')
80
81
  end
@@ -111,7 +111,7 @@ private
111
111
  def run_with_capture(*args, **options)
112
112
  Dir.chdir(root) do
113
113
  _, stderr, status = ViteRuby::IO.capture(*args, **options)
114
- say(stderr) unless status || stderr.empty?
114
+ say(stderr) unless status.success? || stderr.empty?
115
115
  end
116
116
  end
117
117
 
@@ -55,12 +55,12 @@ class ViteRuby::Config
55
55
  end
56
56
 
57
57
  # Public: Sets additional environment variables for vite-plugin-ruby.
58
- def to_env
58
+ def to_env(env_vars = ViteRuby.env)
59
59
  CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env|
60
60
  unless (value = @config[option]).nil?
61
61
  env["#{ ViteRuby::ENV_PREFIX }_#{ option.upcase }"] = value.to_s
62
62
  end
63
- end.merge(ViteRuby.env)
63
+ end.merge(env_vars)
64
64
  end
65
65
 
66
66
  # Internal: Files and directories that should be watched for changes.
data/lib/vite_ruby/io.rb CHANGED
@@ -15,7 +15,7 @@ module ViteRuby::IO
15
15
  stdin.close
16
16
  out = Thread.new { read_lines(stdout, &with_output) }
17
17
  err = Thread.new { stderr.read }
18
- [out.value, err.value.to_s, wait_threads.value.success?]
18
+ [out.value, err.value.to_s, wait_threads.value]
19
19
  }
20
20
  end
21
21
 
@@ -23,11 +23,11 @@ private
23
23
 
24
24
  extend Forwardable
25
25
 
26
- def_delegators :@vite_ruby, :config, :logger
26
+ def_delegators :@vite_ruby, :config, :logger, :env
27
27
 
28
28
  # Internal: Returns an Array with the command to run.
29
29
  def command_for(args)
30
- [config.to_env].tap do |cmd|
30
+ [config.to_env(env)].tap do |cmd|
31
31
  args = args.clone
32
32
  cmd.push('node', '--inspect-brk') if args.delete('--inspect')
33
33
  cmd.push('node', '--trace-deprecation') if args.delete('--trace_deprecation')
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '3.2.8'
4
+ VERSION = '3.2.9'
5
5
 
6
6
  # Internal: Versions used by default when running `vite install`.
7
7
  DEFAULT_VITE_VERSION = '^3.2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.8
4
+ version: 3.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-28 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -202,8 +202,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
202
202
  licenses:
203
203
  - MIT
204
204
  metadata:
205
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.2.8/vite_ruby
206
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.2.8/vite_ruby/CHANGELOG.md
205
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.2.9/vite_ruby
206
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.2.9/vite_ruby/CHANGELOG.md
207
207
  post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
208
208
  manually, please run:\n\tbundle exec vite upgrade"
209
209
  rdoc_options: []