inertia_rails-contrib 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +12 -134
  4. data/lib/inertia_rails_contrib/version.rb +1 -1
  5. metadata +5 -134
  6. data/lib/generators/inertia/controller/controller_generator.rb +0 -16
  7. data/lib/generators/inertia/controller/templates/controller.rb.tt +0 -10
  8. data/lib/generators/inertia/install/frameworks.yml +0 -98
  9. data/lib/generators/inertia/install/helpers.rb +0 -48
  10. data/lib/generators/inertia/install/install_generator.rb +0 -286
  11. data/lib/generators/inertia/install/templates/assets/inertia.svg +0 -1
  12. data/lib/generators/inertia/install/templates/assets/react.svg +0 -1
  13. data/lib/generators/inertia/install/templates/assets/svelte.svg +0 -1
  14. data/lib/generators/inertia/install/templates/assets/vite_ruby.svg +0 -1
  15. data/lib/generators/inertia/install/templates/assets/vue.svg +0 -1
  16. data/lib/generators/inertia/install/templates/controller.rb +0 -7
  17. data/lib/generators/inertia/install/templates/dev +0 -23
  18. data/lib/generators/inertia/install/templates/initializer.rb +0 -4
  19. data/lib/generators/inertia/install/templates/react/InertiaExample.jsx +0 -60
  20. data/lib/generators/inertia/install/templates/react/InertiaExample.module.css +0 -80
  21. data/lib/generators/inertia/install/templates/react/InertiaExample.tsx +0 -60
  22. data/lib/generators/inertia/install/templates/react/inertia.js +0 -34
  23. data/lib/generators/inertia/install/templates/react/inertia.ts +0 -36
  24. data/lib/generators/inertia/install/templates/react/tsconfig.app.json +0 -27
  25. data/lib/generators/inertia/install/templates/react/tsconfig.json +0 -11
  26. data/lib/generators/inertia/install/templates/react/tsconfig.node.json +0 -13
  27. data/lib/generators/inertia/install/templates/react/vite-env.d.ts +0 -1
  28. data/lib/generators/inertia/install/templates/svelte/InertiaExample.svelte +0 -112
  29. data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +0 -112
  30. data/lib/generators/inertia/install/templates/svelte/inertia.js +0 -30
  31. data/lib/generators/inertia/install/templates/svelte/inertia.ts +0 -30
  32. data/lib/generators/inertia/install/templates/svelte/svelte.config.js +0 -7
  33. data/lib/generators/inertia/install/templates/svelte/tsconfig.json +0 -21
  34. data/lib/generators/inertia/install/templates/svelte/tsconfig.node.json +0 -12
  35. data/lib/generators/inertia/install/templates/svelte/vite-env.d.ts +0 -2
  36. data/lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte +0 -116
  37. data/lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte +0 -116
  38. data/lib/generators/inertia/install/templates/svelte4/inertia.js +0 -29
  39. data/lib/generators/inertia/install/templates/svelte4/inertia.ts +0 -29
  40. data/lib/generators/inertia/install/templates/svelte4/svelte.config.js +0 -7
  41. data/lib/generators/inertia/install/templates/svelte4/tsconfig.json +0 -21
  42. data/lib/generators/inertia/install/templates/svelte4/tsconfig.node.json +0 -12
  43. data/lib/generators/inertia/install/templates/svelte4/vite-env.d.ts +0 -2
  44. data/lib/generators/inertia/install/templates/tailwind/application.css +0 -13
  45. data/lib/generators/inertia/install/templates/tailwind/postcss.config.js +0 -6
  46. data/lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt +0 -18
  47. data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +0 -117
  48. data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +0 -117
  49. data/lib/generators/inertia/install/templates/vue/inertia.js +0 -33
  50. data/lib/generators/inertia/install/templates/vue/inertia.ts +0 -33
  51. data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +0 -24
  52. data/lib/generators/inertia/install/templates/vue/tsconfig.json +0 -11
  53. data/lib/generators/inertia/install/templates/vue/tsconfig.node.json +0 -22
  54. data/lib/generators/inertia/install/templates/vue/vite-env.d.ts +0 -1
  55. data/lib/generators/inertia/scaffold/scaffold_generator.rb +0 -16
  56. data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +0 -56
  57. data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +0 -100
  58. data/lib/generators/inertia_templates/controller/controller_generator.rb +0 -12
  59. data/lib/generators/inertia_templates/controller/templates/react/view.jsx.tt +0 -8
  60. data/lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt +0 -2
  61. data/lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt +0 -2
  62. data/lib/generators/inertia_templates/controller/templates/vue/view.vue.tt +0 -4
  63. data/lib/generators/inertia_templates/scaffold/scaffold_generator.rb +0 -12
  64. data/lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt +0 -35
  65. data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +0 -111
  66. data/lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt +0 -26
  67. data/lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt +0 -27
  68. data/lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt +0 -26
  69. data/lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt +0 -39
  70. data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -36
  71. data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +0 -98
  72. data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt +0 -35
  73. data/lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt +0 -29
  74. data/lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
  75. data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt +0 -41
  76. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.svelte.tt +0 -37
  77. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt +0 -96
  78. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt +0 -36
  79. data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.svelte.tt +0 -30
  80. data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt +0 -28
  81. data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt +0 -46
  82. data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt +0 -36
  83. data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +0 -94
  84. data/lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt +0 -31
  85. data/lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt +0 -29
  86. data/lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt +0 -26
  87. data/lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt +0 -44
  88. data/lib/generators/inertia_tw_templates/controller/controller_generator.rb +0 -12
  89. data/lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt +0 -8
  90. data/lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt +0 -2
  91. data/lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt +0 -2
  92. data/lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt +0 -4
  93. data/lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb +0 -12
  94. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt +0 -42
  95. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +0 -122
  96. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt +0 -43
  97. data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt +0 -30
  98. data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt +0 -26
  99. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt +0 -54
  100. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -44
  101. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +0 -119
  102. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt +0 -42
  103. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt +0 -32
  104. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
  105. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt +0 -57
  106. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.svelte.tt +0 -45
  107. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt +0 -120
  108. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt +0 -43
  109. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.svelte.tt +0 -33
  110. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt +0 -28
  111. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt +0 -58
  112. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt +0 -44
  113. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt +0 -127
  114. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt +0 -43
  115. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt +0 -32
  116. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt +0 -26
  117. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt +0 -56
  118. data/lib/inertia_rails_contrib/generators/controller_template_base.rb +0 -56
  119. data/lib/inertia_rails_contrib/generators/scaffold_template_base.rb +0 -35
  120. data/lib/inertia_rails_contrib/generators_helper.rb +0 -89
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27c11a71a3acff524328e14dd27d4265a5365a113a58ae636b6877dbfb294d12
4
- data.tar.gz: 8150b80e446aebe35e9e5a58026d2d633ce06c693254c2849229ceeee0f30a1a
3
+ metadata.gz: c5dca7d6390241ca5da0909ccd2cdb516228c3e35c2db48f97950de6e7299c25
4
+ data.tar.gz: 502c67ce0772ef78e96860a21516ca7cfe185ef30b9db1059a79d328257ac4b2
5
5
  SHA512:
