inertia_rails-contrib 0.2.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/README.md +12 -133
- data/lib/inertia_rails_contrib/version.rb +1 -1
- metadata +5 -112
- data/lib/generators/inertia/controller/controller_generator.rb +0 -16
- data/lib/generators/inertia/controller/templates/controller.rb.tt +0 -10
- data/lib/generators/inertia/install/frameworks.yml +0 -73
- data/lib/generators/inertia/install/helpers.rb +0 -48
- data/lib/generators/inertia/install/install_generator.rb +0 -282
- data/lib/generators/inertia/install/templates/assets/inertia.svg +0 -1
- data/lib/generators/inertia/install/templates/assets/react.svg +0 -1
- data/lib/generators/inertia/install/templates/assets/svelte.svg +0 -1
- data/lib/generators/inertia/install/templates/assets/vite_ruby.svg +0 -1
- data/lib/generators/inertia/install/templates/assets/vue.svg +0 -1
- data/lib/generators/inertia/install/templates/controller.rb +0 -7
- data/lib/generators/inertia/install/templates/dev +0 -23
- data/lib/generators/inertia/install/templates/initializer.rb +0 -4
- data/lib/generators/inertia/install/templates/react/InertiaExample.jsx +0 -60
- data/lib/generators/inertia/install/templates/react/InertiaExample.module.css +0 -80
- data/lib/generators/inertia/install/templates/react/InertiaExample.tsx +0 -60
- data/lib/generators/inertia/install/templates/react/inertia.js +0 -34
- data/lib/generators/inertia/install/templates/react/inertia.ts +0 -36
- data/lib/generators/inertia/install/templates/react/tsconfig.app.json +0 -27
- data/lib/generators/inertia/install/templates/react/tsconfig.json +0 -11
- data/lib/generators/inertia/install/templates/react/tsconfig.node.json +0 -13
- data/lib/generators/inertia/install/templates/react/vite-env.d.ts +0 -1
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.svelte +0 -116
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +0 -116
- data/lib/generators/inertia/install/templates/svelte/inertia.js +0 -29
- data/lib/generators/inertia/install/templates/svelte/inertia.ts +0 -32
- data/lib/generators/inertia/install/templates/svelte/svelte.config.js +0 -7
- data/lib/generators/inertia/install/templates/svelte/tsconfig.json +0 -21
- data/lib/generators/inertia/install/templates/svelte/tsconfig.node.json +0 -12
- data/lib/generators/inertia/install/templates/svelte/vite-env.d.ts +0 -2
- data/lib/generators/inertia/install/templates/tailwind/application.css +0 -13
- data/lib/generators/inertia/install/templates/tailwind/postcss.config.js +0 -6
- data/lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt +0 -18
- data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +0 -117
- data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +0 -117
- data/lib/generators/inertia/install/templates/vue/inertia.js +0 -33
- data/lib/generators/inertia/install/templates/vue/inertia.ts +0 -33
- data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +0 -24
- data/lib/generators/inertia/install/templates/vue/tsconfig.json +0 -11
- data/lib/generators/inertia/install/templates/vue/tsconfig.node.json +0 -22
- data/lib/generators/inertia/install/templates/vue/vite-env.d.ts +0 -1
- data/lib/generators/inertia/scaffold/scaffold_generator.rb +0 -16
- data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +0 -56
- data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +0 -100
- data/lib/generators/inertia_templates/controller/controller_generator.rb +0 -12
- data/lib/generators/inertia_templates/controller/templates/react/view.jsx.tt +0 -8
- data/lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt +0 -2
- data/lib/generators/inertia_templates/controller/templates/vue/view.vue.tt +0 -4
- data/lib/generators/inertia_templates/scaffold/scaffold_generator.rb +0 -12
- data/lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt +0 -35
- data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +0 -111
- data/lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt +0 -26
- data/lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt +0 -27
- data/lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt +0 -26
- data/lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt +0 -39
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -37
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +0 -96
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt +0 -42
- data/lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt +0 -30
- data/lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt +0 -46
- data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt +0 -36
- data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +0 -94
- data/lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt +0 -31
- data/lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt +0 -29
- data/lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt +0 -26
- data/lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt +0 -44
- data/lib/generators/inertia_tw_templates/controller/controller_generator.rb +0 -12
- data/lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt +0 -8
- data/lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt +0 -2
- data/lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt +0 -4
- data/lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb +0 -12
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt +0 -42
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +0 -122
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt +0 -43
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt +0 -30
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt +0 -26
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt +0 -54
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -45
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +0 -120
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt +0 -49
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt +0 -33
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt +0 -58
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt +0 -44
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt +0 -127
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt +0 -43
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt +0 -32
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt +0 -26
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt +0 -56
- data/lib/inertia_rails_contrib/generators/controller_template_base.rb +0 -56
- data/lib/inertia_rails_contrib/generators/scaffold_template_base.rb +0 -35
- data/lib/inertia_rails_contrib/generators_helper.rb +0 -88
@@ -1,282 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
require "rails/generators"
|
3
|
-
require "rails/generators/base"
|
4
|
-
|
5
|
-
require_relative "helpers"
|
6
|
-
|
7
|
-
module Inertia
|
8
|
-
module Generators
|
9
|
-
class InstallGenerator < Rails::Generators::Base
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
FRAMEWORKS = YAML.load_file(File.expand_path("./frameworks.yml", __dir__))
|
13
|
-
|
14
|
-
source_root File.expand_path("./templates", __dir__)
|
15
|
-
|
16
|
-
class_option :framework, type: :string,
|
17
|
-
desc: "The framework you want to use with Inertia",
|
18
|
-
enum: FRAMEWORKS.keys,
|
19
|
-
default: nil
|
20
|
-
|
21
|
-
class_option :inertia_version, type: :string, default: "latest",
|
22
|
-
desc: "The version of Inertia.js to install"
|
23
|
-
|
24
|
-
class_option :typescript, type: :boolean, default: false,
|
25
|
-
desc: "Whether to use TypeScript"
|
26
|
-
|
27
|
-
class_option :package_manager, type: :string, default: nil, enum: %w[npm yarn bun pnpm],
|
28
|
-
desc: "The package manager you want to use to install Inertia's npm packages"
|
29
|
-
|
30
|
-
class_option :interactive, type: :boolean, default: true,
|
31
|
-
desc: "Whether to prompt for optional installations"
|
32
|
-
|
33
|
-
class_option :install_tailwind, type: :boolean, default: false,
|
34
|
-
desc: "Whether to install Tailwind CSS"
|
35
|
-
class_option :install_vite, type: :boolean, default: false,
|
36
|
-
desc: "Whether to install Vite Ruby"
|
37
|
-
class_option :example_page, type: :boolean, default: true,
|
38
|
-
desc: "Whether to add an example Inertia page"
|
39
|
-
|
40
|
-
class_option :verbose, type: :boolean, default: false,
|
41
|
-
desc: "Run the generator in verbose mode"
|
42
|
-
|
43
|
-
remove_class_option :skip_namespace, :skip_collision_check
|
44
|
-
|
45
|
-
def install
|
46
|
-
say "Installing Inertia's Rails adapter"
|
47
|
-
|
48
|
-
if inertia_resolved_version.version == "0"
|
49
|
-
say_error "Could not find the Inertia.js package version #{options[:inertia_version]}.", :red
|
50
|
-
exit(false)
|
51
|
-
end
|
52
|
-
|
53
|
-
install_vite unless ruby_vite_installed?
|
54
|
-
|
55
|
-
install_typescript if typescript?
|
56
|
-
|
57
|
-
install_tailwind if install_tailwind?
|
58
|
-
|
59
|
-
install_inertia
|
60
|
-
|
61
|
-
install_example_page if options[:example_page]
|
62
|
-
|
63
|
-
say "Copying bin/dev"
|
64
|
-
copy_file "#{__dir__}/templates/dev", "bin/dev"
|
65
|
-
chmod "bin/dev", 0o755, verbose: verbose?
|
66
|
-
|
67
|
-
say "Inertia's Rails adapter successfully installed", :green
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def install_inertia
|
73
|
-
say "Adding Inertia's Rails adapter initializer"
|
74
|
-
template "initializer.rb", file_path("config/initializers/inertia_rails.rb")
|
75
|
-
|
76
|
-
say "Installing Inertia npm packages"
|
77
|
-
add_packages(*FRAMEWORKS[framework]["packages"])
|
78
|
-
add_packages(inertia_package)
|
79
|
-
|
80
|
-
unless File.read(vite_config_path).include?(FRAMEWORKS[framework]["vite_plugin_import"])
|
81
|
-
say "Adding Vite plugin for #{framework}"
|
82
|
-
insert_into_file vite_config_path, "\n #{FRAMEWORKS[framework]["vite_plugin_call"]},", after: "plugins: ["
|
83
|
-
prepend_file vite_config_path, "#{FRAMEWORKS[framework]["vite_plugin_import"]}\n"
|
84
|
-
end
|
85
|
-
|
86
|
-
say "Copying #{inertia_entrypoint} entrypoint"
|
87
|
-
template "#{framework}/#{inertia_entrypoint}", js_file_path("entrypoints/#{inertia_entrypoint}")
|
88
|
-
|
89
|
-
if application_layout.exist?
|
90
|
-
say "Adding #{inertia_entrypoint} script tag to the application layout"
|
91
|
-
headers = <<-ERB
|
92
|
-
<%= #{vite_tag} "inertia" %>
|
93
|
-
<%= inertia_headers %>
|
94
|
-
ERB
|
95
|
-
insert_into_file application_layout.to_s, headers, after: "<%= vite_client_tag %>\n"
|
96
|
-
|
97
|
-
if framework == "react" && !application_layout.read.include?("vite_react_refresh_tag")
|
98
|
-
say "Adding Vite React Refresh tag to the application layout"
|
99
|
-
insert_into_file application_layout.to_s, "<%= vite_react_refresh_tag %>\n ", before: "<%= vite_client_tag %>"
|
100
|
-
end
|
101
|
-
|
102
|
-
gsub_file application_layout.to_s, /<title>/, "<title inertia>" if framework != "svelte"
|
103
|
-
else
|
104
|
-
say_error "Could not find the application layout file. Please add the following tags manually:", :red
|
105
|
-
say_error "- <title>...</title>"
|
106
|
-
say_error "+ <title inertia>...</title>"
|
107
|
-
say_error "+ <%= inertia_headers %>"
|
108
|
-
say_error "+ <%= vite_react_refresh_tag %>" if framework == "react"
|
109
|
-
say_error "+ <%= #{vite_tag} \"inertia\" %>"
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def install_typescript
|
114
|
-
say "Adding TypeScript support"
|
115
|
-
if framework == "svelte" && inertia_resolved_version.release < Gem::Version.new("1.3.0")
|
116
|
-
say "WARNING: @inertiajs/svelte < 1.3.0 does not support TypeScript (resolved version: #{inertia_resolved_version}).", :yellow
|
117
|
-
say "Skipping TypeScript support for @inertiajs/svelte", :yellow
|
118
|
-
@typescript = false
|
119
|
-
return
|
120
|
-
end
|
121
|
-
|
122
|
-
add_packages(*FRAMEWORKS[framework]["packages_ts"])
|
123
|
-
end
|
124
|
-
|
125
|
-
def install_example_page
|
126
|
-
say "Copying example Inertia controller"
|
127
|
-
template "controller.rb", file_path("app/controllers/inertia_example_controller.rb")
|
128
|
-
|
129
|
-
say "Adding a route for the example Inertia controller"
|
130
|
-
route "get 'inertia-example', to: 'inertia_example#index'"
|
131
|
-
|
132
|
-
say "Copying page assets"
|
133
|
-
copy_files = FRAMEWORKS[framework]["copy_files"].merge(FRAMEWORKS[framework]["copy_files_#{typescript? ? "ts" : "js"}"])
|
134
|
-
copy_files.each do |source, destination|
|
135
|
-
template "#{framework}/#{source}", file_path(destination % {js_destination_path: js_destination_path})
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def install_tailwind
|
140
|
-
say "Installing Tailwind CSS"
|
141
|
-
add_packages(%w[tailwindcss postcss autoprefixer @tailwindcss/forms @tailwindcss/typography @tailwindcss/container-queries])
|
142
|
-
|
143
|
-
template "tailwind/tailwind.config.js", file_path("tailwind.config.js")
|
144
|
-
copy_file "tailwind/postcss.config.js", file_path("postcss.config.js")
|
145
|
-
copy_file "tailwind/application.css", js_file_path("entrypoints/application.css")
|
146
|
-
|
147
|
-
if application_layout.exist?
|
148
|
-
say "Adding Tailwind CSS to the application layout"
|
149
|
-
insert_into_file application_layout.to_s, "<%= vite_stylesheet_tag \"application\" %>\n ", before: "<%= vite_client_tag %>"
|
150
|
-
else
|
151
|
-
say_error "Could not find the application layout file. Please add the following tags manually:", :red
|
152
|
-
say_error "+ <%= vite_stylesheet_tag \"application\" %>" if install_tailwind?
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def install_vite
|
157
|
-
unless install_vite?
|
158
|
-
say_error "This generator only supports Ruby on Rails with Vite.", :red
|
159
|
-
exit(false)
|
160
|
-
end
|
161
|
-
|
162
|
-
in_root do
|
163
|
-
Bundler.with_original_env do
|
164
|
-
if (capture = run("bundle add vite_rails", capture: !verbose?))
|
165
|
-
say "Vite Rails gem successfully installed", :green
|
166
|
-
else
|
167
|
-
say capture
|
168
|
-
say_error "Failed to install Vite Rails gem", :red
|
169
|
-
exit(false)
|
170
|
-
end
|
171
|
-
if (capture = run("bundle exec vite install", capture: !verbose?))
|
172
|
-
say "Vite Rails successfully installed", :green
|
173
|
-
else
|
174
|
-
say capture
|
175
|
-
say_error "Failed to install Vite Rails", :red
|
176
|
-
exit(false)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
def ruby_vite_installed?
|
183
|
-
return true if package_manager && ruby_vite?
|
184
|
-
|
185
|
-
if package_manager.nil?
|
186
|
-
say_status "Could not find a package.json file to install Inertia to.", nil
|
187
|
-
elsif gem_installed?("webpacker") || gem_installed?("shakapacker")
|
188
|
-
say "Webpacker or Shakapacker is installed.", :yellow
|
189
|
-
say "Vite Ruby can work alongside Webpacker or Shakapacker, but it might cause issues.", :yellow
|
190
|
-
say "Please see the Vite Ruby documentation for the migration guide:", :yellow
|
191
|
-
say "https://vite-ruby.netlify.app/guide/migration.html#webpacker-%F0%9F%93%A6", :yellow
|
192
|
-
else
|
193
|
-
say_status "Could not find a Vite configuration files (`config/vite.json` & `vite.config.{ts,js,mjs,cjs,mts,cts}`).", nil
|
194
|
-
end
|
195
|
-
false
|
196
|
-
end
|
197
|
-
|
198
|
-
def gem_installed?(name)
|
199
|
-
regex = /^[^#]*gem\s+['"]#{name}['"]/
|
200
|
-
File.read(file_path("Gemfile")).match?(regex)
|
201
|
-
end
|
202
|
-
|
203
|
-
def application_layout
|
204
|
-
@application_layout ||= Pathname.new(file_path("app/views/layouts/application.html.erb"))
|
205
|
-
end
|
206
|
-
|
207
|
-
def ruby_vite?
|
208
|
-
file?("config/vite.json") && vite_config_path
|
209
|
-
end
|
210
|
-
|
211
|
-
def package_manager
|
212
|
-
options[:package_manager] || detect_package_manager
|
213
|
-
end
|
214
|
-
|
215
|
-
def add_packages(*packages)
|
216
|
-
in_root do
|
217
|
-
run "#{package_manager} add #{packages.join(" ")} #{verbose? ? "" : "--silent"}"
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
def detect_package_manager
|
222
|
-
return nil unless file?("package.json")
|
223
|
-
|
224
|
-
if file?("package-lock.json")
|
225
|
-
"npm"
|
226
|
-
elsif file?("bun.lockb")
|
227
|
-
"bun"
|
228
|
-
elsif file?("pnpm-lock.yaml")
|
229
|
-
"pnpm"
|
230
|
-
else
|
231
|
-
"yarn"
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
def vite_config_path
|
236
|
-
@vite_config_path ||= Dir.glob(file_path("vite.config.{ts,js,mjs,cjs,mts,cts}")).first
|
237
|
-
end
|
238
|
-
|
239
|
-
def install_vite?
|
240
|
-
return @install_vite if defined?(@install_vite)
|
241
|
-
|
242
|
-
@install_vite = options[:install_vite] || yes?("Would you like to install Vite Ruby? (y/n)", :green)
|
243
|
-
end
|
244
|
-
|
245
|
-
def install_tailwind?
|
246
|
-
return @install_tailwind if defined?(@install_tailwind)
|
247
|
-
|
248
|
-
@install_tailwind = options[:install_tailwind] || yes?("Would you like to install Tailwind CSS? (y/n)", :green)
|
249
|
-
end
|
250
|
-
|
251
|
-
def typescript?
|
252
|
-
return @typescript if defined?(@typescript)
|
253
|
-
|
254
|
-
@typescript = options[:typescript] || yes?("Would you like to use TypeScript? (y/n)", :green)
|
255
|
-
end
|
256
|
-
|
257
|
-
def inertia_entrypoint
|
258
|
-
"inertia.#{typescript? ? "ts" : "js"}"
|
259
|
-
end
|
260
|
-
|
261
|
-
def vite_tag
|
262
|
-
typescript? ? "vite_typescript_tag" : "vite_javascript_tag"
|
263
|
-
end
|
264
|
-
|
265
|
-
def inertia_resolved_version
|
266
|
-
@inertia_resolved_version ||= Gem::Version.new(`npm show @inertiajs/core@#{options[:inertia_version]} version`.strip)
|
267
|
-
end
|
268
|
-
|
269
|
-
def verbose?
|
270
|
-
options[:verbose]
|
271
|
-
end
|
272
|
-
|
273
|
-
def inertia_package
|
274
|
-
"#{FRAMEWORKS[framework]["inertia_package"]}@#{options[:inertia_version]}"
|
275
|
-
end
|
276
|
-
|
277
|
-
def framework
|
278
|
-
@framework ||= options[:framework] || ask("What framework do you want to use with Inertia?", :green, limited_to: FRAMEWORKS.keys, default: "react")
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg width="100%" height="100%" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg"><linearGradient id="a" x1="0" y1="200" x2="400" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#9653ea"/><stop offset="1" stop-color="#6e74ef"/></linearGradient><path fill="url(#a)" fill-rule="evenodd" d="M400 200C400 89.543 310.457 0 200 0S0 89.543 0 200s89.543 200 200 200 200-89.543 200-200Z"/><path fill="#fff" d="M137.331 117.6H52.4l82.069 82.069L52.4 281.737h84.931L219.4 199.67Z"/><path fill="#fff" d="M265.231 117.6H180.3l82.069 82.069-82.069 82.068h84.931L347.3 199.67Z"/></svg>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg viewBox="-10.5 -9.45 21 18.9" fill="none" xmlns="http://www.w3.org/2000/svg" class="uwu-hidden mt-4 mb-3 text-brand dark:text-brand-dark w-24 lg:w-28 self-center text-sm me-0 flex origin-center transition-all ease-in-out"><circle r="2" fill="#58C4DC"/><g stroke="#58C4DC"><ellipse rx="10" ry="4.5"/><ellipse rx="10" ry="4.5" transform="rotate(60)"/><ellipse rx="10" ry="4.5" transform="rotate(120)"/></g></svg>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="iconify iconify--logos" width="26.6" height="32" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056 86.566 86.566 0 0 0 8.536 55.576 82.425 82.425 0 0 0-12.296 30.719 87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057 86.601 86.601 0 0 0-8.53-55.577 82.409 82.409 0 0 0 12.29-30.718 87.573 87.573 0 0 0-14.963-66.244"/><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85 49.978 49.978 0 0 1 1.713-6.693l1.35-4.115 3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808-.245 2.659a16.067 16.067 0 0 0 2.89 10.656 17.143 17.143 0 0 0 18.397 6.828 15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977 15.923 15.923 0 0 0-2.713-12.011 17.156 17.156 0 0 0-18.404-6.832 15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849 49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85 50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809.246-2.658a16.099 16.099 0 0 0-2.89-10.656 17.143 17.143 0 0 0-18.398-6.828 15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975 15.9 15.9 0 0 0 2.709 12.012 17.156 17.156 0 0 0 18.404 6.832 15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848 49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"/></svg>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 366 304" fill="none"><path d="M91.95 46.973a5.5 5.5 0 0 0-.401.722l-59.724 69.638a5.5 5.5 0 0 0 .003 7.165l147 171.086a5.502 5.502 0 0 0 8.344 0l147-171.084a5.5 5.5 0 0 0 .003-7.165l-59.723-69.637a5.5 5.5 0 0 0-4.996-3.198H96.543a5.5 5.5 0 0 0-4.592 2.473z" fill="url(#a)" stroke="url(#b)" stroke-width="11" stroke-linecap="round" stroke-linejoin="round"/><path d="m265.857 19.004-116.154 5.598a4.346 4.346 0 0 0-3.643 3.885v109.121c-.267 2.885 2.326 5.217 5.182 4.659l20.815-4.659c3.114-.608 5.819 2.194 5.082 5.268l-8.01 45.423c-.767 3.199 2.18 6.052 5.371 5.201l17.232-3.395c3.195-.852 6.144 2.01 5.369 5.211l-18.069 74.653c-1.13 4.67 5.068 7.44 7.82 3.495l1.838-2.635L291.703 81.887c1.725-3.163-.947-6.923-4.518-6.357l-34.224 5.417c-3.217.508-5.839-2.544-4.834-5.627l22.576-50.691c1.006-3.088-1.626-6.144-4.846-5.625z" fill="url(#c)"/><defs><linearGradient id="a" x1="28.5" y1="34" x2="246.355" y2="194.428" gradientUnits="userSpaceOnUse"><stop stop-color="#FF006B"/><stop offset=".364" stop-color="#C00"/><stop offset="1" stop-color="#980D03"/></linearGradient><linearGradient id="b" x1="28.5" y1="34" x2="246.355" y2="194.428" gradientUnits="userSpaceOnUse"><stop stop-color="#FF006B"/><stop offset=".364" stop-color="#C00"/><stop offset="1" stop-color="#980D03"/></linearGradient><linearGradient id="c" x1="183.666" y1="-5.499" x2="211.353" y2="242.278" gradientUnits="userSpaceOnUse"><stop stop-color="#FFDD35"/><stop offset=".083" stop-color="#FFD233"/><stop offset=".594" stop-color="#FFA800"/><stop offset=".839" stop-color="#F90"/></linearGradient></defs></svg>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="iconify iconify--logos" width="37.07" height="36" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8 0 0h97.92L128 51.2 157.44 0h47.36Z"/><path fill="#41B883" d="m0 0 128 220.8L256 0h-51.2L128 132.48 50.56 0H0Z"/><path fill="#35495E" d="M50.56 0 128 133.12 204.8 0h-47.36L128 51.2 97.92 0H50.56Z"/></svg>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env sh
|
2
|
-
|
3
|
-
export PORT="${PORT:-3000}"
|
4
|
-
|
5
|
-
if command -v overmind 1> /dev/null 2>&1
|
6
|
-
then
|
7
|
-
overmind start -f Procfile.dev "$@"
|
8
|
-
exit $?
|
9
|
-
fi
|
10
|
-
|
11
|
-
if command -v hivemind 1> /dev/null 2>&1
|
12
|
-
then
|
13
|
-
echo "Hivemind is installed. Running the application with Hivemind..."
|
14
|
-
exec hivemind Procfile.dev "$@"
|
15
|
-
exit $?
|
16
|
-
fi
|
17
|
-
|
18
|
-
if gem list --no-installed --exact --silent foreman; then
|
19
|
-
echo "Installing foreman..."
|
20
|
-
gem install foreman
|
21
|
-
fi
|
22
|
-
|
23
|
-
foreman start -f Procfile.dev "$@"
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { Head } from '@inertiajs/react'
|
2
|
-
import { useState } from 'react'
|
3
|
-
|
4
|
-
import reactSvg from '/assets/react.svg'
|
5
|
-
import inertiaSvg from '/assets/inertia.svg'
|
6
|
-
import viteRubySvg from '/assets/vite_ruby.svg'
|
7
|
-
|
8
|
-
import cs from './InertiaExample.module.css'
|
9
|
-
|
10
|
-
export default function InertiaExample({ name }) {
|
11
|
-
const [count, setCount] = useState(0)
|
12
|
-
|
13
|
-
return (
|
14
|
-
<>
|
15
|
-
<Head title="Inertia + Vite Ruby + React Example" />
|
16
|
-
|
17
|
-
<div className={cs.root}>
|
18
|
-
<h1 className={cs.h1}>Hello {name}!</h1>
|
19
|
-
|
20
|
-
<div>
|
21
|
-
<a href="https://inertia-rails.netlify.app" target="_blank">
|
22
|
-
<img className={cs.logo} src={inertiaSvg} alt="Inertia logo" />
|
23
|
-
</a>
|
24
|
-
<a href="https://vite-ruby.netlify.app" target="_blank">
|
25
|
-
<img
|
26
|
-
className={`${cs.logo} ${cs.vite}`}
|
27
|
-
src={viteRubySvg}
|
28
|
-
alt="Vite Ruby logo"
|
29
|
-
/>
|
30
|
-
</a>
|
31
|
-
<a href="https://react.dev" target="_blank">
|
32
|
-
<img
|
33
|
-
className={`${cs.logo} ${cs.react}`}
|
34
|
-
src={reactSvg}
|
35
|
-
alt="React logo"
|
36
|
-
/>
|
37
|
-
</a>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<h2 className={cs.h2}>Inertia + Vite Ruby + React</h2>
|
41
|
-
|
42
|
-
<div className="card">
|
43
|
-
<button
|
44
|
-
className={cs.button}
|
45
|
-
onClick={() => setCount((count) => count + 1)}
|
46
|
-
>
|
47
|
-
count is {count}
|
48
|
-
</button>
|
49
|
-
<p>
|
50
|
-
Edit <code>app/frontend/pages/InertiaExample.jsx</code> and save to
|
51
|
-
test HMR
|
52
|
-
</p>
|
53
|
-
</div>
|
54
|
-
<p className={cs.readTheDocs}>
|
55
|
-
Click on the Inertia, Vite Ruby, and React logos to learn more
|
56
|
-
</p>
|
57
|
-
</div>
|
58
|
-
</>
|
59
|
-
)
|
60
|
-
}
|
@@ -1,80 +0,0 @@
|
|
1
|
-
.root {
|
2
|
-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
3
|
-
line-height: 1.5;
|
4
|
-
font-weight: 400;
|
5
|
-
color: #213547;
|
6
|
-
background-color: #ffffff;
|
7
|
-
max-width: 1280px;
|
8
|
-
margin: 0 auto;
|
9
|
-
padding: 2rem;
|
10
|
-
text-align: center;
|
11
|
-
}
|
12
|
-
|
13
|
-
.h1 {
|
14
|
-
font-size: 3.2em;
|
15
|
-
line-height: 1.1;
|
16
|
-
}
|
17
|
-
|
18
|
-
.h2 {
|
19
|
-
font-size: 2.6em;
|
20
|
-
line-height: 1.1;
|
21
|
-
}
|
22
|
-
|
23
|
-
.button {
|
24
|
-
border-radius: 8px;
|
25
|
-
border: 1px solid transparent;
|
26
|
-
padding: 0.6em 1.2em;
|
27
|
-
font-size: 1em;
|
28
|
-
font-weight: 500;
|
29
|
-
font-family: inherit;
|
30
|
-
background-color: #f9f9f9;
|
31
|
-
cursor: pointer;
|
32
|
-
transition: border-color 0.25s;
|
33
|
-
}
|
34
|
-
.button:hover {
|
35
|
-
border-color: #646cff;
|
36
|
-
}
|
37
|
-
.button:focus,
|
38
|
-
.button:focus-visible {
|
39
|
-
outline: 4px auto -webkit-focus-ring-color;
|
40
|
-
}
|
41
|
-
|
42
|
-
.logo {
|
43
|
-
display: inline-block;
|
44
|
-
height: 6em;
|
45
|
-
padding: 1.5em;
|
46
|
-
will-change: filter;
|
47
|
-
transition: filter 300ms;
|
48
|
-
}
|
49
|
-
.logo:hover {
|
50
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
51
|
-
}
|
52
|
-
.logo.vite:hover {
|
53
|
-
filter: drop-shadow(0 0 2em #e4023baa);
|
54
|
-
}
|
55
|
-
.logo.react:hover {
|
56
|
-
filter: drop-shadow(0 0 2em #61dafbaa);
|
57
|
-
}
|
58
|
-
|
59
|
-
@keyframes logo-spin {
|
60
|
-
from {
|
61
|
-
transform: rotate(0deg);
|
62
|
-
}
|
63
|
-
to {
|
64
|
-
transform: rotate(360deg);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
@media (prefers-reduced-motion: no-preference) {
|
69
|
-
.logo.react {
|
70
|
-
animation: logo-spin infinite 20s linear;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
.card {
|
75
|
-
padding: 2em;
|
76
|
-
}
|
77
|
-
|
78
|
-
.read-the-docs {
|
79
|
-
color: #888;
|
80
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { Head } from '@inertiajs/react'
|
2
|
-
import { useState } from 'react'
|
3
|
-
|
4
|
-
import reactSvg from '/assets/react.svg'
|
5
|
-
import inertiaSvg from '/assets/inertia.svg'
|
6
|
-
import viteRubySvg from '/assets/vite_ruby.svg'
|
7
|
-
|
8
|
-
import cs from './InertiaExample.module.css'
|
9
|
-
|
10
|
-
export default function InertiaExample({ name }: { name: string }) {
|
11
|
-
const [count, setCount] = useState(0)
|
12
|
-
|
13
|
-
return (
|
14
|
-
<>
|
15
|
-
<Head title="Inertia + Vite Ruby + React Example" />
|
16
|
-
|
17
|
-
<div className={cs.root}>
|
18
|
-
<h1 className={cs.h1}>Hello {name}!</h1>
|
19
|
-
|
20
|
-
<div>
|
21
|
-
<a href="https://inertia-rails.netlify.app" target="_blank">
|
22
|
-
<img className={cs.logo} src={inertiaSvg} alt="Inertia logo" />
|
23
|
-
</a>
|
24
|
-
<a href="https://vite-ruby.netlify.app" target="_blank">
|
25
|
-
<img
|
26
|
-
className={`${cs.logo} ${cs.vite}`}
|
27
|
-
src={viteRubySvg}
|
28
|
-
alt="Vite Ruby logo"
|
29
|
-
/>
|
30
|
-
</a>
|
31
|
-
<a href="https://react.dev" target="_blank">
|
32
|
-
<img
|
33
|
-
className={`${cs.logo} ${cs.react}`}
|
34
|
-
src={reactSvg}
|
35
|
-
alt="React logo"
|
36
|
-
/>
|
37
|
-
</a>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<h2 className={cs.h2}>Inertia + Vite Ruby + React</h2>
|
41
|
-
|
42
|
-
<div className="card">
|
43
|
-
<button
|
44
|
-
className={cs.button}
|
45
|
-
onClick={() => setCount((count) => count + 1)}
|
46
|
-
>
|
47
|
-
count is {count}
|
48
|
-
</button>
|
49
|
-
<p>
|
50
|
-
Edit <code>app/frontend/pages/InertiaExample.jsx</code> and save to
|
51
|
-
test HMR
|
52
|
-
</p>
|
53
|
-
</div>
|
54
|
-
<p className={cs.readTheDocs}>
|
55
|
-
Click on the Inertia, Vite Ruby, and React logos to learn more
|
56
|
-
</p>
|
57
|
-
</div>
|
58
|
-
</>
|
59
|
-
)
|
60
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { createInertiaApp } from '@inertiajs/react'
|
2
|
-
import { createElement } from 'react'
|
3
|
-
import { createRoot } from 'react-dom/client'
|
4
|
-
|
5
|
-
createInertiaApp({
|
6
|
-
// Set default page title
|
7
|
-
// see https://inertia-rails.netlify.app/guide/title-and-meta
|
8
|
-
//
|
9
|
-
// title: title => title ? `${title} - App` : 'App',
|
10
|
-
|
11
|
-
// Disable progress bar
|
12
|
-
//
|
13
|
-
// see https://inertia-rails.netlify.app/guide/progress-indicators
|
14
|
-
// progress: false,
|
15
|
-
|
16
|
-
resolve: (name) => {
|
17
|
-
const pages = import.meta.glob('../pages/**/*.jsx', { eager: true })
|
18
|
-
return pages[`../pages/${name}.jsx`]
|
19
|
-
|
20
|
-
// To use a default layout, import the Layout component
|
21
|
-
// and use the following lines.
|
22
|
-
// see https://inertia-rails.netlify.app/guide/pages#default-layouts
|
23
|
-
//
|
24
|
-
// const page = pages[`../pages/${name}.jsx`]
|
25
|
-
// page.default.layout ||= (page) => createElement(Layout, null, page)
|
26
|
-
// return page
|
27
|
-
},
|
28
|
-
|
29
|
-
setup({ el, App, props }) {
|
30
|
-
const root = createRoot(el)
|
31
|
-
|
32
|
-
root.render(createElement(App, props))
|
33
|
-
},
|
34
|
-
})
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { createInertiaApp } from '@inertiajs/react'
|
2
|
-
import { createElement, ReactNode } from 'react'
|
3
|
-
import { createRoot } from 'react-dom/client'
|
4
|
-
|
5
|
-
type Component = { default: ReactNode & { layout?: (page: ReactNode) => ReactNode } }
|
6
|
-
|
7
|
-
createInertiaApp({
|
8
|
-
// Set default page title
|
9
|
-
// see https://inertia-rails.netlify.app/guide/title-and-meta
|
10
|
-
//
|
11
|
-
// title: title => title ? `${title} - App` : 'App',
|
12
|
-
|
13
|
-
// Disable progress bar
|
14
|
-
//
|
15
|
-
// see https://inertia-rails.netlify.app/guide/progress-indicators
|
16
|
-
// progress: false,
|
17
|
-
|
18
|
-
resolve: (name) => {
|
19
|
-
const pages = import.meta.glob('../pages/**/*.tsx', { eager: true })
|
20
|
-
return pages[`../pages/${name}.tsx`] as Component
|
21
|
-
|
22
|
-
// To use a default layout, import the Layout component
|
23
|
-
// and use the following lines.
|
24
|
-
// see https://inertia-rails.netlify.app/guide/pages#default-layouts
|
25
|
-
//
|
26
|
-
// const page = pages[`../pages/${name}.tsx`] as Component
|
27
|
-
// page.default.layout ||= (page) => createElement(Layout, null, page)
|
28
|
-
// return page
|
29
|
-
},
|
30
|
-
|
31
|
-
setup({ el, App, props }) {
|
32
|
-
const root = createRoot(el)
|
33
|
-
|
34
|
-
root.render(createElement(App, props))
|
35
|
-
},
|
36
|
-
})
|
@@ -1,27 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"composite": true,
|
4
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
5
|
-
"target": "ES2020",
|
6
|
-
"useDefineForClassFields": true,
|
7
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
8
|
-
"module": "ESNext",
|
9
|
-
"skipLibCheck": true,
|
10
|
-
|
11
|
-
/* Bundler mode */
|
12
|
-
"moduleResolution": "bundler",
|
13
|
-
"allowImportingTsExtensions": true,
|
14
|
-
"resolveJsonModule": true,
|
15
|
-
"isolatedModules": true,
|
16
|
-
"moduleDetection": "force",
|
17
|
-
"noEmit": true,
|
18
|
-
"jsx": "react-jsx",
|
19
|
-
|
20
|
-
/* Linting */
|
21
|
-
"strict": true,
|
22
|
-
"noUnusedLocals": true,
|
23
|
-
"noUnusedParameters": true,
|
24
|
-
"noFallthroughCasesInSwitch": true,
|
25
|
-
},
|
26
|
-
"include": ["<%= js_destination_path %>"]
|
27
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"composite": true,
|
4
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
5
|
-
"skipLibCheck": true,
|
6
|
-
"module": "ESNext",
|
7
|
-
"moduleResolution": "bundler",
|
8
|
-
"allowSyntheticDefaultImports": true,
|
9
|
-
"strict": true,
|
10
|
-
"noEmit": true
|
11
|
-
},
|
12
|
-
"include": ["vite.config.ts"]
|
13
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
/// <reference types="vite/client" />
|