vite_rails 2.0.1 → 2.0.7
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 +4 -4
- data/CHANGELOG.md +39 -0
- data/README.md +7 -3
- data/lib/vite_rails/installation.rb +15 -1
- data/lib/vite_rails/tag_helpers.rb +2 -2
- data/lib/vite_rails/version.rb +1 -1
- data/templates/entrypoints/application.js +8 -0
- metadata +19 -56
- 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: 20bd6ede6dd8f9d7dc2e7962b342220423c3a4cfef19bd783e130242ce278a28
|
4
|
+
data.tar.gz: 3e10c7d8344cce3efbc176de6f194d8dd6a9def29b3cd449c0ee9b31daa1babe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd548a60a845cf787d82f6f5a36c7fd97da0d195a09d64167273daea564abeacedd4448befee0bbbbb1029a5a24228a4a92605ca8e926ee57d9824a1b3e9c69f
|
7
|
+
data.tar.gz: 3ccd0a17a7c8993439b4879cd6ca499cf1a7fbfec841a227facb1d882a965e7e22346766955209ba39415a35c4ef96a67c7bfc01b3c747e4c2d3836be8cd21e3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,42 @@
|
|
1
|
+
## [2.0.7](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.6...vite_rails@2.0.7) (2021-03-19)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Typo typecript -> typescript in tag helpers ([#38](https://github.com/ElMassimo/vite_ruby/issues/38)) ([3d375df](https://github.com/ElMassimo/vite_ruby/commit/3d375df8553c8542966ac912a38fe70b7d59ba74))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
## [2.0.6](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.5...vite_rails@2.0.6) (2021-03-18)
|
11
|
+
|
12
|
+
* Add more help text in the example entrypoints ([87d6f14](https://github.com/ElMassimo/vite_ruby/commit/87d6f14a59bba2667089bb952960dce059f36592))
|
13
|
+
|
14
|
+
## [2.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.4...vite_rails@2.0.5) (2021-03-18)
|
15
|
+
|
16
|
+
|
17
|
+
### Bug Fixes
|
18
|
+
|
19
|
+
* Using a .jsx extension in a tag helper in development ([a56491b](https://github.com/ElMassimo/vite_ruby/commit/a56491b96720ae537b6b6305aa7efa70cf19e4ee))
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## [2.0.4](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.3...vite_rails@2.0.4) (2021-03-09)
|
24
|
+
|
25
|
+
|
26
|
+
### Features
|
27
|
+
|
28
|
+
* Detect installations of the latest version of Webpacker (app/packs) ([e9a3bc0](https://github.com/ElMassimo/vite_ruby/commit/e9a3bc02475dbadac77e58b3980a4af8df5aaa02))
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
## [2.0.3](https://github.com/ElMassimo/vite_ruby/compare/vite_rails@2.0.2...vite_rails@2.0.3) (2021-03-07)
|
33
|
+
|
34
|
+
- Add a bounded requirement to `vite_ruby` dependency.
|
35
|
+
|
36
|
+
## Vite Rails 2.0.2 (2020-02-11)
|
37
|
+
|
38
|
+
- Automatically infer `app/javascript` as the `sourceCodeDir` if it exists.
|
39
|
+
|
1
40
|
## Vite Rails 2.0.1 (2020-02-11)
|
2
41
|
|
3
42
|
- Add the CSP rules commented out when installing, in case the user hasn't uncommented them yet.
|
data/README.md
CHANGED
@@ -59,8 +59,11 @@ dev server is extremely __fast to start__, and your changes will be __updated in
|
|
59
59
|
In production, Vite [bundles your code][bundling]
|
60
60
|
with tree-shaking, lazy-loading, and common chunk splitting out of the box, to achieve optimal loading performance.
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
It also provides great defaults, and is easier to configure than similar tools like webpack.
|
63
|
+
|
64
|
+
Check [this video comparison with webpack](https://github.com/ElMassimo/jumpstart-vite)
|
65
|
+
which demonstrates the difference in boot time, or [this one](https://github.com/ElMassimo/pingcrm-vite/pull/1)
|
66
|
+
with the difference in speed during development.
|
64
67
|
|
65
68
|
## Features ⚡️
|
66
69
|
|
@@ -79,7 +82,7 @@ Visit the [documentation website][website] to check out the [guides] and searcha
|
|
79
82
|
Add this line to your application's Gemfile:
|
80
83
|
|
81
84
|
```ruby
|
82
|
-
gem 'vite_rails'
|
85
|
+
gem 'vite_rails' # vite_rails_legacy if using Rails 4
|
83
86
|
```
|
84
87
|
|
85
88
|
Then, run:
|
@@ -107,6 +110,7 @@ Please use [Issues] to report bugs you find, and [Discussions] to make feature r
|
|
107
110
|
|
108
111
|
Don't hesitate to _⭐️ star the project_ if you find it useful!
|
109
112
|
|
113
|
+
Using it in production? Always love to hear about it! 😃
|
110
114
|
|
111
115
|
## Special Thanks 🙏
|
112
116
|
|
@@ -10,6 +10,9 @@ module ViteRails::Installation
|
|
10
10
|
# Override: Setup a typical apps/web Hanami app to use Vite.
|
11
11
|
def setup_app_files
|
12
12
|
cp RAILS_TEMPLATES.join('config/rails-vite.json'), config.config_path
|
13
|
+
if dir = %w[app/javascript app/packs].find { |path| root.join(path).exist? }
|
14
|
+
Dry::CLI::Utils::Files.replace_first_line config.config_path, 'app/frontend', %( "sourceCodeDir": "#{ dir }",)
|
15
|
+
end
|
13
16
|
setup_content_security_policy root.join('config/initializers/content_security_policy.rb')
|
14
17
|
end
|
15
18
|
|
@@ -33,12 +36,23 @@ module ViteRails::Installation
|
|
33
36
|
|
34
37
|
# Override: Create a sample JS file and attempt to inject it in an HTML template.
|
35
38
|
def install_sample_files
|
36
|
-
|
39
|
+
unless config.resolved_entrypoints_dir.join('application.js').exist?
|
40
|
+
cp RAILS_TEMPLATES.join('entrypoints/application.js'), config.resolved_entrypoints_dir.join('application.js')
|
41
|
+
end
|
37
42
|
|
38
43
|
if (layout_file = root.join('app/views/layouts/application.html.erb')).exist?
|
39
44
|
inject_line_before layout_file, '</head>', <<-HTML
|
40
45
|
<%= vite_client_tag %>
|
41
46
|
<%= vite_javascript_tag 'application' %>
|
47
|
+
<!--
|
48
|
+
If using a TypeScript entrypoint file:
|
49
|
+
vite_typescript_tag 'application'
|
50
|
+
|
51
|
+
If using a .jsx or .tsx entrypoint, add the extension:
|
52
|
+
vite_javascript_tag 'application.jsx'
|
53
|
+
|
54
|
+
Visit the guide for more information: https://vite-ruby.netlify.app/guide/rails
|
55
|
+
-->
|
42
56
|
HTML
|
43
57
|
end
|
44
58
|
end
|
@@ -26,7 +26,7 @@ module ViteRails::TagHelpers
|
|
26
26
|
crossorigin: 'anonymous',
|
27
27
|
**options)
|
28
28
|
entries = vite_manifest.resolve_entries(*names, type: asset_type)
|
29
|
-
tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, **options)
|
29
|
+
tags = javascript_include_tag(*entries.fetch(:scripts), crossorigin: crossorigin, type: type, extname: false, **options)
|
30
30
|
tags << vite_preload_tag(*entries.fetch(:imports), crossorigin: crossorigin) unless skip_preload_tags
|
31
31
|
tags << stylesheet_link_tag(*entries.fetch(:stylesheets)) unless skip_style_tags
|
32
32
|
tags
|
@@ -34,7 +34,7 @@ module ViteRails::TagHelpers
|
|
34
34
|
|
35
35
|
# Public: Renders a <script> tag for the specified Vite entrypoints.
|
36
36
|
def vite_typescript_tag(*names, **options)
|
37
|
-
vite_javascript_tag(*names, asset_type: :typescript,
|
37
|
+
vite_javascript_tag(*names, asset_type: :typescript, **options)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Public: Renders a <link> tag for the specified Vite entrypoints.
|
data/lib/vite_rails/version.rb
CHANGED
@@ -5,6 +5,14 @@
|
|
5
5
|
// <%= vite_javascript_tag 'application' %>
|
6
6
|
console.log('Vite ⚡️ Rails')
|
7
7
|
|
8
|
+
// If using a TypeScript entrypoint file:
|
9
|
+
// <%= vite_typescript_tag 'application.jsx' %>
|
10
|
+
//
|
11
|
+
// If you want to use .jsx or .tsx, add the extension:
|
12
|
+
// <%= vite_javascript_tag 'application.jsx' %>
|
13
|
+
|
14
|
+
console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
|
15
|
+
|
8
16
|
// Example: Load Rails libraries in Vite.
|
9
17
|
//
|
10
18
|
// import '@rails/ujs'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vite_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,76 +27,37 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: vite_ruby
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
39
|
+
version: '1.0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.3.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
44
|
+
- - "~>"
|
53
45
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
46
|
+
version: '1.0'
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
48
|
+
name: spring
|
57
49
|
requirement: !ruby/object:Gem::Requirement
|
58
50
|
requirements:
|
59
|
-
- - "
|
51
|
+
- - "~>"
|
60
52
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
53
|
+
version: '2.1'
|
62
54
|
type: :development
|
63
55
|
prerelease: false
|
64
56
|
version_requirements: !ruby/object:Gem::Requirement
|
65
57
|
requirements:
|
66
|
-
- - "
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-performance
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
58
|
+
- - "~>"
|
95
59
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
60
|
+
version: '2.1'
|
97
61
|
description:
|
98
62
|
email:
|
99
63
|
- maximomussini@gmail.com
|
@@ -102,7 +66,6 @@ extensions: []
|
|
102
66
|
extra_rdoc_files: []
|
103
67
|
files:
|
104
68
|
- CHANGELOG.md
|
105
|
-
- CONTRIBUTING.md
|
106
69
|
- LICENSE.txt
|
107
70
|
- README.md
|
108
71
|
- lib/tasks/vite.rake
|
@@ -118,8 +81,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
118
81
|
licenses:
|
119
82
|
- MIT
|
120
83
|
metadata:
|
121
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.
|
122
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.
|
84
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails@2.0.7/vite_rails
|
85
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails@2.0.7/vite_rails/CHANGELOG.md
|
123
86
|
post_install_message:
|
124
87
|
rdoc_options: []
|
125
88
|
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
|
-
```
|