vite_ruby 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +22 -22
- data/lib/vite_ruby.rb +6 -4
- data/lib/vite_ruby/builder.rb +3 -1
- data/lib/vite_ruby/cli/build.rb +1 -1
- data/lib/vite_ruby/cli/install.rb +3 -3
- data/lib/vite_ruby/commands.rb +8 -3
- data/lib/vite_ruby/dev_server_proxy.rb +1 -0
- data/lib/vite_ruby/runner.rb +1 -1
- data/lib/vite_ruby/version.rb +1 -1
- metadata +5 -6
- data/CONTRIBUTING.md +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edbaa4a25307c203d7d4e5fafa8605f5fffe05eecd078432d9db5e0e065a3105
|
4
|
+
data.tar.gz: 71ccf0533e961a9344cdfb321dad6f53391a65b46bb7a6a3ca88d2403842fd2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c608d897769b244a674eaf52623fd2fb62a9ff12677bfc2c10ea9685e5985a8e4a45f9f0751d257e3d162fee522ab1d2c0677aec230e7178d9ec9b1a50002b'
|
7
|
+
data.tar.gz: f5a2f1dd5a74109a4bc1d0bcfa0e5b7fff6a2abe1538cb33c9db90c99ebfe84814af80a51f4e5426cda933934de4d517c78d699260120c25036cef32794dece8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,38 @@
|
|
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
|
+
|
10
|
+
## [1.0.4](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.0.3...vite_ruby@1.0.4) (2021-02-25)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* Create Vite.js integration with Padrino ([#17](https://github.com/ElMassimo/vite_ruby/issues/17)) ([9e9a0a6](https://github.com/ElMassimo/vite_ruby/commit/9e9a0a67abceed0a784d3c2e0554c717d7f5d1d6))
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## [1.0.3](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.0.2...vite_ruby@1.0.3) (2021-02-25)
|
20
|
+
|
21
|
+
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* Infer package manager correctly ([09d3036](https://github.com/ElMassimo/vite_ruby/commit/09d303627d6012ead50acd6f814a32521a76927f))
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## Vite Ruby 1.0.2 (2020-02-10)
|
29
|
+
|
30
|
+
- Fix auto-compilation when the dev server is not available.
|
31
|
+
|
32
|
+
## Vite Ruby 1.0.1 (2020-02-10)
|
33
|
+
|
34
|
+
- Fix installation script in Ruby 2.5
|
35
|
+
|
1
36
|
## Vite Ruby 1.0.0 (2020-02-09)
|
2
37
|
|
3
38
|
- Initial release, extracted core functionality from `vite_rails`.
|
data/README.md
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
<h1 align="center">
|
2
|
-
<a href="https://vite-
|
3
|
-
<img src="https://raw.githubusercontent.com/ElMassimo/
|
2
|
+
<a href="https://vite-ruby.netlify.app/">
|
3
|
+
<img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/docs/public/logo.svg" width="120px"/>
|
4
4
|
</a>
|
5
5
|
|
6
6
|
<br>
|
7
7
|
|
8
|
-
<a href="https://vite-
|
8
|
+
<a href="https://vite-ruby.netlify.app/">
|
9
9
|
Vite Ruby
|
10
10
|
</a>
|
11
11
|
|
12
12
|
<br>
|
13
13
|
|
14
14
|
<p align="center">
|
15
|
-
<a href="https://github.com/ElMassimo/
|
16
|
-
<img alt="Build Status" src="https://github.com/ElMassimo/
|
15
|
+
<a href="https://github.com/ElMassimo/vite_ruby/actions">
|
16
|
+
<img alt="Build Status" src="https://github.com/ElMassimo/vite_ruby/workflows/build/badge.svg"/>
|
17
17
|
</a>
|
18
|
-
<a href="https://codeclimate.com/github/ElMassimo/
|
19
|
-
<img alt="Maintainability" src="https://codeclimate.com/github/ElMassimo/
|
18
|
+
<a href="https://codeclimate.com/github/ElMassimo/vite_ruby">
|
19
|
+
<img alt="Maintainability" src="https://codeclimate.com/github/ElMassimo/vite_ruby/badges/gpa.svg"/>
|
20
20
|
</a>
|
21
|
-
<a href="https://codeclimate.com/github/ElMassimo/
|
22
|
-
<img alt="Test Coverage" src="https://codeclimate.com/github/ElMassimo/
|
21
|
+
<a href="https://codeclimate.com/github/ElMassimo/vite_ruby">
|
22
|
+
<img alt="Test Coverage" src="https://codeclimate.com/github/ElMassimo/vite_ruby/badges/coverage.svg"/>
|
23
23
|
</a>
|
24
24
|
<a href="https://rubygems.org/gems/vite_ruby">
|
25
25
|
<img alt="Gem Version" src="https://img.shields.io/gem/v/vite_ruby.svg?colorB=e9573f"/>
|
26
26
|
</a>
|
27
|
-
<a href="https://github.com/ElMassimo/
|
27
|
+
<a href="https://github.com/ElMassimo/vite_ruby/blob/master/LICENSE.txt">
|
28
28
|
<img alt="License" src="https://img.shields.io/badge/license-MIT-428F7E.svg"/>
|
29
29
|
</a>
|
30
30
|
</p>
|
31
31
|
</h1>
|
32
32
|
|
33
|
-
[website]: https://vite-
|
34
|
-
[configuration reference]: https://vite-
|
35
|
-
[features]: https://vite-
|
36
|
-
[guides]: https://vite-
|
37
|
-
[config]: https://vite-
|
38
|
-
[vite_rails]: https://github.com/ElMassimo/
|
33
|
+
[website]: https://vite-ruby.netlify.app/
|
34
|
+
[configuration reference]: https://vite-ruby.netlify.app/config/
|
35
|
+
[features]: https://vite-ruby.netlify.app/guide/introduction.html
|
36
|
+
[guides]: https://vite-ruby.netlify.app/guide/
|
37
|
+
[config]: https://vite-ruby.netlify.app/config/
|
38
|
+
[vite_rails]: https://github.com/ElMassimo/vite_ruby
|
39
39
|
[webpacker]: https://github.com/rails/webpacker
|
40
40
|
[vite]: http://vitejs.dev/
|
41
|
-
[config file]: https://github.com/ElMassimo/
|
41
|
+
[config file]: https://github.com/ElMassimo/vite_ruby/blob/main/vite-plugin-ruby/default.vite.json
|
42
42
|
[example app]: https://github.com/ElMassimo/pingcrm-vite
|
43
43
|
[heroku]: https://pingcrm-vite.herokuapp.com/
|
44
|
-
[Issues]: https://github.com/ElMassimo/
|
45
|
-
[Discussions]: https://github.com/ElMassimo/
|
46
|
-
[vite_rails]: https://github.com/ElMassimo/
|
47
|
-
[vite_ruby]: https://github.com/ElMassimo/
|
48
|
-
[vite_hanami]: https://github.com/ElMassimo/
|
44
|
+
[Issues]: https://github.com/ElMassimo/vite_ruby/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
|
45
|
+
[Discussions]: https://github.com/ElMassimo/vite_ruby/discussions
|
46
|
+
[vite_rails]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_rails
|
47
|
+
[vite_ruby]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_ruby
|
48
|
+
[vite_hanami]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_hanami
|
49
49
|
|
50
50
|
|
51
51
|
[Vite] is to frontend tooling as Ruby to programming, pure joy! 😍
|
data/lib/vite_ruby.rb
CHANGED
@@ -17,18 +17,17 @@ class ViteRuby
|
|
17
17
|
ENV_PREFIX = 'VITE_RUBY'
|
18
18
|
|
19
19
|
# Internal: Versions used by default when running `vite install`.
|
20
|
-
DEFAULT_VITE_VERSION = '^2.0.
|
21
|
-
DEFAULT_PLUGIN_VERSION = '^1.0.
|
20
|
+
DEFAULT_VITE_VERSION = '^2.0.3'
|
21
|
+
DEFAULT_PLUGIN_VERSION = '^1.0.13'
|
22
22
|
|
23
23
|
# Internal: Ruby Frameworks that have a companion library for Vite Ruby.
|
24
|
-
SUPPORTED_FRAMEWORKS = %w[rails hanami roda].freeze
|
24
|
+
SUPPORTED_FRAMEWORKS = %w[rails hanami roda padrino sinatra].freeze
|
25
25
|
|
26
26
|
class << self
|
27
27
|
extend Forwardable
|
28
28
|
|
29
29
|
def_delegators :instance, :config, :commands, :run_proxy?
|
30
30
|
def_delegators :config, :mode
|
31
|
-
def_delegators :commands, :build
|
32
31
|
def_delegators 'ViteRuby::Runner.new', :run
|
33
32
|
|
34
33
|
def instance
|
@@ -76,6 +75,9 @@ class ViteRuby
|
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
78
|
+
extend Forwardable
|
79
|
+
def_delegators :builder, :build
|
80
|
+
|
79
81
|
attr_writer :logger
|
80
82
|
|
81
83
|
def logger
|
data/lib/vite_ruby/builder.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/vite_ruby/cli/build.rb
CHANGED
@@ -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.'
|
@@ -51,8 +51,8 @@ private
|
|
51
51
|
def_delegators 'ViteRuby', :config
|
52
52
|
|
53
53
|
%i[append cp inject_line_after inject_line_after_last inject_line_before write].each do |util|
|
54
|
-
define_method(util) { |*args
|
55
|
-
Dry::CLI::Utils::Files.send(util, *args
|
54
|
+
define_method(util) { |*args|
|
55
|
+
Dry::CLI::Utils::Files.send(util, *args) rescue nil
|
56
56
|
}
|
57
57
|
end
|
58
58
|
|
@@ -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 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
|
data/lib/vite_ruby/commands.rb
CHANGED
@@ -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 "
|
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
|
-
|
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
|
|
@@ -39,6 +39,7 @@ private
|
|
39
39
|
|
40
40
|
def forward_to_vite_dev_server(env)
|
41
41
|
rewrite_uri_for_vite(env)
|
42
|
+
env['QUERY_STRING'] ||= ''
|
42
43
|
env['HTTP_HOST'] = env['HTTP_X_FORWARDED_HOST'] = config.host
|
43
44
|
env['HTTP_X_FORWARDED_SERVER'] = config.host_with_port
|
44
45
|
env['HTTP_PORT'] = env['HTTP_X_FORWARDED_PORT'] = config.port.to_s
|
data/lib/vite_ruby/runner.rb
CHANGED
data/lib/vite_ruby/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -103,7 +103,6 @@ extensions: []
|
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
105
|
- CHANGELOG.md
|
106
|
-
- CONTRIBUTING.md
|
107
106
|
- LICENSE.txt
|
108
107
|
- README.md
|
109
108
|
- default.vite.json
|
@@ -125,12 +124,12 @@ files:
|
|
125
124
|
- templates/config/vite.config.ts
|
126
125
|
- templates/config/vite.json
|
127
126
|
- templates/entrypoints/application.js
|
128
|
-
homepage: https://github.com/ElMassimo/
|
127
|
+
homepage: https://github.com/ElMassimo/vite_ruby
|
129
128
|
licenses:
|
130
129
|
- MIT
|
131
130
|
metadata:
|
132
|
-
source_code_uri: https://github.com/ElMassimo/
|
133
|
-
changelog_uri: https://github.com/ElMassimo/
|
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
|
134
133
|
post_install_message:
|
135
134
|
rdoc_options: []
|
136
135
|
require_paths:
|
data/CONTRIBUTING.md
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
## Setting Up a Development Environment
|
2
|
-
|
3
|
-
1. Install [Yarn](https://yarnpkg.com/)
|
4
|
-
|
5
|
-
2. Run the following commands to set up the development environment.
|
6
|
-
|
7
|
-
```
|
8
|
-
bundle install
|
9
|
-
```
|
10
|
-
|
11
|
-
## Making sure your changes pass all tests
|
12
|
-
There are a number of automated checks which run on GitHub Actions when a pull request is created.
|
13
|
-
You can run those checks on your own locally to make sure that your changes would not break the CI build.
|
14
|
-
|
15
|
-
### 1. Check the code for JavaScript style violations
|
16
|
-
```
|
17
|
-
yarn lint
|
18
|
-
```
|
19
|
-
|
20
|
-
### 2. Check the code for Ruby style violations
|
21
|
-
```
|
22
|
-
bundle exec rubocop
|
23
|
-
```
|
24
|
-
|
25
|
-
### 3. Run the JavaScript test suite
|
26
|
-
```
|
27
|
-
yarn test
|
28
|
-
```
|
29
|
-
|
30
|
-
### 4. Run the Ruby test suite
|
31
|
-
```
|
32
|
-
bundle exec rake test
|
33
|
-
```
|