inertia_rails 3.3.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +6 -7
  4. data/lib/generators/inertia/controller/controller_generator.rb +18 -0
  5. data/lib/generators/inertia/controller/templates/controller.rb.tt +10 -0
  6. data/lib/generators/inertia/install/frameworks.yml +98 -0
  7. data/lib/generators/inertia/install/helpers.rb +51 -0
  8. data/lib/generators/inertia/install/install_generator.rb +291 -0
  9. data/lib/generators/inertia/install/js_package_manager.rb +50 -0
  10. data/lib/generators/inertia/install/templates/assets/inertia.svg +1 -0
  11. data/lib/generators/inertia/install/templates/assets/react.svg +1 -0
  12. data/lib/generators/inertia/install/templates/assets/svelte.svg +1 -0
  13. data/lib/generators/inertia/install/templates/assets/vite_ruby.svg +1 -0
  14. data/lib/generators/inertia/install/templates/assets/vue.svg +1 -0
  15. data/lib/generators/{inertia_rails/install → inertia/install/templates}/controller.rb +3 -1
  16. data/lib/generators/inertia/install/templates/dev +23 -0
  17. data/lib/generators/inertia/install/templates/initializer.rb +6 -0
  18. data/lib/generators/inertia/install/templates/react/InertiaExample.jsx +60 -0
  19. data/lib/generators/inertia/install/templates/react/InertiaExample.module.css +80 -0
  20. data/lib/generators/inertia/install/templates/react/InertiaExample.tsx +60 -0
  21. data/lib/generators/inertia/install/templates/react/inertia.js +45 -0
  22. data/lib/generators/inertia/install/templates/react/inertia.ts +51 -0
  23. data/lib/generators/inertia/install/templates/react/tsconfig.app.json +27 -0
  24. data/lib/generators/inertia/install/templates/react/tsconfig.json +11 -0
  25. data/lib/generators/inertia/install/templates/react/tsconfig.node.json +13 -0
  26. data/lib/generators/inertia/install/templates/react/vite-env.d.ts +1 -0
  27. data/lib/generators/inertia/install/templates/svelte/InertiaExample.svelte +112 -0
  28. data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +112 -0
  29. data/lib/generators/inertia/install/templates/svelte/inertia.js +44 -0
  30. data/lib/generators/inertia/install/templates/svelte/inertia.ts.tt +45 -0
  31. data/lib/generators/inertia/install/templates/svelte/svelte.config.js +7 -0
  32. data/lib/generators/inertia/install/templates/svelte/tsconfig.json +21 -0
  33. data/lib/generators/inertia/install/templates/svelte/tsconfig.node.json +12 -0
  34. data/lib/generators/inertia/install/templates/svelte/vite-env.d.ts +2 -0
  35. data/lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte +116 -0
  36. data/lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte +116 -0
  37. data/lib/generators/inertia/install/templates/svelte4/inertia.js +43 -0
  38. data/lib/generators/inertia/install/templates/svelte4/inertia.ts.tt +44 -0
  39. data/lib/generators/inertia/install/templates/svelte4/svelte.config.js +7 -0
  40. data/lib/generators/inertia/install/templates/svelte4/tsconfig.json +21 -0
  41. data/lib/generators/inertia/install/templates/svelte4/tsconfig.node.json +12 -0
  42. data/lib/generators/inertia/install/templates/svelte4/vite-env.d.ts +2 -0
  43. data/lib/generators/inertia/install/templates/tailwind/application.css +13 -0
  44. data/lib/generators/inertia/install/templates/tailwind/postcss.config.js +6 -0
  45. data/lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt +18 -0
  46. data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +117 -0
  47. data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +117 -0
  48. data/lib/generators/inertia/install/templates/vue/inertia.js +35 -0
  49. data/lib/generators/inertia/install/templates/vue/inertia.ts +35 -0
  50. data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +24 -0
  51. data/lib/generators/inertia/install/templates/vue/tsconfig.json +11 -0
  52. data/lib/generators/inertia/install/templates/vue/tsconfig.node.json +22 -0
  53. data/lib/generators/inertia/install/templates/vue/vite-env.d.ts +1 -0
  54. data/lib/generators/inertia/scaffold/scaffold_generator.rb +16 -0
  55. data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +60 -0
  56. data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +100 -0
  57. data/lib/generators/inertia_templates/controller/controller_generator.rb +12 -0
  58. data/lib/generators/inertia_templates/controller/templates/react/view.jsx.tt +8 -0
  59. data/lib/generators/inertia_templates/controller/templates/react/view.tsx.tt +8 -0
  60. data/lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt +2 -0
  61. data/lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt +2 -0
  62. data/lib/generators/inertia_templates/controller/templates/vue/view.vue.tt +4 -0
  63. data/lib/generators/inertia_templates/scaffold/scaffold_generator.rb +12 -0
  64. data/lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt +35 -0
  65. data/lib/generators/inertia_templates/scaffold/templates/react/Edit.tsx.tt +40 -0
  66. data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +111 -0
  67. data/lib/generators/inertia_templates/scaffold/templates/react/Form.tsx.tt +130 -0
  68. data/lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt +26 -0
  69. data/lib/generators/inertia_templates/scaffold/templates/react/Index.tsx.tt +32 -0
  70. data/lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt +27 -0
  71. data/lib/generators/inertia_templates/scaffold/templates/react/New.tsx.tt +32 -0
  72. data/lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt +26 -0
  73. data/lib/generators/inertia_templates/scaffold/templates/react/One.tsx.tt +32 -0
  74. data/lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt +32 -0
  75. data/lib/generators/inertia_templates/scaffold/templates/react/Show.tsx.tt +38 -0
  76. data/lib/generators/inertia_templates/scaffold/templates/react/types.ts.tt +19 -0
  77. data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt +36 -0
  78. data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +37 -0
  79. data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +97 -0
  80. data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.ts.svelte.tt +102 -0
  81. data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt +35 -0
  82. data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.ts.svelte.tt +39 -0
  83. data/lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt +29 -0
  84. data/lib/generators/inertia_templates/scaffold/templates/svelte/New.ts.svelte.tt +30 -0
  85. data/lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt +28 -0
  86. data/lib/generators/inertia_templates/scaffold/templates/svelte/One.ts.svelte.tt +30 -0
  87. data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt +35 -0
  88. data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.ts.svelte.tt +39 -0
  89. data/lib/generators/inertia_templates/scaffold/templates/svelte/types.ts.tt +19 -0
  90. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.svelte.tt +37 -0
  91. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +38 -0
  92. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt +96 -0
  93. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +106 -0
  94. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt +36 -0
  95. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +37 -0
  96. data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.svelte.tt +30 -0
  97. data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.ts.svelte.tt +31 -0
  98. data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt +28 -0
  99. data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.ts.svelte.tt +30 -0
  100. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt +39 -0
  101. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +40 -0
  102. data/lib/generators/inertia_templates/scaffold/templates/svelte4/types.ts.tt +19 -0
  103. data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.ts.vue.tt +37 -0
  104. data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt +36 -0
  105. data/lib/generators/inertia_templates/scaffold/templates/vue/Form.ts.vue.tt +101 -0
  106. data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +94 -0
  107. data/lib/generators/inertia_templates/scaffold/templates/vue/Index.ts.vue.tt +35 -0
  108. data/lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt +31 -0
  109. data/lib/generators/inertia_templates/scaffold/templates/vue/New.ts.vue.tt +30 -0
  110. data/lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt +29 -0
  111. data/lib/generators/inertia_templates/scaffold/templates/vue/One.ts.vue.tt +28 -0
  112. data/lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt +26 -0
  113. data/lib/generators/inertia_templates/scaffold/templates/vue/Show.ts.vue.tt +41 -0
  114. data/lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt +37 -0
  115. data/lib/generators/inertia_templates/scaffold/templates/vue/types.ts.tt +19 -0
  116. data/lib/generators/inertia_tw_templates/controller/controller_generator.rb +12 -0
  117. data/lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt +8 -0
  118. data/lib/generators/inertia_tw_templates/controller/templates/react/view.tsx.tt +8 -0
  119. data/lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt +2 -0
  120. data/lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt +2 -0
  121. data/lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt +4 -0
  122. data/lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb +12 -0
  123. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt +42 -0
  124. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.tsx.tt +47 -0
  125. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +122 -0
  126. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.tsx.tt +142 -0
  127. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt +43 -0
  128. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.tsx.tt +49 -0
  129. data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt +30 -0
  130. data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.tsx.tt +35 -0
  131. data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt +26 -0
  132. data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.tsx.tt +32 -0
  133. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt +47 -0
  134. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.tsx.tt +53 -0
  135. data/lib/generators/inertia_tw_templates/scaffold/templates/react/types.ts.tt +19 -0
  136. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt +44 -0
  137. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +45 -0
  138. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +118 -0
  139. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.ts.svelte.tt +123 -0
  140. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt +42 -0
  141. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.ts.svelte.tt +46 -0
  142. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt +32 -0
  143. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.ts.svelte.tt +33 -0
  144. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt +28 -0
  145. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.ts.svelte.tt +30 -0
  146. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt +50 -0
  147. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.ts.svelte.tt +54 -0
  148. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/types.ts.tt +19 -0
  149. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.svelte.tt +45 -0
  150. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +46 -0
  151. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt +120 -0
  152. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +130 -0
  153. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt +43 -0
  154. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +44 -0
  155. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.svelte.tt +33 -0
  156. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.ts.svelte.tt +34 -0
  157. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt +28 -0
  158. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.ts.svelte.tt +30 -0
  159. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt +51 -0
  160. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +52 -0
  161. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/types.ts.tt +19 -0
  162. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.ts.vue.tt +45 -0
  163. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt +44 -0
  164. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.ts.vue.tt +134 -0
  165. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt +127 -0
  166. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.ts.vue.tt +47 -0
  167. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt +43 -0
  168. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.ts.vue.tt +33 -0
  169. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt +32 -0
  170. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.ts.vue.tt +28 -0
  171. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt +26 -0
  172. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.ts.vue.tt +53 -0
  173. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt +49 -0
  174. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/types.ts.tt +19 -0
  175. data/lib/inertia_rails/action_filter.rb +27 -0
  176. data/lib/inertia_rails/always_prop.rb +6 -0
  177. data/lib/inertia_rails/base_prop.rb +14 -0
  178. data/lib/inertia_rails/configuration.rb +1 -1
  179. data/lib/inertia_rails/controller.rb +70 -15
  180. data/lib/inertia_rails/generators/controller_template_base.rb +63 -0
  181. data/lib/inertia_rails/generators/helper.rb +139 -0
  182. data/lib/inertia_rails/generators/scaffold_template_base.rb +45 -0
  183. data/lib/inertia_rails/inertia_rails.rb +18 -12
  184. data/lib/inertia_rails/lazy_prop.rb +20 -0
  185. data/lib/inertia_rails/renderer.rb +71 -17
  186. data/lib/inertia_rails/version.rb +1 -1
  187. data/lib/patches/better_errors.rb +10 -8
  188. data/lib/patches/debug_exceptions/patch-5-0.rb +7 -3
  189. data/lib/patches/debug_exceptions/patch-5-1.rb +7 -3
  190. data/lib/patches/mapper.rb +9 -5
  191. data/lib/patches/request.rb +10 -6
  192. metadata +192 -126
  193. data/.github/workflows/push.yml +0 -33
  194. data/.gitignore +0 -25
  195. data/.rspec +0 -3
  196. data/CODE_OF_CONDUCT.md +0 -74
  197. data/Gemfile +0 -7
  198. data/Rakefile +0 -6
  199. data/bin/console +0 -13
  200. data/bin/setup +0 -8
  201. data/inertia_rails.gemspec +0 -37
  202. data/lib/generators/inertia_rails/install/react/InertiaExample.jsx +0 -9
  203. data/lib/generators/inertia_rails/install/react/inertia.jsx +0 -17
  204. data/lib/generators/inertia_rails/install/svelte/InertiaExample.svelte +0 -11
  205. data/lib/generators/inertia_rails/install/svelte/inertia.js +0 -14
  206. data/lib/generators/inertia_rails/install/vue/InertiaExample.vue +0 -11
  207. data/lib/generators/inertia_rails/install/vue/inertia.js +0 -20
  208. data/lib/generators/inertia_rails/install_generator.rb +0 -84
  209. data/lib/inertia_rails/lazy.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 617a4b404988a934d8bfb0ce176965bec8f09d99dcb167322579152597c75261
4
- data.tar.gz: 739e59619439d641ef16dd0816eaab093beb28990624397509a4f1c3b0fc40c6
3
+ metadata.gz: ef66baa0e1a57eca72a52421858b7d0f1cc27e6bd0bbf09f53d2c6440b677b94
4
+ data.tar.gz: 832a854fc9e749a365d3745521d256834eb778693e256cdda2321253eda47332
5
5
  SHA512:
6
- metadata.gz: cc2dcfbdc024ea9a3e83bbd7f0d5afb1be1d14e753d776417f4dbfd7f6bd6e3cdc50e307b73d5495a67b8419ed29b4d2863f467bbf858383504bc7e62920e1ea
7
- data.tar.gz: 825b82f4daf26c050c7fe703da03834143a866b2db9728cbb56dface555f4453e984b82038d61bef5e5ce40aa80ef295ef1def1b29794cdc0ef93f6f53a48267
6
+ metadata.gz: 1dc4a22fe2d2fd31fc1284030f2cc64f292cdc1224b15e37e2370d4f5b081c6240f6ed3340f827ccb9c0ad0b0022acdd51001ca3585c404ca1033b93b2503666
7
+ data.tar.gz: 9becf43df35016ef9659f0055439b599c88d0a422eec1d6728bbf22b2393cb16bd5b177b697044651a9c79c51be332d5a9564969b6773f0815fada77d6408fae
data/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.5.0] - 2024-11-29
8
+
9
+ * Add Algolia search for docs (#151, @skryukov)
10
+ * Add support for Always props (#152, @skryukov)
11
+ * Add support for :except in partial reloads (#152, @skryukov)
12
+ * CI fixes (#156, @bknoles)
13
+ * Support dot notation for :only partial reloads (#163, @bknoles)
14
+ * Avoid some monkey patching (#164, @adrianpacala)
15
+ * Upstream generators from inertia_rails-contrib (#158, @skryukov)
16
+ * Raise a deprecation warning instead of an exception if you pass a non-hashable to inertia errors (#168, @skryukov)
17
+
18
+ ## [3.4.0] - 2024-11-02
19
+
20
+ * Inertia Rails documentation (@skryukov)
21
+ * Add specs for config refactor (#139)
22
+ * New feature: if/unless/only/except options for inertia_share. Enables per-action sharing! (#137, @skryukov)
23
+ * Bugfix: for inertia errors when using message_pack to serialize cookies. (#143, @BenMorganMY)
24
+ * Test Rails 7.2 in CI/CD (#145, @skryukov)
25
+ * Bring redirect behavior in line with Rails 7.0 behavior (#146, @skryukov)
26
+ * Gemspec cleanup (#149, @skryukov)
27
+
7
28
  ## [3.3.0] - 2024-10-27
8
29
 
9
30
  * Refactor Inertia configuration into a controller class method. Thanks @ElMassimo!
data/README.md CHANGED
@@ -13,16 +13,15 @@ Add the `inertia_rails` gem to your Gemfile.
13
13
  gem 'inertia_rails'
14
14
  ```
15
15
 
16
- For more instructions, see [Server-side setup](https://inertia-rails.netlify.app/guide/server-side-setup.html).
16
+ Follow the complete [Server-side setup](https://inertia-rails.dev/guide/server-side-setup) in the official documentation.
17
17
 
18
18
  ### Frontend
19
19
 
20
- We are discussing on bringing official docs for Inertia Rails to this repo, as
21
- the [official docs](https://inertiajs.com/client-side-setup) are specific to Laravel.
20
+ Follow the [Client-side setup](https://inertia-rails.dev/guide/client-side-setup) guide for detailed configuration steps.
22
21
 
23
- In the meantime, you can refer to the community-maintained [Client-side setup](https://inertia-rails.netlify.app/guide/client-side-setup.html).
22
+ ### Example Projects:
24
23
 
25
- Examples:
24
+ Reference these sample implementations:
26
25
 
27
26
  - [React/Vite](https://github.com/BrandonShar/inertia-rails-template)
28
27
  - [React/Vite + SSR](https://github.com/ElMassimo/inertia-rails-ssr-template)
@@ -103,11 +102,11 @@ end
103
102
 
104
103
  ### Shared Data
105
104
 
106
- If you have data that you want to be provided as a prop to every component (a common use-case is information about the authenticated user) you can use the `shared_data` controller method.
105
+ If you have data that you want to be provided as a prop to every component (a common use-case is information about the authenticated user) you can use the `inertia_share` controller method.
107
106
 
108
107
  ```ruby
109
108
  class EventsController < ApplicationController
110
- # share syncronously
109
+ # share synchronously
111
110
  inertia_share app_name: env['app.name']
112
111
 
113
112
  # share lazily, evaluated at render time
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/rails/controller/controller_generator'
4
+ require 'inertia_rails/generators/helper'
5
+
6
+ module Inertia
7
+ module Generators
8
+ class ControllerGenerator < Rails::Generators::ControllerGenerator
9
+ include InertiaRails::Generators::Helper
10
+
11
+ source_root File.expand_path('./templates', __dir__)
12
+
13
+ remove_hook_for :template_engine
14
+
15
+ hook_for :inertia_templates, required: true, default: InertiaRails::Generators::Helper.guess_inertia_template
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ <% module_namespacing do -%>
2
+ class <%= class_name %>Controller < <%= parent_class_name.classify %>
3
+ <% actions.each do |action| -%>
4
+ def <%= action %>
5
+ render inertia: '<%= "#{inertia_base_path}/#{action.camelize}" %>'
6
+ end
7
+ <%= "\n" unless action == actions.last -%>
8
+ <% end -%>
9
+ end
10
+ <% end -%>
@@ -0,0 +1,98 @@
1
+ react:
2
+ inertia_package: "@inertiajs/react"
3
+ packages:
4
+ - "@vitejs/plugin-react"
5
+ - "react"
6
+ - "react-dom"
7
+ packages_ts:
8
+ - "@types/react"
9
+ - "@types/react-dom"
10
+ - "typescript"
11
+ vite_plugin_import: "import react from '@vitejs/plugin-react'"
12
+ vite_plugin_call: "react()"
13
+ copy_files_ts:
14
+ "InertiaExample.tsx": "%{js_destination_path}/pages/InertiaExample.tsx"
15
+ "tsconfig.json": "tsconfig.json"
16
+ "tsconfig.app.json": "tsconfig.app.json"
17
+ "tsconfig.node.json": "tsconfig.node.json"
18
+ "vite-env.d.ts": "%{js_destination_path}/vite-env.d.ts"
19
+ copy_files_js:
20
+ "InertiaExample.jsx": "%{js_destination_path}/pages/InertiaExample.jsx"
21
+ copy_files:
22
+ "InertiaExample.module.css": "%{js_destination_path}/pages/InertiaExample.module.css"
23
+ "../assets/react.svg": "%{js_destination_path}/assets/react.svg"
24
+ "../assets/inertia.svg": "%{js_destination_path}/assets/inertia.svg"
25
+ "../assets/vite_ruby.svg": "%{js_destination_path}/assets/vite_ruby.svg"
26
+
27
+ vue:
28
+ inertia_package: "@inertiajs/vue3"
29
+ packages:
30
+ - "vue"
31
+ - "@vitejs/plugin-vue"
32
+ packages_ts:
33
+ - "typescript@~5.6.2"
34
+ - "vue-tsc"
35
+ vite_plugin_import: "import vue from '@vitejs/plugin-vue'"
36
+ vite_plugin_call: "vue()"
37
+ copy_files:
38
+ "../assets/vue.svg": "%{js_destination_path}/assets/vue.svg"
39
+ "../assets/inertia.svg": "%{js_destination_path}/assets/inertia.svg"
40
+ "../assets/vite_ruby.svg": "%{js_destination_path}/assets/vite_ruby.svg"
41
+ copy_files_ts:
42
+ "InertiaExample.ts.vue": "%{js_destination_path}/pages/InertiaExample.vue"
43
+ "tsconfig.json": "tsconfig.json"
44
+ "tsconfig.app.json": "tsconfig.app.json"
45
+ "tsconfig.node.json": "tsconfig.node.json"
46
+ "vite-env.d.ts": "%{js_destination_path}/vite-env.d.ts"
47
+ copy_files_js:
48
+ "InertiaExample.vue": "%{js_destination_path}/pages/InertiaExample.vue"
49
+
50
+ svelte4:
51
+ inertia_package: "@inertiajs/svelte"
52
+ packages:
53
+ - "svelte@4"
54
+ - "@sveltejs/vite-plugin-svelte@3"
55
+ packages_ts:
56
+ - "@tsconfig/svelte@4"
57
+ - "svelte-check"
58
+ - "typescript"
59
+ - "tslib"
60
+ vite_plugin_import: "import { svelte } from '@sveltejs/vite-plugin-svelte'"
61
+ vite_plugin_call: "svelte()"
62
+ copy_files_ts:
63
+ "InertiaExample.ts.svelte": "%{js_destination_path}/pages/InertiaExample.svelte"
64
+ "tsconfig.json": "tsconfig.json"
65
+ "tsconfig.node.json": "tsconfig.node.json"
66
+ "vite-env.d.ts": "%{js_destination_path}/vite-env.d.ts"
67
+ copy_files_js:
68
+ "InertiaExample.svelte": "%{js_destination_path}/pages/InertiaExample.svelte"
69
+ copy_files:
70
+ "svelte.config.js": "svelte.config.js"
71
+ "../assets/svelte.svg": "%{js_destination_path}/assets/svelte.svg"
72
+ "../assets/inertia.svg": "%{js_destination_path}/assets/inertia.svg"
73
+ "../assets/vite_ruby.svg": "%{js_destination_path}/assets/vite_ruby.svg"
74
+
75
+ svelte:
76
+ inertia_package: "@inertiajs/svelte"
77
+ packages:
78
+ - "svelte@5"
79
+ - "@sveltejs/vite-plugin-svelte@4"
80
+ packages_ts:
81
+ - "@tsconfig/svelte@5"
82
+ - "svelte-check"
83
+ - "typescript"
84
+ - "tslib"
85
+ vite_plugin_import: "import { svelte } from '@sveltejs/vite-plugin-svelte'"
86
+ vite_plugin_call: "svelte()"
87
+ copy_files_ts:
88
+ "InertiaExample.ts.svelte": "%{js_destination_path}/pages/InertiaExample.svelte"
89
+ "tsconfig.json": "tsconfig.json"
90
+ "tsconfig.node.json": "tsconfig.node.json"
91
+ "vite-env.d.ts": "%{js_destination_path}/vite-env.d.ts"
92
+ copy_files_js:
93
+ "InertiaExample.svelte": "%{js_destination_path}/pages/InertiaExample.svelte"
94
+ copy_files:
95
+ "svelte.config.js": "svelte.config.js"
96
+ "../assets/svelte.svg": "%{js_destination_path}/assets/svelte.svg"
97
+ "../assets/inertia.svg": "%{js_destination_path}/assets/inertia.svg"
98
+ "../assets/vite_ruby.svg": "%{js_destination_path}/assets/vite_ruby.svg"
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Inertia
4
+ module Generators
5
+ module Helpers
6
+ ### FS Helpers
7
+ def js_destination_path
8
+ return ViteRuby.config.source_code_dir if defined?(ViteRuby)
9
+
10
+ if file?('config/vite.json')
11
+ source_code_dir = JSON.parse(File.read(file_path('config/vite.json'))).dig('all', 'sourceCodeDir')
12
+ return source_code_dir if source_code_dir
13
+ end
14
+
15
+ 'app/frontend'
16
+ end
17
+
18
+ def js_destination_root
19
+ file_path(js_destination_path)
20
+ end
21
+
22
+ def js_file_path(*relative_path)
23
+ File.join(js_destination_root, *relative_path)
24
+ end
25
+
26
+ def file?(*relative_path)
27
+ File.file?(file_path(*relative_path))
28
+ end
29
+
30
+ def file_path(*relative_path)
31
+ File.join(destination_root, *relative_path)
32
+ end
33
+
34
+ # Interactivity Helpers
35
+ def ask(*)
36
+ unless options[:interactive]
37
+ say_error 'Specify all options when running the generator non-interactively.', :red
38
+ exit(1)
39
+ end
40
+
41
+ super
42
+ end
43
+
44
+ def yes?(*)
45
+ return false unless options[:interactive]
46
+
47
+ super
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,291 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'rails/generators'
5
+ require 'rails/generators/base'
6
+
7
+ require_relative 'helpers'
8
+ require_relative 'js_package_manager'
9
+
10
+ module Inertia
11
+ module Generators
12
+ class InstallGenerator < Rails::Generators::Base
13
+ include Helpers
14
+
15
+ FRAMEWORKS = YAML.load_file(File.expand_path('./frameworks.yml', __dir__))
16
+
17
+ source_root File.expand_path('./templates', __dir__)
18
+
19
+ class_option :framework, type: :string,
20
+ desc: 'The framework you want to use with Inertia',
21
+ enum: FRAMEWORKS.keys,
22
+ default: nil
23
+
24
+ class_option :inertia_version, type: :string, default: 'latest',
25
+ desc: 'The version of Inertia.js to install'
26
+
27
+ class_option :typescript, type: :boolean, default: false,
28
+ desc: 'Whether to use TypeScript'
29
+
30
+ class_option :package_manager, type: :string, default: nil,
31
+ enum: JSPackageManager.package_managers,
32
+ desc: "The package manager you want to use to install Inertia's npm packages"
33
+
34
+ class_option :interactive, type: :boolean, default: true,
35
+ desc: 'Whether to prompt for optional installations'
36
+
37
+ class_option :tailwind, type: :boolean, default: false,
38
+ desc: 'Whether to install Tailwind CSS'
39
+ class_option :vite, type: :boolean, default: false,
40
+ desc: 'Whether to install Vite Ruby'
41
+ class_option :example_page, type: :boolean, default: true,
42
+ desc: 'Whether to add an example Inertia page'
43
+
44
+ class_option :verbose, type: :boolean, default: false,
45
+ desc: 'Run the generator in verbose mode'
46
+
47
+ remove_class_option :skip_namespace, :skip_collision_check
48
+
49
+ def install
50
+ say "Installing Inertia's Rails adapter"
51
+
52
+ if inertia_resolved_version.version == '0'
53
+ say_error "Could not find the Inertia.js package version #{options[:inertia_version]}.", :red
54
+ exit(false)
55
+ end
56
+
57
+ install_vite unless ruby_vite_installed?
58
+
59
+ install_typescript if typescript?
60
+
61
+ install_tailwind if install_tailwind?
62
+
63
+ install_inertia
64
+
65
+ install_example_page if options[:example_page]
66
+
67
+ say 'Copying bin/dev'
68
+ copy_file "#{__dir__}/templates/dev", 'bin/dev'
69
+ chmod 'bin/dev', 0o755, verbose: verbose?
70
+
71
+ say "Inertia's Rails adapter successfully installed", :green
72
+ end
73
+
74
+ private
75
+
76
+ def install_inertia
77
+ say "Adding Inertia's Rails adapter initializer"
78
+ template 'initializer.rb', file_path('config/initializers/inertia_rails.rb')
79
+
80
+ say 'Installing Inertia npm packages'
81
+ add_dependencies(*FRAMEWORKS[framework]['packages'])
82
+ add_dependencies(inertia_package)
83
+
84
+ unless File.read(vite_config_path).include?(FRAMEWORKS[framework]['vite_plugin_import'])
85
+ say "Adding Vite plugin for #{framework}"
86
+ insert_into_file vite_config_path, "\n #{FRAMEWORKS[framework]['vite_plugin_call']},", after: 'plugins: ['
87
+ prepend_file vite_config_path, "#{FRAMEWORKS[framework]['vite_plugin_import']}\n"
88
+ end
89
+
90
+ say "Copying #{inertia_entrypoint} entrypoint"
91
+ template "#{framework}/#{inertia_entrypoint}", js_file_path("entrypoints/#{inertia_entrypoint}")
92
+
93
+ if application_layout.exist?
94
+ say "Adding #{inertia_entrypoint} script tag to the application layout"
95
+ headers = <<-ERB
96
+ <%= #{vite_tag} "inertia" %>
97
+ <%= inertia_ssr_head %>
98
+ ERB
99
+ insert_into_file application_layout.to_s, headers, after: "<%= vite_client_tag %>\n"
100
+
101
+ if framework == 'react' && !application_layout.read.include?('vite_react_refresh_tag')
102
+ say 'Adding Vite React Refresh tag to the application layout'
103
+ insert_into_file application_layout.to_s, "<%= vite_react_refresh_tag %>\n ",
104
+ before: '<%= vite_client_tag %>'
105
+ end
106
+
107
+ gsub_file application_layout.to_s, /<title>/, '<title inertia>' unless svelte?
108
+ else
109
+ say_error 'Could not find the application layout file. Please add the following tags manually:', :red
110
+ say_error '- <title>...</title>'
111
+ say_error '+ <title inertia>...</title>'
112
+ say_error '+ <%= inertia_ssr_head %>'
113
+ say_error '+ <%= vite_react_refresh_tag %>' if framework == 'react'
114
+ say_error "+ <%= #{vite_tag} \"inertia\" %>"
115
+ end
116
+ end
117
+
118
+ def install_typescript
119
+ say 'Adding TypeScript support'
120
+ if svelte? && inertia_resolved_version.release < Gem::Version.new('1.3.0')
121
+ say 'WARNING: @inertiajs/svelte < 1.3.0 does not support TypeScript ' \
122
+ "(resolved version: #{inertia_resolved_version}).",
123
+ :yellow
124
+ say 'Skipping TypeScript support for @inertiajs/svelte', :yellow
125
+ @typescript = false
126
+ return
127
+ end
128
+
129
+ add_dependencies(*FRAMEWORKS[framework]['packages_ts'])
130
+
131
+ say 'Copying adding scripts to package.json'
132
+ run 'npm pkg set scripts.check="svelte-check --tsconfig ./tsconfig.json && tsc -p tsconfig.node.json"' if svelte?
133
+ run 'npm pkg set scripts.check="vue-tsc -p tsconfig.app.json && tsc -p tsconfig.node.json"' if framework == 'vue'
134
+ run 'npm pkg set scripts.check="tsc -p tsconfig.app.json && tsc -p tsconfig.node.json"' if framework == 'react'
135
+ end
136
+
137
+ def install_example_page
138
+ say 'Copying example Inertia controller'
139
+ template 'controller.rb', file_path('app/controllers/inertia_example_controller.rb')
140
+
141
+ say 'Adding a route for the example Inertia controller'
142
+ route "get 'inertia-example', to: 'inertia_example#index'"
143
+
144
+ say 'Copying page assets'
145
+ copy_files = FRAMEWORKS[framework]['copy_files'].merge(
146
+ FRAMEWORKS[framework]["copy_files_#{typescript? ? 'ts' : 'js'}"]
147
+ )
148
+ copy_files.each do |source, destination|
149
+ template "#{framework}/#{source}", file_path(format(destination, js_destination_path: js_destination_path))
150
+ end
151
+ end
152
+
153
+ def install_tailwind
154
+ say 'Installing Tailwind CSS'
155
+ add_dependencies(%w[tailwindcss postcss autoprefixer @tailwindcss/forms @tailwindcss/typography
156
+ @tailwindcss/container-queries])
157
+
158
+ template 'tailwind/tailwind.config.js', file_path('tailwind.config.js')
159
+ copy_file 'tailwind/postcss.config.js', file_path('postcss.config.js')
160
+ copy_file 'tailwind/application.css', js_file_path('entrypoints/application.css')
161
+
162
+ if application_layout.exist?
163
+ say 'Adding Tailwind CSS to the application layout'
164
+ insert_into_file application_layout.to_s, "<%= vite_stylesheet_tag \"application\" %>\n ",
165
+ before: '<%= vite_client_tag %>'
166
+ else
167
+ say_error 'Could not find the application layout file. Please add the following tags manually:', :red
168
+ say_error '+ <%= vite_stylesheet_tag "application" %>' if install_tailwind?
169
+ end
170
+ end
171
+
172
+ def install_vite
173
+ unless install_vite?
174
+ say_error 'This generator only supports Ruby on Rails with Vite.', :red
175
+ exit(false)
176
+ end
177
+
178
+ in_root do
179
+ Bundler.with_original_env do
180
+ if (capture = run('bundle add vite_rails', capture: !verbose?))
181
+ say 'Vite Rails gem successfully installed', :green
182
+ else
183
+ say capture
184
+ say_error 'Failed to install Vite Rails gem', :red
185
+ exit(false)
186
+ end
187
+ if (capture = run('bundle exec vite install', capture: !verbose?))
188
+ say 'Vite Rails successfully installed', :green
189
+ else
190
+ say capture
191
+ say_error 'Failed to install Vite Rails', :red
192
+ exit(false)
193
+ end
194
+ end
195
+ end
196
+ end
197
+
198
+ def ruby_vite_installed?
199
+ return true if package_manager.present? && ruby_vite?
200
+
201
+ if !package_manager.present?
202
+ say_status 'Could not find a package.json file to install Inertia to.', nil
203
+ elsif gem_installed?('webpacker') || gem_installed?('shakapacker')
204
+ say 'Webpacker or Shakapacker is installed.', :yellow
205
+ say 'Vite Ruby can work alongside Webpacker or Shakapacker, but it might cause issues.', :yellow
206
+ say 'Please see the Vite Ruby documentation for the migration guide:', :yellow
207
+ say 'https://vite-ruby.netlify.app/guide/migration.html#webpacker-%F0%9F%93%A6', :yellow
208
+ else
209
+ say_status 'Could not find a Vite configuration files ' \
210
+ '(`config/vite.json` & `vite.config.{ts,js,mjs,cjs,mts,cts}`).',
211
+ nil
212
+ end
213
+ false
214
+ end
215
+
216
+ def gem_installed?(name)
217
+ regex = /^[^#]*gem\s+['"]#{name}['"]/
218
+ File.read(file_path('Gemfile')).match?(regex)
219
+ end
220
+
221
+ def application_layout
222
+ @application_layout ||= Pathname.new(file_path('app/views/layouts/application.html.erb'))
223
+ end
224
+
225
+ def ruby_vite?
226
+ file?('config/vite.json') && vite_config_path
227
+ end
228
+
229
+ def package_manager
230
+ @package_manager ||= JSPackageManager.new(self)
231
+ end
232
+
233
+ def add_dependencies(*packages)
234
+ package_manager.add_dependencies(*packages)
235
+ end
236
+
237
+ def vite_config_path
238
+ @vite_config_path ||= Dir.glob(file_path('vite.config.{ts,js,mjs,cjs,mts,cts}')).first
239
+ end
240
+
241
+ def install_vite?
242
+ return @install_vite if defined?(@install_vite)
243
+
244
+ @install_vite = options[:vite] || yes?('Would you like to install Vite Ruby? (y/n)', :green)
245
+ end
246
+
247
+ def install_tailwind?
248
+ return @install_tailwind if defined?(@install_tailwind)
249
+
250
+ @install_tailwind = options[:tailwind] || yes?('Would you like to install Tailwind CSS? (y/n)', :green)
251
+ end
252
+
253
+ def typescript?
254
+ return @typescript if defined?(@typescript)
255
+
256
+ @typescript = options[:typescript] || yes?('Would you like to use TypeScript? (y/n)', :green)
257
+ end
258
+
259
+ def inertia_entrypoint
260
+ "inertia.#{typescript? ? 'ts' : 'js'}"
261
+ end
262
+
263
+ def vite_tag
264
+ typescript? ? 'vite_typescript_tag' : 'vite_javascript_tag'
265
+ end
266
+
267
+ def inertia_resolved_version
268
+ @inertia_resolved_version ||= Gem::Version.new(
269
+ `npm show @inertiajs/core@#{options[:inertia_version]} version`.strip
270
+ )
271
+ end
272
+
273
+ def verbose?
274
+ options[:verbose]
275
+ end
276
+
277
+ def svelte?
278
+ framework.start_with? 'svelte'
279
+ end
280
+
281
+ def inertia_package
282
+ "#{FRAMEWORKS[framework]['inertia_package']}@#{options[:inertia_version]}"
283
+ end
284
+
285
+ def framework
286
+ @framework ||= options[:framework] || ask('What framework do you want to use with Inertia?', :green,
287
+ limited_to: FRAMEWORKS.keys, default: 'react')
288
+ end
289
+ end
290
+ end
291
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Inertia
4
+ module Generators
5
+ class JSPackageManager
6
+ def self.package_managers
7
+ %w[npm yarn bun pnpm]
8
+ end
9
+
10
+ def initialize(generator)
11
+ @generator = generator
12
+ end
13
+
14
+ def present?
15
+ package_manager.present?
16
+ end
17
+
18
+ def add_dependencies(*dependencies)
19
+ options = @generator.options[:verbose] ? '' : ' --silent'
20
+ @generator.in_root do
21
+ @generator.run "#{package_manager} add #{dependencies.join(' ')}#{options}"
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def package_manager
28
+ @package_manager ||= @generator.options[:package_manager] || detect_package_manager
29
+ end
30
+
31
+ def detect_package_manager
32
+ return nil unless file?('package.json')
33
+
34
+ if file?('package-lock.json')
35
+ 'npm'
36
+ elsif file?('bun.lockb')
37
+ 'bun'
38
+ elsif file?('pnpm-lock.yaml')
39
+ 'pnpm'
40
+ else
41
+ 'yarn'
42
+ end
43
+ end
44
+
45
+ def file?(*relative_path)
46
+ @generator.file?(*relative_path)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1 @@
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>
@@ -0,0 +1 @@
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>
@@ -0,0 +1 @@
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>
@@ -0,0 +1 @@
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>
@@ -0,0 +1 @@
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,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class InertiaExampleController < ApplicationController
2
4
  def index
3
5
  render inertia: 'InertiaExample', props: {
4
- name: 'World',
6
+ name: params.fetch(:name, 'World'),
5
7
  }
6
8
  end
7
9
  end
@@ -0,0 +1,23 @@
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 "$@"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ InertiaRails.configure do |config|
4
+ config.ssr_enabled = ViteRuby.config.ssr_build_enabled
5
+ config.version = ViteRuby.digest
6
+ end