vite_rb 0.0.1.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +3 -0
- data/.dockerignore +22 -0
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/build.yml +17 -0
- data/.gitignore +71 -0
- data/.ruby-version +1 -0
- data/.solargraph.yml +16 -0
- data/.standard.yml +11 -0
- data/CHANGELOG.md +65 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +258 -0
- data/Rakefile +39 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/examples/rails-without-webpack/.gitignore +34 -0
- data/examples/rails-without-webpack/.ruby-version +1 -0
- data/examples/rails-without-webpack/Gemfile +33 -0
- data/examples/rails-without-webpack/README.md +24 -0
- data/examples/rails-without-webpack/Rakefile +6 -0
- data/examples/rails-without-webpack/app/assets/config/manifest.js +2 -0
- data/examples/rails-without-webpack/app/assets/images/.keep +0 -0
- data/examples/rails-without-webpack/app/assets/stylesheets/application.css +15 -0
- data/examples/rails-without-webpack/app/assets/stylesheets/static_pages.scss +3 -0
- data/examples/rails-without-webpack/app/channels/application_cable/channel.rb +4 -0
- data/examples/rails-without-webpack/app/channels/application_cable/connection.rb +4 -0
- data/examples/rails-without-webpack/app/channels/chat_channel.rb +12 -0
- data/examples/rails-without-webpack/app/controllers/application_controller.rb +2 -0
- data/examples/rails-without-webpack/app/controllers/concerns/.keep +0 -0
- data/examples/rails-without-webpack/app/controllers/static_pages_controller.rb +4 -0
- data/examples/rails-without-webpack/app/helpers/application_helper.rb +2 -0
- data/examples/rails-without-webpack/app/helpers/static_pages_helper.rb +2 -0
- data/examples/rails-without-webpack/app/jobs/application_job.rb +7 -0
- data/examples/rails-without-webpack/app/mailers/application_mailer.rb +4 -0
- data/examples/rails-without-webpack/app/models/application_record.rb +3 -0
- data/examples/rails-without-webpack/app/models/concerns/.keep +0 -0
- data/examples/rails-without-webpack/app/snowpacker/assets/fake-asset.png +0 -0
- data/examples/rails-without-webpack/app/snowpacker/channels/consumer.js +5 -0
- data/examples/rails-without-webpack/app/snowpacker/channels/index.js +2 -0
- data/examples/rails-without-webpack/app/snowpacker/entrypoints/application.js +10 -0
- data/examples/rails-without-webpack/app/snowpacker/javascript/index.js +1 -0
- data/examples/rails-without-webpack/app/snowpacker/stylesheets/index.css +3 -0
- data/examples/rails-without-webpack/app/views/layouts/application.html.erb +15 -0
- data/examples/rails-without-webpack/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails-without-webpack/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails-without-webpack/app/views/static_pages/index.html.erb +2 -0
- data/examples/rails-without-webpack/bin/bundle +114 -0
- data/examples/rails-without-webpack/bin/rails +9 -0
- data/examples/rails-without-webpack/bin/rake +9 -0
- data/examples/rails-without-webpack/bin/setup +36 -0
- data/examples/rails-without-webpack/bin/spring +17 -0
- data/examples/rails-without-webpack/bin/yarn +9 -0
- data/examples/rails-without-webpack/config.ru +5 -0
- data/examples/rails-without-webpack/config/application.rb +19 -0
- data/examples/rails-without-webpack/config/boot.rb +4 -0
- data/examples/rails-without-webpack/config/cable.yml +10 -0
- data/examples/rails-without-webpack/config/credentials.yml.enc +1 -0
- data/examples/rails-without-webpack/config/database.yml +25 -0
- data/examples/rails-without-webpack/config/environment.rb +5 -0
- data/examples/rails-without-webpack/config/environments/development.rb +62 -0
- data/examples/rails-without-webpack/config/environments/production.rb +112 -0
- data/examples/rails-without-webpack/config/environments/test.rb +49 -0
- data/examples/rails-without-webpack/config/initializers/application_controller_renderer.rb +8 -0
- data/examples/rails-without-webpack/config/initializers/assets.rb +14 -0
- data/examples/rails-without-webpack/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails-without-webpack/config/initializers/content_security_policy.rb +31 -0
- data/examples/rails-without-webpack/config/initializers/cookies_serializer.rb +5 -0
- data/examples/rails-without-webpack/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails-without-webpack/config/initializers/inflections.rb +16 -0
- data/examples/rails-without-webpack/config/initializers/mime_types.rb +4 -0
- data/examples/rails-without-webpack/config/initializers/snowpacker.rb +41 -0
- data/examples/rails-without-webpack/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails-without-webpack/config/locales/en.yml +33 -0
- data/examples/rails-without-webpack/config/puma.rb +38 -0
- data/examples/rails-without-webpack/config/routes.rb +5 -0
- data/examples/rails-without-webpack/config/snowpacker/.browserslistrc +1 -0
- data/examples/rails-without-webpack/config/snowpacker/babel.config.js +76 -0
- data/examples/rails-without-webpack/config/snowpacker/postcss.config.js +12 -0
- data/examples/rails-without-webpack/config/snowpacker/snowpack.config.js +61 -0
- data/examples/rails-without-webpack/config/spring.rb +6 -0
- data/examples/rails-without-webpack/config/storage.yml +34 -0
- data/examples/rails-without-webpack/db/seeds.rb +7 -0
- data/examples/rails-without-webpack/lib/assets/.keep +0 -0
- data/examples/rails-without-webpack/lib/tasks/.keep +0 -0
- data/examples/rails-without-webpack/package.json +20 -0
- data/examples/rails-without-webpack/storage/.keep +0 -0
- data/examples/rails-without-webpack/test/application_system_test_case.rb +5 -0
- data/examples/rails-without-webpack/test/channels/application_cable/connection_test.rb +11 -0
- data/examples/rails-without-webpack/test/channels/chat_channel_test.rb +8 -0
- data/examples/rails-without-webpack/test/controllers/.keep +0 -0
- data/examples/rails-without-webpack/test/controllers/static_pages_controller_test.rb +8 -0
- data/examples/rails-without-webpack/test/fixtures/.keep +0 -0
- data/examples/rails-without-webpack/test/fixtures/files/.keep +0 -0
- data/examples/rails-without-webpack/test/helpers/.keep +0 -0
- data/examples/rails-without-webpack/test/integration/.keep +0 -0
- data/examples/rails-without-webpack/test/mailers/.keep +0 -0
- data/examples/rails-without-webpack/test/models/.keep +0 -0
- data/examples/rails-without-webpack/test/system/.keep +0 -0
- data/examples/rails-without-webpack/test/test_helper.rb +13 -0
- data/examples/rails-without-webpack/vendor/.keep +0 -0
- data/examples/rails-without-webpack/yarn.lock +7545 -0
- data/lib/tasks/rails.rake +31 -0
- data/lib/tasks/ruby.rake +21 -0
- data/lib/vite_rb.rb +25 -0
- data/lib/vite_rb/configuration.rb +56 -0
- data/lib/vite_rb/engine.rb +5 -0
- data/lib/vite_rb/env.rb +29 -0
- data/lib/vite_rb/generator.rb +81 -0
- data/lib/vite_rb/helpers.rb +51 -0
- data/lib/vite_rb/manifest.rb +40 -0
- data/lib/vite_rb/proxy.rb +35 -0
- data/lib/vite_rb/runner.rb +46 -0
- data/lib/vite_rb/templates/postcss.config.js +12 -0
- data/lib/vite_rb/templates/vite.config.js +71 -0
- data/lib/vite_rb/templates/vite.rb.tt +54 -0
- data/lib/vite_rb/templates/vite/channels/consumer.js +5 -0
- data/lib/vite_rb/templates/vite/channels/index.js +2 -0
- data/lib/vite_rb/templates/vite/entrypoints/application.js +10 -0
- data/lib/vite_rb/templates/vite/stylesheets/index.css +3 -0
- data/lib/vite_rb/utils.rb +55 -0
- data/lib/vite_rb/version.rb +5 -0
- data/package.json +25 -0
- data/package/src/index.js +0 -0
- data/vite_rb.gemspec +46 -0
- data/yarn.lock +1215 -0
- metadata +337 -0
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "vite_rb"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "bundler/setup"
|
7
|
+
rescue LoadError
|
8
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
9
|
+
end
|
10
|
+
|
11
|
+
require "yard"
|
12
|
+
|
13
|
+
YARD::Rake::YardocTask.new do |t|
|
14
|
+
t.files = ["lib/**/*.rb", "README.md"] # optional
|
15
|
+
t.options = ["--title Vite #{::ViteRb::VERSION}", "--line-numbers", "--any", "--extra", "--opts"] # optional
|
16
|
+
t.stats_options = ["--list-undoc"] # optional
|
17
|
+
end
|
18
|
+
|
19
|
+
require "bundler/gem_tasks"
|
20
|
+
|
21
|
+
require "rake/testtask"
|
22
|
+
|
23
|
+
Rake::TestTask.new(:test) do |t|
|
24
|
+
t.libs << "test"
|
25
|
+
t.test_files = Dir["test/**/*_test.rb"].reject do |path|
|
26
|
+
path.include?("rails_test_app") || path.include?("ruby_test_app")
|
27
|
+
end
|
28
|
+
t.verbose = true
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::TestTask.new(:"test:unit") do |t|
|
32
|
+
t.libs << "test"
|
33
|
+
t.test_files = Dir["test/unit/**/*_test.rb"]
|
34
|
+
t.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
require "standard/rake"
|
38
|
+
|
39
|
+
task default: :test
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'vite_rb/rails'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
/db/*.sqlite3-*
|
14
|
+
|
15
|
+
# Ignore all logfiles and tempfiles.
|
16
|
+
/log/*
|
17
|
+
/tmp/*
|
18
|
+
!/log/.keep
|
19
|
+
!/tmp/.keep
|
20
|
+
|
21
|
+
# Ignore pidfiles, but keep the directory.
|
22
|
+
/tmp/pids/*
|
23
|
+
!/tmp/pids/
|
24
|
+
!/tmp/pids/.keep
|
25
|
+
|
26
|
+
# Ignore uploaded files in development.
|
27
|
+
/storage/*
|
28
|
+
!/storage/.keep
|
29
|
+
|
30
|
+
/public/assets
|
31
|
+
.byebug_history
|
32
|
+
|
33
|
+
# Ignore master key for decrypting credentials and more.
|
34
|
+
/config/master.key
|
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.6.3
|
@@ -0,0 +1,33 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
ruby "2.6.3"
|
5
|
+
|
6
|
+
gem "rails", "~> 6.0.3", ">= 6.0.3.2"
|
7
|
+
gem "sqlite3", "~> 1.4"
|
8
|
+
gem "puma", "~> 4.1"
|
9
|
+
gem "sass-rails", ">= 6"
|
10
|
+
# gem 'webpacker', '~> 4.0'
|
11
|
+
gem "turbolinks", "~> 5"
|
12
|
+
gem "jbuilder", "~> 2.7"
|
13
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
14
|
+
gem "vite_rb", path: "../../"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
|
18
|
+
end
|
19
|
+
|
20
|
+
group :development do
|
21
|
+
gem "web-console", ">= 3.3.0"
|
22
|
+
gem "listen", "~> 3.2"
|
23
|
+
gem "spring"
|
24
|
+
gem "spring-watcher-listen", "~> 2.0.0"
|
25
|
+
end
|
26
|
+
|
27
|
+
group :test do
|
28
|
+
gem "capybara", ">= 2.15"
|
29
|
+
gem "selenium-webdriver"
|
30
|
+
gem "webdrivers"
|
31
|
+
end
|
32
|
+
|
33
|
+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
6
|
+
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import "@rails/ujs" // Autostarts
|
2
|
+
import Turbolinks from "turbolinks"
|
3
|
+
import ActiveStorage from "@rails/activestorage"
|
4
|
+
import "../stylesheets/index.css"
|
5
|
+
import "../javascript"
|
6
|
+
|
7
|
+
Turbolinks.start()
|
8
|
+
ActiveStorage.start()
|
9
|
+
|
10
|
+
console.log("Hello from ViteRb")
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log("Hi from javascript")
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new {
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling {
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
}
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling {
|
95
|
+
require "bundler/version"
|
96
|
+
}
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
}
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|