6
- metadata.gz: c2c94b176f794229063106b9ca1bd28a73c0b766cb657479bc75656cbc2ef4de74e94a85c61aaa64e1ae20e6659bc5cf9923c1c75fd069f224e0403eb63fab74
7
- data.tar.gz: c3030cd27b25dbc309d6e3ea7a2b410563b794724fad3f7043a53d86430ea8b1fae7eb122c62bfdaa69bf9301e0da9fdec7525f114c7e98df825eee0877ff1c5
6
+ metadata.gz: 96a9dd14f7d57b52832c685221d92efd1354e5a8e8bfdc6edd46746434aba4ba67094635a5104625eabff34bd78cd01abffeaee043365418fc0a86a81d9b0e88
7
+ data.tar.gz: 1e2ea3af72ae494d24e6d95ecb9df09adf92e87d0ebbe2dffeee3293b4e7fcaa157fea0edd2c67b10944e553d71c6fa2642ee2197652441e43a9c671d9c8c2cd
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2024-12-23
11
+
12
+ Changed:
13
+
14
+ - Generators are upstreamed to the `inertia_rails` gem ([@skryukov])
15
+
10
16
  ## [0.3.0] - 2024-10-25
11
17
 
12
18
  Added:
data/README.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # InertiaRailsContrib
2
2
 
