vite_ruby 1.0.4 → 1.0.5

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: f8ef54a43f8457a31e8af99da6da97e50b9c406c7f0595f7840057dbf830c557
4
- data.tar.gz: fa00714f7a3ad4c63562950b596c564ffc1a8a1592c88a7e313f8a74027a05cb
3
+ metadata.gz: edbaa4a25307c203d7d4e5fafa8605f5fffe05eecd078432d9db5e0e065a3105
4
+ data.tar.gz: 71ccf0533e961a9344cdfb321dad6f53391a65b46bb7a6a3ca88d2403842fd2f
5
5
  SHA512:
6
- metadata.gz: 65f96a4b01af3c5a773fb6545d893ec072b5eaea006a7456878f651fdac459bd27ea9172dca776b5194011e513b6a10ed623c3c73705f1206825f88dc4909f76
7
- data.tar.gz: 60d845e48ac820e6791a7dafa4d5d549fb652b52c7e60bdcdca22cf6c62862717f04bef0043b9e3bbad6fddd9167eab58e93c5654ca1c5858c452960f07413a5
6
+ metadata.gz: '09c608d897769b244a674eaf52623fd2fb62a9ff12677bfc2c10ea9685e5985a8e4a45f9f0751d257e3d162fee522ab1d2c0677aec230e7178d9ec9b1a50002b'
7
+ data.tar.gz: f5a2f1dd5a74109a4bc1d0bcfa0e5b7fff6a2abe1538cb33c9db90c99ebfe84814af80a51f4e5426cda933934de4d517c78d699260120c25036cef32794dece8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.0.4...vite_ruby@1.0.5) (2021-03-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fix installation of JS packages, prevent silent failures (closes [#22](https://github.com/ElMassimo/vite_ruby/issues/22)) ([#23](https://github.com/ElMassimo/vite_ruby/issues/23)) ([d972e6f](https://github.com/ElMassimo/vite_ruby/commit/d972e6f3968988460753e7a831c8e9199bbd6891))
7
+
8
+
9
+
1
10
  ## [1.0.4](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.0.3...vite_ruby@1.0.4) (2021-02-25)
2
11
 
3
12
 
@@ -84,7 +84,9 @@ private
84
84
  logger.info(stdout) unless config.hide_build_console_output
85
85
  else
86
86
  non_empty_streams = [stdout, stderr].delete_if(&:empty?)
87
- logger.error "Build with Vite failed:\n#{ non_empty_streams.join("\n\n") }"
87
+ errors = non_empty_streams.join("\n\n")
88
+ errors += "\n❌ Check that vite and vite-plugin-ruby are in devDependencies and have been installed. " if errors.include?('ERR! canceled')
89
+ logger.error "Build with Vite failed:\n#{ errors }"
88
90
  end
89
91
  end
90
92
 
@@ -5,7 +5,7 @@ class ViteRuby::CLI::Build < Dry::CLI::Command
5
5
  DEFAULT_ENV = CURRENT_ENV || 'production'
6
6
 
7
7
  def self.shared_options
8
- option(:mode, default: self::DEFAULT_ENV, values: %w[development production], aliases: ['m'], desc: 'The build mode for Vite.')
8
+ option(:mode, default: self::DEFAULT_ENV, values: %w[development production], aliases: ['m'], desc: 'The build mode for Vite')
9
9
  end
10
10
 
11
11
  desc 'Bundle all entrypoints using Vite.'
@@ -75,7 +75,7 @@ private
75
75
  write(package_json, '{}') unless package_json.exist?
76
76
  Dir.chdir(root) do
77
77
  deps = "vite@#{ ViteRuby::DEFAULT_VITE_VERSION } vite-plugin-ruby@#{ ViteRuby::DEFAULT_PLUGIN_VERSION }"
78
- stdout, stderr, status = Open3.capture3({ 'CI' => 'true' }, "npx @antfu/ni -D #{ deps }")
78
+ stdout, stderr, status = Open3.capture3({ 'CI' => 'true' }, "npx --package @antfu/ni -- ni -D #{ deps }")
79
79
  stdout, stderr, = Open3.capture3({}, "yarn add -D #{ deps }") unless status.success?
80
80
  say(stdout, "\n", stderr)
81
81
  end
@@ -69,6 +69,7 @@ class ViteRuby::Commands
69
69
  def verify_install
70
70
  unless File.exist?(config.root.join('bin/vite'))
71
71
  warn <<~WARN
72
+
72
73
  vite binstub not found.
73
74
  Have you run `bundle binstub vite`?
74
75
  Make sure the bin directory and bin/vite are not included in .gitignore
@@ -78,6 +79,7 @@ class ViteRuby::Commands
78
79
  config_path = config.root.join(config.config_path)
79
80
  unless config_path.exist?
80
81
  warn <<~WARN
82
+
81
83
  Configuration #{ config_path } file for vite-plugin-ruby not found.
82
84
  Make sure `bundle exec vite install` has run successfully before running dependent tasks.
83
85
  WARN
@@ -88,7 +90,7 @@ class ViteRuby::Commands
88
90
  # Internal: Prints information about ViteRuby's environment.
89
91
  def print_info
90
92
  Dir.chdir(config.root) do
91
- $stdout.puts "Is bin/vite present?: #{ File.exist? 'bin/vite' }"
93
+ $stdout.puts "bin/vite present?: #{ File.exist? 'bin/vite' }"
92
94
 
93
95
  $stdout.puts "vite_ruby: #{ ViteRuby::VERSION }"
94
96
  ViteRuby.framework_libraries.each do |framework, library|
@@ -98,11 +100,14 @@ class ViteRuby::Commands
98
100
 
99
101
  $stdout.puts "node: #{ `node --version` }"
100
102
  $stdout.puts "npm: #{ `npm --version` }"
101
- $stdout.puts "yarn: #{ `yarn --version` }"
103
+ $stdout.puts "yarn: #{ `yarn --version` rescue nil }"
104
+ $stdout.puts "pnpm: #{ `pnpm --version` rescue nil }"
102
105
  $stdout.puts "ruby: #{ `ruby --version` }"
103
106
 
104
107
  $stdout.puts "\n"
105
- $stdout.puts "vite-plugin-ruby: \n#{ `npm list vite-plugin-ruby version` }"
108
+ packages = `npm ls vite vite-plugin-ruby`
109
+ packages_msg = packages.include?('vite@') ? "installed packages:\n#{ packages }" : '❌ Check that vite and vite-plugin-ruby have been added as development dependencies and installed.'
110
+ $stdout.puts packages_msg
106
111
  end
107
112
  end
108
113
 
@@ -52,6 +52,6 @@ private
52
52
  # Internal: Resolves to an executable for Vite.
53
53
  def vite_executable(cmd)
54
54
  npx = cmd.include?('node') ? `which npx`.chomp("\n") : 'npx' rescue 'npx'
55
- [npx, 'vite']
55
+ [npx, '--no-install', '--', 'vite']
56
56
  end
57
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  end
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: 1.0.4
4
+ version: 1.0.5
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: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -128,8 +128,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
128
128
  licenses:
129
129
  - MIT
130
130
  metadata:
131
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.0.4/vite_ruby
132
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.0.4/vite_ruby/CHANGELOG.md
131
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.0.5/vite_ruby
132
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.0.5/vite_ruby/CHANGELOG.md
133
133
  post_install_message:
134
134
  rdoc_options: []
135
135
  require_paths: