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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -1
  3. data/README.md +12 -133
  4. data/lib/inertia_rails_contrib/version.rb +1 -1
  5. metadata +5 -112
  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 -73
  9. data/lib/generators/inertia/install/helpers.rb +0 -48
  10. data/lib/generators/inertia/install/install_generator.rb +0 -282
  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 -116
  29. data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +0 -116
  30. data/lib/generators/inertia/install/templates/svelte/inertia.js +0 -29
  31. data/lib/generators/inertia/install/templates/svelte/inertia.ts +0 -32
  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/tailwind/application.css +0 -13
  37. data/lib/generators/inertia/install/templates/tailwind/postcss.config.js +0 -6
  38. data/lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt +0 -18
  39. data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +0 -117
  40. data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +0 -117
  41. data/lib/generators/inertia/install/templates/vue/inertia.js +0 -33
  42. data/lib/generators/inertia/install/templates/vue/inertia.ts +0 -33
  43. data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +0 -24
  44. data/lib/generators/inertia/install/templates/vue/tsconfig.json +0 -11
  45. data/lib/generators/inertia/install/templates/vue/tsconfig.node.json +0 -22
  46. data/lib/generators/inertia/install/templates/vue/vite-env.d.ts +0 -1
  47. data/lib/generators/inertia/scaffold/scaffold_generator.rb +0 -16
  48. data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +0 -56
  49. data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +0 -100
  50. data/lib/generators/inertia_templates/controller/controller_generator.rb +0 -12
  51. data/lib/generators/inertia_templates/controller/templates/react/view.jsx.tt +0 -8
  52. data/lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt +0 -2
  53. data/lib/generators/inertia_templates/controller/templates/vue/view.vue.tt +0 -4
  54. data/lib/generators/inertia_templates/scaffold/scaffold_generator.rb +0 -12
  55. data/lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt +0 -35
  56. data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +0 -111
  57. data/lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt +0 -26
  58. data/lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt +0 -27
  59. data/lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt +0 -26
  60. data/lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt +0 -39
  61. data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -37
  62. data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +0 -96
  63. data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt +0 -42
  64. data/lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt +0 -30
  65. data/lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
  66. data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt +0 -46
  67. data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt +0 -36
  68. data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +0 -94
  69. data/lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt +0 -31
  70. data/lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt +0 -29
  71. data/lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt +0 -26
  72. data/lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt +0 -44
  73. data/lib/generators/inertia_tw_templates/controller/controller_generator.rb +0 -12
  74. data/lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt +0 -8
  75. data/lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt +0 -2
  76. data/lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt +0 -4
  77. data/lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb +0 -12
  78. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt +0 -42
  79. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +0 -122
  80. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt +0 -43
  81. data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt +0 -30
  82. data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt +0 -26
  83. data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt +0 -54
  84. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt +0 -45
  85. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +0 -120
  86. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt +0 -49
  87. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt +0 -33
  88. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt +0 -28
  89. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt +0 -58
  90. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt +0 -44
  91. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt +0 -127
  92. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt +0 -43
  93. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt +0 -32
  94. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt +0 -26
  95. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt +0 -56
  96. data/lib/inertia_rails_contrib/generators/controller_template_base.rb +0 -56
  97. data/lib/inertia_rails_contrib/generators/scaffold_template_base.rb +0 -35
  98. data/lib/inertia_rails_contrib/generators_helper.rb +0 -88
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 918249a8473355fbcec2ce48a47c56a468601587623ff25a684b9d168f3405e1
4
- data.tar.gz: 06a83350918c230d4006b8be40a763a444d26d8aee7133967342d4f5bcb77e27
3
+ metadata.gz: c5dca7d6390241ca5da0909ccd2cdb516228c3e35c2db48f97950de6e7299c25
4
+ data.tar.gz: 502c67ce0772ef78e96860a21516ca7cfe185ef30b9db1059a79d328257ac4b2
5
5
  SHA512:
6
- metadata.gz: 53145888f043896709756bc40a08c86c7d57e947952d3ec0f84040ec766695c6b0815f1d13ed74301fd7c5a6e93b62bc9cf455b444e2607e517d90c4e38d6ed4
7
- data.tar.gz: d7986308cd3c945a3ac65ff44b363dd56c11bb1c8f2dda893fbfdcc7e2e71a6e6d0b0478c239f30722afed4f2528ee5dc49b619c717f30945392f39581bef6d7
6
+ metadata.gz: 96a9dd14f7d57b52832c685221d92efd1354e5a8e8bfdc6edd46746434aba4ba67094635a5104625eabff34bd78cd01abffeaee043365418fc0a86a81d9b0e88
7
+ data.tar.gz: 1e2ea3af72ae494d24e6d95ecb9df09adf92e87d0ebbe2dffeee3293b4e7fcaa157fea0edd2c67b10944e553d71c6fa2642ee2197652441e43a9c671d9c8c2cd
data/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ 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
+
16
+ ## [0.3.0] - 2024-10-25
17
+
18
+ Added:
19
+
20
+ - [BREAKING] Svelte 5 support ([@skryukov])
21
+ - The `--framework=svelte` option now installs Svelte 5
22
+ - New `--framework=svelte4` option installs Svelte 4
23
+ - Support for Svelte 5 in the installation generator
24
+ - Support for Svelte 5 in the scaffold templates
25
+
10
26
  ## [0.2.2] - 2024-10-09
11
27
 
12
28
  Added:
@@ -62,7 +78,8 @@ Added:
62
78
  [@Shaglock]: https://github.com/Shaglock
63
79
  [@skryukov]: https://github.com/skryukov
64
80
 
65
- [Unreleased]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.2.2...HEAD
81
+ [Unreleased]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.3.0...HEAD
82
+ [0.3.0]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.2.2...v0.3.0
66
83
  [0.2.2]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.2.1...v0.2.2
67
84
  [0.2.1]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.2.0...v0.2.1
68
85
  [0.2.0]: https://github.com/skryukov/inertia_rails-contrib/compare/v0.1.1...v0.2.0
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,138 +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 you to choose your preferred frontend framework (React, Vue, or Svelte)
35
- - Ask if you want to install Tailwind CSS
36
- - Install necessary dependencies
37
- - Set up the application to work with Inertia
38
- - Copy example Inertia controller and views (can be skipped with the `--skip-example` option)
39
-
40
- Example output:
41
-
42
- ```bash
43
- $ bin/rails generate inertia:install
44
- Installing Inertia's Rails adapter
45
- Could not find a package.json file to install Inertia to.
46
- Would you like to install Vite Ruby? (y/n) y
47
- run bundle add vite_rails from "."
48
- Vite Rails gem successfully installed
49
- run bundle exec vite install from "."
50
- Vite Rails successfully installed
51
- Would you like to use TypeScript? (y/n) y
52
- Adding TypeScript support
53
- What framework do you want to use with Inertia? [react, vue, svelte] (react)
54
- run npm add @types/react @types/react-dom typescript --silent from "."
55
- Would you like to install Tailwind CSS? (y/n) y
56
- Installing Tailwind CSS
57
- run npm add tailwindcss postcss autoprefixer @tailwindcss/forms @tailwindcss/typography @tailwindcss/container-queries --silent from "."
58
- create tailwind.config.js
59
- create postcss.config.js
60
- create app/frontend/entrypoints/application.css
61
- Adding Tailwind CSS to the application layout
62
- insert app/views/layouts/application.html.erb
63
- Adding Inertia's Rails adapter initializer
64
- create config/initializers/inertia_rails.rb
65
- Installing Inertia npm packages
66
- run npm add @vitejs/plugin-react react react-dom --silent from "."
67
- run npm add @inertiajs/react@latest --silent from "."
68
- Adding Vite plugin for react
69
- insert vite.config.ts
70
- prepend vite.config.ts
71
- Copying inertia.ts entrypoint
72
- create app/frontend/entrypoints/inertia.ts
73
- Adding inertia.ts script tag to the application layout
74
- insert app/views/layouts/application.html.erb
75
- Adding Vite React Refresh tag to the application layout
76
- insert app/views/layouts/application.html.erb
77
- gsub app/views/layouts/application.html.erb
78
- Copying example Inertia controller
79
- create app/controllers/inertia_example_controller.rb
80
- Adding a route for the example Inertia controller
81
- route get 'inertia-example', to: 'inertia_example#index'
82
- Copying page assets
83
- create app/frontend/pages/InertiaExample.module.css
84
- create app/frontend/assets/react.svg
85
- create app/frontend/assets/inertia.svg
86
- create app/frontend/assets/vite_ruby.svg
87
- create app/frontend/pages/InertiaExample.tsx
88
- create tsconfig.json
89
- create tsconfig.app.json
90
- create tsconfig.node.json
91
- create app/frontend/vite-env.d.ts
92
- Copying bin/dev
93
- create bin/dev
94
- Inertia's Rails adapter successfully installed
95
- ```
96
-
97
- With that done, you can now start the Rails server and the Vite development server (we recommend using [Overmind](https://github.com/DarthSim/overmind)):
98
-
99
- ```bash
100
- bin/dev
101
- ```
102
-
103
- And navigate to `http://localhost:3100/inertia-example` to see the example Inertia page.
104
-
105
- ### Scaffold generator
106
-
107
- `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:
108
-
109
- ```bash
110
- bin/rails generate inertia:scaffold ModelName field1:type field2:type
111
- ```
112
-
113
- Example output:
114
-
115
- ```bash
116
- $ bin/rails generate inertia:scaffold Post title:string body:text
117
- invoke active_record
118
- create db/migrate/20240611123952_create_posts.rb
119
- create app/models/post.rb
120
- invoke test_unit
121
- create test/models/post_test.rb
122
- create test/fixtures/posts.yml
123
- invoke resource_route
124
- route resources :posts
125
- invoke scaffold_controller
126
- create app/controllers/posts_controller.rb
127
- invoke inertia_templates
128
- create app/frontend/pages/Post
129
- create app/frontend/pages/Post/Index.svelte
130
- create app/frontend/pages/Post/Edit.svelte
131
- create app/frontend/pages/Post/Show.svelte
132
- create app/frontend/pages/Post/New.svelte
133
- create app/frontend/pages/Post/Form.svelte
134
- create app/frontend/pages/Post/Post.svelte
135
- invoke resource_route
136
- invoke test_unit
137
- create test/controllers/posts_controller_test.rb
138
- create test/system/posts_test.rb
139
- invoke helper
140
- create app/helpers/posts_helper.rb
141
- invoke test_unit
142
- ```
143
-
144
- #### Tailwind CSS integration
145
-
146
- `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:
147
-
148
- - `inertia_templates` - default
149
- - `inertia_tw_templates` - Tailwind CSS
150
-
151
30
  ## Development
152
31
 
153
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.2.2"
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.2.2
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-09 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,101 +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/tailwind/application.css
82
- - lib/generators/inertia/install/templates/tailwind/postcss.config.js
83
- - lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt
84
- - lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue
85
- - lib/generators/inertia/install/templates/vue/InertiaExample.vue
86
- - lib/generators/inertia/install/templates/vue/inertia.js
87
- - lib/generators/inertia/install/templates/vue/inertia.ts
88
- - lib/generators/inertia/install/templates/vue/tsconfig.app.json
89
- - lib/generators/inertia/install/templates/vue/tsconfig.json
90
- - lib/generators/inertia/install/templates/vue/tsconfig.node.json
91
- - lib/generators/inertia/install/templates/vue/vite-env.d.ts
92
- - lib/generators/inertia/scaffold/scaffold_generator.rb
93
- - lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb
94
- - lib/generators/inertia/scaffold_controller/templates/controller.rb.tt
95
- - lib/generators/inertia_templates/controller/controller_generator.rb
96
- - lib/generators/inertia_templates/controller/templates/react/view.jsx.tt
97
- - lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt
98
- - lib/generators/inertia_templates/controller/templates/vue/view.vue.tt
99
- - lib/generators/inertia_templates/scaffold/scaffold_generator.rb
100
- - lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
101
- - lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt
102
- - lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt
103
- - lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt
104
- - lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt
105
- - lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt
106
- - lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt
107
- - lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt
108
- - lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt
109
- - lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt
110
- - lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt
111
- - lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt
112
- - lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt
113
- - lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt
114
- - lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt
115
- - lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt
116
- - lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt
117
- - lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt
118
- - lib/generators/inertia_tw_templates/controller/controller_generator.rb
119
- - lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt
120
- - lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt
121
- - lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt
122
- - lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb
123
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt
124
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt
125
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt
126
- - lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
127
- - lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt
128
- - lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt
129
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt
130
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt
131
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt
132
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt
133
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt
134
- - lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt
135
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt
136
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt
137
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt
138
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt
139
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt
140
- - lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt
141
37
  - lib/inertia_rails-contrib.rb
142
38
  - lib/inertia_rails_contrib.rb
143
- - lib/inertia_rails_contrib/generators/controller_template_base.rb
144
- - lib/inertia_rails_contrib/generators/scaffold_template_base.rb
145
- - lib/inertia_rails_contrib/generators_helper.rb
146
39
  - lib/inertia_rails_contrib/version.rb
147
40
  homepage: https://github.com/skryukov/inertia_rails-contrib
148
41
  licenses:
@@ -169,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
62
  - !ruby/object:Gem::Version
170
63
  version: '0'
171
64
  requirements: []
172
- rubygems_version: 3.5.17
65
+ rubygems_version: 3.5.23
173
66
  signing_key:
174
67
  specification_version: 4
175
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,73 +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
- svelte:
51
- inertia_package: "@inertiajs/svelte"
52
- packages:
53
- - "svelte"
54
- - "@sveltejs/vite-plugin-svelte"
55
- packages_ts:
56
- - "@tsconfig/svelte"
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"
@@ -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