3
- A collection of extensions, developer tools, and the [community documentation](https://inertia-rails.netlify.app) for [Inertia's Rails adapter](https://github.com/inertiajs/inertia-rails).
3
+ > Community documentation and generators has been upstreamed to the [Inertia Rails repository](https://github.com/inertiajs/inertia-rails).
4
+ >
5
+ > Please visit the official Inertia Rails documentation at https://inertia-rails.dev.
6
+
7
+ From now on we're planning to use `InertiaRailsContrib` as a playground for new features and ideas.
8
+ The gem will be updated with new features and improvements, and then the most successful ones will be proposed to the core Inertia Rails repository.
9
+
10
+ Future plans:
11
+ - Ruby LSP plugin for Inertia Rails
12
+ - Modals support
13
+
14
+ Stay tuned!
4
15
 
5
16
  <a href="https://evilmartians.com/?utm_source=inertia_rails-contrib&utm_campaign=project_page">
6
17
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Built by Evil Martians" width="236" height="54">
@@ -16,139 +27,6 @@ If bundler is not being used to manage dependencies, install the gem by executin
16
27
 
17
28
  $ gem install inertia_rails-contrib
18
29
 
19
- ## Usage
20
-
21
- ### Installation generator
22
-
23
- `InertiaRailsContrib` comes with a generator that installs and sets up Inertia in a Rails application. It automatically detects if the [Vite Rails](https://vite-ruby.netlify.app/guide/rails.html) gem is installed and will attempt to install it if not present.
24
-
25
- To install and setup Inertia in a Rails application, execute the following command in the terminal:
26
-
27
- ```bash
28
- bundle add inertia_rails-contrib
29
- bin/rails generate inertia:install
30
- ```
31
-
32
- This command will:
33
- - Check for Vite Rails and install it if not present
34
- - Ask if you want to use TypeScript
35
- - Ask you to choose your preferred frontend framework (React, Vue, Svelte 4, or Svelte 5)
36
- - Ask if you want to install Tailwind CSS
37
- - Install necessary dependencies
38
- - Set up the application to work with Inertia
39
- - Copy example Inertia controller and views (can be skipped with the `--skip-example` option)
40
-
41
- Example output:
42
-
43
- ```bash
44
- $ bin/rails generate inertia:install
45
- Installing Inertia's Rails adapter
46
- Could not find a package.json file to install Inertia to.
47
- Would you like to install Vite Ruby? (y/n) y
48
- run bundle add vite_rails from "."
49
- Vite Rails gem successfully installed
50
- run bundle exec vite install from "."
51
- Vite Rails successfully installed
52
- Would you like to use TypeScript? (y/n) y
53
- Adding TypeScript support
54
- What framework do you want to use with Inertia? [react, vue, svelte4, svelte] (react)
55
- run npm add @types/react @types/react-dom typescript --silent from "."
56
- Would you like to install Tailwind CSS? (y/n) y
57
- Installing Tailwind CSS
58
- run npm add tailwindcss postcss autoprefixer @tailwindcss/forms @tailwindcss/typography @tailwindcss/container-queries --silent from "."
59
- create tailwind.config.js
60
- create postcss.config.js
61
- create app/frontend/entrypoints/application.css
62
- Adding Tailwind CSS to the application layout
63
- insert app/views/layouts/application.html.erb
64
- Adding Inertia's Rails adapter initializer
65
- create config/initializers/inertia_rails.rb
66
- Installing Inertia npm packages
67
- run npm add @vitejs/plugin-react react react-dom --silent from "."
68
- run npm add @inertiajs/react@latest --silent from "."
69
- Adding Vite plugin for react
70
- insert vite.config.ts
71
- prepend vite.config.ts
72
- Copying inertia.ts entrypoint
73
- create app/frontend/entrypoints/inertia.ts
74
- Adding inertia.ts script tag to the application layout
75
- insert app/views/layouts/application.html.erb
76
- Adding Vite React Refresh tag to the application layout
77
- insert app/views/layouts/application.html.erb
78
- gsub app/views/layouts/application.html.erb
79
- Copying example Inertia controller
80
- create app/controllers/inertia_example_controller.rb
81
- Adding a route for the example Inertia controller
82
- route get 'inertia-example', to: 'inertia_example#index'
83
- Copying page assets
84
- create app/frontend/pages/InertiaExample.module.css
85
- create app/frontend/assets/react.svg
86
- create app/frontend/assets/inertia.svg
87
- create app/frontend/assets/vite_ruby.svg
88
- create app/frontend/pages/InertiaExample.tsx
89
- create tsconfig.json
90
- create tsconfig.app.json
91
- create tsconfig.node.json
92
- create app/frontend/vite-env.d.ts
93
- Copying bin/dev
94
- create bin/dev
95
- Inertia's Rails adapter successfully installed
96
- ```
97
-
98
- With that done, you can now start the Rails server and the Vite development server (we recommend using [Overmind](https://github.com/DarthSim/overmind)):
99
-
100
- ```bash
101
- bin/dev
102
- ```
103
-
104
- And navigate to `http://localhost:3100/inertia-example` to see the example Inertia page.
105
-
106
- ### Scaffold generator
107
-
108
- `InertiaRailsContrib` also comes with a scaffold generator that generates a new resource with Inertia responses. To use it, execute the following command in the terminal:
109
-
110
- ```bash
111
- bin/rails generate inertia:scaffold ModelName field1:type field2:type
112
- ```
113
-
114
- Example output:
115
-
116
- ```bash
117
- $ bin/rails generate inertia:scaffold Post title:string body:text
118
- invoke active_record
119
- create db/migrate/20240611123952_create_posts.rb
120
- create app/models/post.rb
121
- invoke test_unit
122
- create test/models/post_test.rb
123
- create test/fixtures/posts.yml
124
- invoke resource_route
125
- route resources :posts
126
- invoke scaffold_controller
127
- create app/controllers/posts_controller.rb
128
- invoke inertia_templates
129
- create app/frontend/pages/Post
130
- create app/frontend/pages/Post/Index.svelte
131
- create app/frontend/pages/Post/Edit.svelte
132
- create app/frontend/pages/Post/Show.svelte
133
- create app/frontend/pages/Post/New.svelte
134
- create app/frontend/pages/Post/Form.svelte
135
- create app/frontend/pages/Post/Post.svelte
136
- invoke resource_route
137
- invoke test_unit
138
- create test/controllers/posts_controller_test.rb
139
- create test/system/posts_test.rb
140
- invoke helper
141
- create app/helpers/posts_helper.rb
142
- invoke test_unit
143
- ```
144
-
145
- #### Tailwind CSS integration
146
-
147
- `InertiaRailsContrib` tries to detect the presence of Tailwind CSS in the application and generate the templates accordingly. If you want to specify templates type, use the `--inertia-templates` option:
148
-
149
- - `inertia_templates` - default
150
- - `inertia_tw_templates` - Tailwind CSS
151
-
152
30
  ## Development
153
31
 
154
32
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InertiaRailsContrib
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inertia_rails-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-25 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: railties
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 6.0.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 6.0.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: inertia_rails
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: 3.5.0
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: 3.5.0
41
27
  description: A collection of extensions and developer tools for Rails Inertia adapter
42
28
  email:
43
29
  - me@skryukov.dev
@@ -48,123 +34,8 @@ files:
48
34
  - CHANGELOG.md
49
35
  - LICENSE.txt
50
36
  - README.md
51
- - lib/generators/inertia/controller/controller_generator.rb
52
- - lib/generators/inertia/controller/templates/controller.rb.tt
53
- - lib/generators/inertia/install/frameworks.yml
54
- - lib/generators/inertia/install/helpers.rb
55
- - lib/generators/inertia/install/install_generator.rb
56
- - lib/generators/inertia/install/templates/assets/inertia.svg
57
- - lib/generators/inertia/install/templates/assets/react.svg
58
- - lib/generators/inertia/install/templates/assets/svelte.svg
59
- - lib/generators/inertia/install/templates/assets/vite_ruby.svg
60
- - lib/generators/inertia/install/templates/assets/vue.svg
61
- - lib/generators/inertia/install/templates/controller.rb
62
- - lib/generators/inertia/install/templates/dev
63
- - lib/generators/inertia/install/templates/initializer.rb
64
- - lib/generators/inertia/install/templates/react/InertiaExample.jsx
65
- - lib/generators/inertia/install/templates/react/InertiaExample.module.css
66
- - lib/generators/inertia/install/templates/react/InertiaExample.tsx
67
- - lib/generators/inertia/install/templates/react/inertia.js
68
- - lib/generators/inertia/install/templates/react/inertia.ts
69
- - lib/generators/inertia/install/templates/react/tsconfig.app.json
70
- - lib/generators/inertia/install/templates/react/tsconfig.json
71
- - lib/generators/inertia/install/templates/react/tsconfig.node.json
72
- - lib/generators/inertia/install/templates/react/vite-env.d.ts
73
- - lib/generators/inertia/install/templates/svelte/InertiaExample.svelte
74
- - lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte
75
- - lib/generators/inertia/install/templates/svelte/inertia.js
76
- - lib/generators/inertia/install/templates/svelte/inertia.ts
77
- - lib/generators/inertia/install/templates/svelte/svelte.config.js
78
- - lib/generators/inertia/install/templates/svelte/tsconfig.json
79
- - lib/generators/inertia/install/templates/svelte/tsconfig.node.json
80
- - lib/generators/inertia/install/templates/svelte/vite-env.d.ts
81
- - lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte
82
- - lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte
83
- - lib/generators/inertia/install/templates/svelte4/inertia.js
84
- - lib/generators/inertia/install/templates/svelte4/inertia.ts
85
- - lib/generators/inertia/install/templates/svelte4/svelte.config.js
86
- - lib/generators/inertia/install/templates/svelte4/tsconfig.json
87
- - lib/generators/inertia/install/templates/svelte4/tsconfig.node.json
88
- - lib/generators/inertia/install/templates/svelte4/vite-env.d.ts
89
- - lib/generators/inertia/install/templates/tailwind/application.css
90
- - lib/generators/inertia/install/templates/tailwind/postcss.config.js
91
- - lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt
92
- - lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue
93
- - lib/generators/inertia/install/templates/vue/InertiaExample.vue
94
- - lib/generators/inertia/install/templates/vue/inertia.js
95
- - lib/generators/inertia/install/templates/vue/inertia.ts
96
- - lib/generators/inertia/install/templates/vue/tsconfig.app.json
97
- - lib/generators/inertia/install/templates/vue/tsconfig.json
98
- - lib/generators/inertia/install/templates/vue/tsconfig.node.json
99
- - lib/generators/inertia/install/templates/vue/vite-env.d.ts
100
- - lib/generators/inertia/scaffold/scaffold_generator.rb
101
- - lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb
102
- - lib/generators/inertia/scaffold_controller/templates/controller.rb.tt
103
- - lib/generators/inertia_templates/controller/controller_generator.rb
104
- - lib/generators/inertia_templates/controller/templates/react/view.jsx.tt
105
- - lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt
106
- - lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt
107
- - lib/generators/inertia_templates/controller/templates/vue/view.vue.tt
108
- - lib/generators/inertia_templates/scaffold/scaffold_generator.rb
109
- - lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
110
- - lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt
111
- - lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt
112
- - lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt
113
- - lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt
114
- - lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt
115
- - lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt
116
- - lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt
117
- - lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt
118
- - lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt
119
- - lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt
120
- - lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt
121
- - lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.svelte.tt
122
- - lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt
123
- - lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt
124
- - lib/generators/inertia_templates/scaffold/templates/svelte4/New.svelte.tt
125
- - lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt
126
- - lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt
127
- - lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt
128
- - lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt
129
- - lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt
130
- - lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt
131
- - lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt
132
- - lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt
133
- - lib/generators/inertia_tw_templates/controller/controller_generator.rb
134
- - lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt
135
- - lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt
136
- - lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt
137
- - lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt
138
- - lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb
139
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt
140
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt
141
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt
142
- - lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
143
- - lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt
144
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt
145
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt
146
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt
147
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt
148
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt
149
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt
150
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt
151
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.svelte.tt
152
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt
153
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt
154
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.svelte.tt
155
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt
156
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt
157
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt
158
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt
159
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt
160
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt
161
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt
162
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt
163
37
  - lib/inertia_rails-contrib.rb
164
38
  - lib/inertia_rails_contrib.rb
165
- - lib/inertia_rails_contrib/generators/controller_template_base.rb
166
- - lib/inertia_rails_contrib/generators/scaffold_template_base.rb
167
- - lib/inertia_rails_contrib/generators_helper.rb
168
39
  - lib/inertia_rails_contrib/version.rb
169
40
  homepage: https://github.com/skryukov/inertia_rails-contrib
170
41
  licenses:
@@ -191,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
62
  - !ruby/object:Gem::Version
192
63
  version: '0'
193
64
  requirements: []
194
- rubygems_version: 3.5.17
65
+ rubygems_version: 3.5.23
195
66
  signing_key:
196
67
  specification_version: 4
197
68
  summary: A collection of extensions and developer tools for Rails Inertia adapter
@@ -1,16 +0,0 @@
1
- require "rails/generators/rails/controller/controller_generator"
2
- require "inertia_rails_contrib/generators_helper"
3
-
4
- module Inertia
5
- module Generators
6
- class ControllerGenerator < Rails::Generators::ControllerGenerator
7
- include InertiaRailsContrib::GeneratorsHelper
8
-
9
- source_root File.expand_path("./templates", __dir__)
10
-
11
- remove_hook_for :template_engine
12
-
13
- hook_for :inertia_templates, required: true, default: InertiaRailsContrib::GeneratorsHelper.guess_inertia_template
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
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 -%>
@@ -1,98 +0,0 @@
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"
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"
@@ -1,48 +0,0 @@
1
- module Inertia
2
- module Generators
3
- module Helpers
4
- ### FS Helpers
5
- def js_destination_path
6
- return ViteRuby.config.source_code_dir if defined?(ViteRuby)
7
- if file?("config/vite.json")
8
- source_code_dir = JSON.parse(File.read(file_path("config/vite.json"))).dig("all", "sourceCodeDir")
9
- return source_code_dir if source_code_dir
10
- end
11
-
12
- "app/frontend"
13
- end
14
-
15
- def js_destination_root
16
- file_path(js_destination_path)
17
- end
18
-
19
- def js_file_path(*relative_path)
20
- File.join(js_destination_root, *relative_path)
21
- end
22
-
23
- def file?(*relative_path)
24
- File.file?(file_path(*relative_path))
25
- end
26
-
27
- def file_path(*relative_path)
28
- File.join(destination_root, *relative_path)
29
- end
30
-
31
- # Interactivity Helpers
32
- def ask(*)
33
- unless options[:interactive]
34
- say_error "Specify all options when running the generator non-interactively.", :red
35
- exit(1)
36
- end
37
-
38
- super
39
- end
40
-
41
- def yes?(*)
42
- return false unless options[:interactive]
43
-
44
- super
45
- end
46
- end
47
- end
48
- end