kaze 0.12.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/kaze +1 -1
- data/lib/kaze/commands/{install_command.rb → app/base_stack.rb} +16 -23
- data/lib/kaze/commands/app/hotwire_stack.rb +63 -0
- data/lib/kaze/commands/app/inertia_react_stack.rb +81 -0
- data/lib/kaze/commands/app/inertia_vue_stack.rb +81 -0
- data/lib/kaze/commands/app/stack_factory.rb +13 -0
- data/lib/kaze/commands/app.rb +21 -0
- data/lib/kaze/commands.rb +1 -0
- data/lib/kaze/version.rb +1 -1
- data/stubs/default/app/views/user_mailer/reset_password.html.erb +1 -1
- data/stubs/default/app/views/user_mailer/verify_email.html.erb +1 -1
- data/stubs/default/test/integration/profile_test.rb +0 -1
- data/stubs/hotwire/app/controllers/profile_controller.rb +2 -2
- data/stubs/hotwire/app/views/profile/destroy.turbo_stream.erb +3 -0
- data/stubs/hotwire/app/views/profile/partials/_delete_user_form.html.erb +1 -1
- data/stubs/hotwire/app/views/profile/partials/_update_password_form.html.erb +2 -2
- data/stubs/hotwire/app/views/profile/partials/_update_profile_information_form.html.erb +2 -2
- data/stubs/inertia-react-ts/app/javascript/Components/Dropdown.tsx +2 -7
- data/stubs/inertia-react-ts/app/javascript/Components/Modal.tsx +9 -11
- metadata +10 -7
- data/lib/kaze/commands/installs_hotwire_stack.rb +0 -65
- data/lib/kaze/commands/installs_inertia_stacks.rb +0 -163
- data/lib/kaze/commands/version_command.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76266303b2438a2b8150e105b949336025535af3fd5333a6046b6cc304c1838f
|
4
|
+
data.tar.gz: 93c6e63fbd507419b506721869aaf2624057a9e27baf53c111ea6318a8dd9a40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94150da33b21e62478df0c05903f3405e3c15d3753d566f145726dd61e773d5074f9ccd4bd68df1f531ae30fd51390eedd80ec4b1805689b3a432f3513c72f3e
|
7
|
+
data.tar.gz: 0d14fa92c8c2929b6d1286acba751e62af9f807389b36ab9564e21b905bde434e186861b053e8367e04f21a26eb335b4aa5360abc876178b28c35241232e348d
|
data/bin/kaze
CHANGED
@@ -1,23 +1,10 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'open3'
|
4
|
-
require 'thor'
|
5
4
|
|
6
|
-
class Kaze::Commands::
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
desc 'install [STACK]', 'Install the Kaze controllers and resources. Supported stacks: hotwire, react, vue.'
|
11
|
-
def install(stack = 'hotwire')
|
12
|
-
return say 'Kaze must be run in a new Rails application.', :red unless File.exist?("#{Dir.pwd}/bin/rails")
|
13
|
-
|
14
|
-
return install_hotwire_stack if stack == 'hotwire'
|
15
|
-
|
16
|
-
return install_inertia_react_stack if stack == 'react'
|
17
|
-
|
18
|
-
return install_inertia_vue_stack if stack == 'vue'
|
19
|
-
|
20
|
-
say 'Invalid stack. Supported stacks are [hotwire], [react], [vue].', :red
|
5
|
+
class Kaze::Commands::App::BaseStack
|
6
|
+
def install
|
7
|
+
raise NotImplementedError
|
21
8
|
end
|
22
9
|
|
23
10
|
private
|
@@ -52,18 +39,16 @@ class Kaze::Commands::InstallCommand < Thor
|
|
52
39
|
railsVersion = [ versions[0], versions[1] ].join('.')
|
53
40
|
|
54
41
|
ensure_directory_exists("#{Dir.pwd}/db/migrate")
|
55
|
-
FileUtils.copy_entry("#{
|
56
|
-
Dir.children("#{Dir.pwd}/db/migrate").each
|
57
|
-
replace_in_file(/ActiveRecord::Migration$/, "ActiveRecord::Migration[#{railsVersion}]", "#{Dir.pwd}/db/migrate/#{file}")
|
58
|
-
end
|
42
|
+
FileUtils.copy_entry("#{stubs_path}/default/db/migrate", "#{Dir.pwd}/db/migrate")
|
43
|
+
Dir.children("#{Dir.pwd}/db/migrate").each { |file| replace_in_file(/ActiveRecord::Migration$/, "ActiveRecord::Migration[#{railsVersion}]", "#{Dir.pwd}/db/migrate/#{file}") }
|
59
44
|
end
|
60
45
|
|
61
46
|
def install_tests
|
62
47
|
ensure_directory_exists("#{Dir.pwd}/test/factories")
|
63
48
|
ensure_directory_exists("#{Dir.pwd}/test/integration")
|
64
|
-
FileUtils.copy_file("#{
|
65
|
-
FileUtils.copy_entry("#{
|
66
|
-
FileUtils.copy_entry("#{
|
49
|
+
FileUtils.copy_file("#{stubs_path}/default/test/test_helper.rb", "#{Dir.pwd}/test/test_helper.rb")
|
50
|
+
FileUtils.copy_entry("#{stubs_path}/default/test/factories", "#{Dir.pwd}/test/factories")
|
51
|
+
FileUtils.copy_entry("#{stubs_path}/default/test/integration", "#{Dir.pwd}/test/integration")
|
67
52
|
end
|
68
53
|
|
69
54
|
def ensure_directory_exists(path)
|
@@ -95,4 +80,12 @@ class Kaze::Commands::InstallCommand < Thor
|
|
95
80
|
def run_commands(commands)
|
96
81
|
commands.each { |command| run_command(command) }
|
97
82
|
end
|
83
|
+
|
84
|
+
def say(message, color = nil)
|
85
|
+
THOR.say(message, color)
|
86
|
+
end
|
87
|
+
|
88
|
+
def stubs_path
|
89
|
+
"#{File.dirname(__FILE__)}/../../../../stubs"
|
90
|
+
end
|
98
91
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class Kaze::Commands::App::HotwireStack < Kaze::Commands::App::BaseStack
|
2
|
+
def install
|
3
|
+
# Gems...
|
4
|
+
return unless remove_gems([ 'sprockets-rails', 'stimulus-rails' ])
|
5
|
+
return unless install_gems([ 'propshaft', 'view_component', 'tailwindcss-rails', 'turbo-rails', 'dotenv', 'bcrypt' ])
|
6
|
+
return unless install_gems([ 'hotwire-livereload' ], 'development')
|
7
|
+
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
8
|
+
|
9
|
+
# Controllers...
|
10
|
+
FileUtils.copy_entry("#{stubs_path}/hotwire/app/controllers", "#{Dir.pwd}/app/controllers")
|
11
|
+
|
12
|
+
# Models...
|
13
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/models", "#{Dir.pwd}/app/models")
|
14
|
+
|
15
|
+
# Forms...
|
16
|
+
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
17
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/forms", "#{Dir.pwd}/app/forms")
|
18
|
+
|
19
|
+
# Validators...
|
20
|
+
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
21
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/validators", "#{Dir.pwd}/app/validators")
|
22
|
+
|
23
|
+
# Mailers...
|
24
|
+
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
25
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
26
|
+
|
27
|
+
# Views...
|
28
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
29
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
30
|
+
FileUtils.copy_entry("#{stubs_path}/hotwire/app/views", "#{Dir.pwd}/app/views")
|
31
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
32
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
33
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/views/user_mailer", "#{Dir.pwd}/app/views/user_mailer")
|
34
|
+
|
35
|
+
# View Components + Alpine...
|
36
|
+
ensure_directory_exists("#{Dir.pwd}/app/components")
|
37
|
+
FileUtils.copy_entry("#{stubs_path}/hotwire/app/components", "#{Dir.pwd}/app/components")
|
38
|
+
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
39
|
+
FileUtils.copy_file("#{stubs_path}/hotwire/app/javascript/application.js", "#{Dir.pwd}/app/javascript/application.js")
|
40
|
+
FileUtils.copy_file("#{stubs_path}/hotwire/app/javascript/alpinejs.stub", "#{Dir.pwd}/app/javascript/alpinejs.js")
|
41
|
+
FileUtils.copy_file("#{stubs_path}/hotwire/config/importmap.rb", "#{Dir.pwd}/config/importmap.rb")
|
42
|
+
|
43
|
+
# Tests...
|
44
|
+
install_tests
|
45
|
+
|
46
|
+
# Routes...
|
47
|
+
FileUtils.copy_file("#{stubs_path}/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
48
|
+
|
49
|
+
# Migrations...
|
50
|
+
install_migrations
|
51
|
+
|
52
|
+
# Tailwind...
|
53
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
54
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
55
|
+
FileUtils.copy_file("#{stubs_path}/hotwire/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
56
|
+
FileUtils.copy_file("#{stubs_path}/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
57
|
+
FileUtils.copy_file("#{stubs_path}/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
58
|
+
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
59
|
+
|
60
|
+
say ''
|
61
|
+
say 'Kaze scaffolding installed successfully.', :green
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
class Kaze::Commands::App::InertiaReactStack < Kaze::Commands::App::BaseStack
|
2
|
+
def install
|
3
|
+
# Gems...
|
4
|
+
return unless remove_gems([ 'sprockets-rails', 'turbo-rails', 'stimulus-rails' ])
|
5
|
+
return unless install_gems([ 'propshaft', 'tailwindcss-rails', 'inertia_rails', 'vite_rails', 'dotenv', 'bcrypt', 'js-routes' ])
|
6
|
+
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
7
|
+
|
8
|
+
# NPM Packages...
|
9
|
+
FileUtils.copy_file("#{stubs_path}/inertia-react-ts/package.json", "#{Dir.pwd}/package.json")
|
10
|
+
|
11
|
+
# Controllers...
|
12
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-common/app/controllers", "#{Dir.pwd}/app/controllers")
|
13
|
+
|
14
|
+
# Models...
|
15
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/models", "#{Dir.pwd}/app/models")
|
16
|
+
|
17
|
+
# Forms...
|
18
|
+
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
19
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/forms", "#{Dir.pwd}/app/forms")
|
20
|
+
|
21
|
+
# Validators...
|
22
|
+
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
23
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/validators", "#{Dir.pwd}/app/validators")
|
24
|
+
|
25
|
+
# Mailers...
|
26
|
+
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
27
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
28
|
+
|
29
|
+
# Views...
|
30
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
31
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
32
|
+
FileUtils.copy_file("#{stubs_path}/inertia-react-ts/app/views/layouts/application.html.erb", "#{Dir.pwd}/app/views/layouts/application.html.erb")
|
33
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
34
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
35
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/views/user_mailer", "#{Dir.pwd}/app/views/user_mailer")
|
36
|
+
|
37
|
+
# Components + Pages...
|
38
|
+
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
39
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-react-ts/app/javascript", "#{Dir.pwd}/app/javascript")
|
40
|
+
|
41
|
+
# Tests...
|
42
|
+
install_tests
|
43
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-common/test/integration", "#{Dir.pwd}/test/integration")
|
44
|
+
|
45
|
+
# Routes...
|
46
|
+
FileUtils.copy_file("#{stubs_path}/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
47
|
+
|
48
|
+
# Migrations...
|
49
|
+
install_migrations
|
50
|
+
|
51
|
+
# Tailwind / Vite...
|
52
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
53
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
54
|
+
FileUtils.copy_file("#{stubs_path}/inertia-react-ts/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
55
|
+
FileUtils.copy_file("#{stubs_path}/inertia-common/config/vite.json", "#{Dir.pwd}/config/vite.json")
|
56
|
+
FileUtils.copy_file("#{stubs_path}/inertia-react-ts/tsconfig.json", "#{Dir.pwd}/tsconfig.json")
|
57
|
+
FileUtils.copy_file("#{stubs_path}/inertia-react-ts/vite.config.ts", "#{Dir.pwd}/vite.config.ts")
|
58
|
+
FileUtils.copy_file("#{stubs_path}/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
59
|
+
FileUtils.copy_file("#{stubs_path}/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
60
|
+
FileUtils.copy_file("#{stubs_path}/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
61
|
+
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
62
|
+
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
63
|
+
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
64
|
+
|
65
|
+
say ''
|
66
|
+
say 'Installing and building Node dependencies.', :magenta
|
67
|
+
|
68
|
+
if File.exist?("#{Dir.pwd}/pnpm-lock.yaml")
|
69
|
+
run_commands([ 'pnpm install', 'pnpm run build' ])
|
70
|
+
elsif File.exist?("#{Dir.pwd}/yarn.lock")
|
71
|
+
run_commands([ 'yarn install', 'yarn build' ])
|
72
|
+
elsif File.exist?("#{Dir.pwd}/bun.lockb")
|
73
|
+
run_commands([ 'bun install', 'bun run build' ])
|
74
|
+
else
|
75
|
+
run_commands([ 'npm install', 'npm run build' ])
|
76
|
+
end
|
77
|
+
|
78
|
+
say ''
|
79
|
+
say 'Kaze scaffolding installed successfully.', :green
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
class Kaze::Commands::App::InertiaVueStack < Kaze::Commands::App::BaseStack
|
2
|
+
def install
|
3
|
+
# Gems...
|
4
|
+
return unless remove_gems([ 'sprockets-rails', 'turbo-rails', 'stimulus-rails' ])
|
5
|
+
return unless install_gems([ 'propshaft', 'tailwindcss-rails', 'inertia_rails', 'vite_rails', 'dotenv', 'bcrypt', 'js-routes' ])
|
6
|
+
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
7
|
+
|
8
|
+
# NPM Packages...
|
9
|
+
FileUtils.copy_file("#{stubs_path}/inertia-vue-ts/package.json", "#{Dir.pwd}/package.json")
|
10
|
+
|
11
|
+
# Controllers...
|
12
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-common/app/controllers", "#{Dir.pwd}/app/controllers")
|
13
|
+
|
14
|
+
# Models...
|
15
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/models", "#{Dir.pwd}/app/models")
|
16
|
+
|
17
|
+
# Forms...
|
18
|
+
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
19
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/forms", "#{Dir.pwd}/app/forms")
|
20
|
+
|
21
|
+
# Validators...
|
22
|
+
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
23
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/validators", "#{Dir.pwd}/app/validators")
|
24
|
+
|
25
|
+
# Views...
|
26
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
27
|
+
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
28
|
+
FileUtils.copy_file("#{stubs_path}/inertia-vue-ts/app/views/layouts/application.html.erb", "#{Dir.pwd}/app/views/layouts/application.html.erb")
|
29
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
30
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
31
|
+
FileUtils.copy_file("#{stubs_path}/default/app/views/user_mailer/reset_password.html.erb", "#{Dir.pwd}/app/views/user_mailer/reset_password.html.erb")
|
32
|
+
|
33
|
+
# Mailers...
|
34
|
+
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
35
|
+
FileUtils.copy_entry("#{stubs_path}/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
36
|
+
|
37
|
+
# Components + Pages...
|
38
|
+
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
39
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-vue-ts/app/javascript", "#{Dir.pwd}/app/javascript")
|
40
|
+
|
41
|
+
# Tests...
|
42
|
+
install_tests
|
43
|
+
FileUtils.copy_entry("#{stubs_path}/inertia-common/test/integration", "#{Dir.pwd}/test/integration")
|
44
|
+
|
45
|
+
# Routes...
|
46
|
+
FileUtils.copy_file("#{stubs_path}/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
47
|
+
|
48
|
+
# Migrations...
|
49
|
+
install_migrations
|
50
|
+
|
51
|
+
# Tailwind / Vite...
|
52
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
53
|
+
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
54
|
+
FileUtils.copy_file("#{stubs_path}/inertia-vue-ts/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
55
|
+
FileUtils.copy_file("#{stubs_path}/inertia-common/config/vite.json", "#{Dir.pwd}/config/vite.json")
|
56
|
+
FileUtils.copy_file("#{stubs_path}/inertia-vue-ts/tsconfig.json", "#{Dir.pwd}/tsconfig.json")
|
57
|
+
FileUtils.copy_file("#{stubs_path}/inertia-vue-ts/vite.config.ts", "#{Dir.pwd}/vite.config.ts")
|
58
|
+
FileUtils.copy_file("#{stubs_path}/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
59
|
+
FileUtils.copy_file("#{stubs_path}/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
60
|
+
FileUtils.copy_file("#{stubs_path}/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
61
|
+
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
62
|
+
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
63
|
+
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
64
|
+
|
65
|
+
say ''
|
66
|
+
say 'Installing and building Node dependencies.', :magenta
|
67
|
+
|
68
|
+
if File.exist?("#{Dir.pwd}/pnpm-lock.yaml")
|
69
|
+
run_commands([ 'pnpm install', 'pnpm run build' ])
|
70
|
+
elsif File.exist?("#{Dir.pwd}/yarn.lock")
|
71
|
+
run_commands([ 'yarn install', 'yarn build' ])
|
72
|
+
elsif File.exist?("#{Dir.pwd}/bun.lockb")
|
73
|
+
run_commands([ 'bun install', 'bun run build' ])
|
74
|
+
else
|
75
|
+
run_commands([ 'npm install', 'npm run build' ])
|
76
|
+
end
|
77
|
+
|
78
|
+
say ''
|
79
|
+
say 'Kaze scaffolding installed successfully.', :green
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Kaze::Commands::App::StackFactory
|
2
|
+
def self.make(stack)
|
3
|
+
available_stacks = {
|
4
|
+
hotwire: 'hotwire',
|
5
|
+
react: 'inertia_react',
|
6
|
+
vue: 'inertia_vue'
|
7
|
+
}
|
8
|
+
|
9
|
+
raise Kaze::Commands::InvalidStackError, "Invalid stack. Supported stacks are #{available_stacks.keys.map { |k| "[#{k}]" }.join(', ')}." unless available_stacks.key?(stack)
|
10
|
+
|
11
|
+
Object.const_get("Kaze::Commands::App::#{available_stacks[stack].split(/_/).map(&:capitalize).join}Stack").new
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
THOR = Thor.new
|
4
|
+
|
5
|
+
class Kaze::Commands::App < Thor
|
6
|
+
def self.exit_on_failure?() true end
|
7
|
+
|
8
|
+
desc 'install [STACK]', 'Install the Kaze controllers and resources. Supported stacks: hotwire, react, vue.'
|
9
|
+
def install(stack = 'hotwire')
|
10
|
+
return say 'Kaze must be run in a new Rails application.', :red unless File.exist?("#{Dir.pwd}/bin/rails")
|
11
|
+
|
12
|
+
StackFactory.make(stack.to_sym).install
|
13
|
+
rescue => e
|
14
|
+
say e.message, :red
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'version', 'Show Kaze version'
|
18
|
+
def version
|
19
|
+
puts Kaze::VERSION
|
20
|
+
end
|
21
|
+
end
|
data/lib/kaze/commands.rb
CHANGED
data/lib/kaze/version.rb
CHANGED
@@ -29,6 +29,6 @@
|
|
29
29
|
<p>Regards,<br>
|
30
30
|
<%= ENV.fetch("APP_NAME", "Rails") %></p>
|
31
31
|
<!-- Subcopy -->
|
32
|
-
<% content_for
|
32
|
+
<% content_for(:subcopy) do %>
|
33
33
|
<p>If you're having trouble clicking the "Reset Password" button, copy and paste the URL below into your web browser: <span class="break-all"><%= link_to @reset_url, @reset_url %><span></p>
|
34
34
|
<% end %>
|
@@ -28,6 +28,6 @@
|
|
28
28
|
<p>Regards,<br>
|
29
29
|
<%= ENV.fetch("APP_NAME", "Rails") %></p>
|
30
30
|
<!-- Subcopy -->
|
31
|
-
<% content_for
|
31
|
+
<% content_for(:subcopy) do %>
|
32
32
|
<p>If you're having trouble clicking the "Verify Email Address" button, copy and paste the URL below into your web browser: <span class="break-all"><%= link_to @verification_url, @verification_url %><span></p>
|
33
33
|
<% end %>
|
@@ -16,13 +16,13 @@ class ProfileController < ApplicationController
|
|
16
16
|
|
17
17
|
@update_profile_information_form.update
|
18
18
|
|
19
|
-
|
19
|
+
redirect_back_or_to profile_edit_path, flash: { status: 'profile-updated' }
|
20
20
|
end
|
21
21
|
|
22
22
|
def destroy
|
23
23
|
@delete_user_form = DeleteUserForm.new(params.permit(:password))
|
24
24
|
|
25
|
-
return
|
25
|
+
return turbo_stream if @delete_user_form.invalid?
|
26
26
|
|
27
27
|
user = Current.auth.user
|
28
28
|
|
@@ -10,5 +10,5 @@
|
|
10
10
|
<%= render(DangerButtonComponent.new({"x-data": "", "x-on:click.prevent": "$dispatch('open-modal', 'confirm-user-deletion')"})) do %>
|
11
11
|
Delete Account
|
12
12
|
<% end %>
|
13
|
-
<%= render 'profile/partials/confirm_user_deletion_modal' %>
|
14
13
|
</section>
|
14
|
+
<%= render 'profile/partials/confirm_user_deletion_modal' %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<%= turbo_frame_tag 'update_password_form' do %>
|
2
2
|
<section>
|
3
3
|
<header>
|
4
4
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
@@ -42,4 +42,4 @@
|
|
42
42
|
</div>
|
43
43
|
<% end %>
|
44
44
|
</section>
|
45
|
-
|
45
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<%= turbo_frame_tag 'update_profile_information_form' do %>
|
2
2
|
<section>
|
3
3
|
<header>
|
4
4
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
@@ -54,4 +54,4 @@
|
|
54
54
|
</div>
|
55
55
|
<% end %>
|
56
56
|
</section>
|
57
|
-
|
57
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useState, createContext, useContext,
|
1
|
+
import { useState, createContext, useContext, PropsWithChildren, Dispatch, SetStateAction } from 'react'
|
2
2
|
import { Link, InertiaLinkProps } from '@inertiajs/react'
|
3
3
|
import { Transition } from '@headlessui/react'
|
4
4
|
|
@@ -43,11 +43,7 @@ const Content = ({
|
|
43
43
|
width = '48',
|
44
44
|
contentClasses = 'py-1 bg-white dark:bg-gray-700',
|
45
45
|
children,
|
46
|
-
}: PropsWithChildren<{
|
47
|
-
align?: 'left' | 'right'
|
48
|
-
width?: '48'
|
49
|
-
contentClasses?: string
|
50
|
-
}>) => {
|
46
|
+
}: PropsWithChildren<{ align?: 'left' | 'right'; width?: '48'; contentClasses?: string }>) => {
|
51
47
|
const { open, setOpen } = useContext(DropDownContext)
|
52
48
|
|
53
49
|
let alignmentClasses = 'origin-top'
|
@@ -67,7 +63,6 @@ const Content = ({
|
|
67
63
|
return (
|
68
64
|
<>
|
69
65
|
<Transition
|
70
|
-
as={Fragment}
|
71
66
|
show={open}
|
72
67
|
enter="transition ease-out duration-200"
|
73
68
|
enterFrom="opacity-0 scale-95"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { Dialog, Transition } from '@headlessui/react'
|
1
|
+
import { PropsWithChildren } from 'react'
|
2
|
+
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react'
|
3
3
|
|
4
4
|
export default function Modal({
|
5
5
|
children,
|
@@ -28,15 +28,14 @@ export default function Modal({
|
|
28
28
|
}[maxWidth]
|
29
29
|
|
30
30
|
return (
|
31
|
-
<Transition show={show}
|
31
|
+
<Transition show={show} leave="duration-200">
|
32
32
|
<Dialog
|
33
33
|
as="div"
|
34
34
|
id="modal"
|
35
35
|
className="fixed inset-0 flex overflow-y-auto px-4 py-6 sm:px-0 items-center z-50 transform transition-all"
|
36
36
|
onClose={close}
|
37
37
|
>
|
38
|
-
<
|
39
|
-
as={Fragment}
|
38
|
+
<TransitionChild
|
40
39
|
enter="ease-out duration-300"
|
41
40
|
enterFrom="opacity-0"
|
42
41
|
enterTo="opacity-100"
|
@@ -45,10 +44,9 @@ export default function Modal({
|
|
45
44
|
leaveTo="opacity-0"
|
46
45
|
>
|
47
46
|
<div className="absolute inset-0 bg-gray-500/75 dark:bg-gray-900/75" />
|
48
|
-
</
|
47
|
+
</TransitionChild>
|
49
48
|
|
50
|
-
<
|
51
|
-
as={Fragment}
|
49
|
+
<TransitionChild
|
52
50
|
enter="ease-out duration-300"
|
53
51
|
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
54
52
|
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
@@ -56,12 +54,12 @@ export default function Modal({
|
|
56
54
|
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
57
55
|
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
58
56
|
>
|
59
|
-
<
|
57
|
+
<DialogPanel
|
60
58
|
className={`mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto ${maxWidthClass}`}
|
61
59
|
>
|
62
60
|
{children}
|
63
|
-
</
|
64
|
-
</
|
61
|
+
</DialogPanel>
|
62
|
+
</TransitionChild>
|
65
63
|
</Dialog>
|
66
64
|
</Transition>
|
67
65
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cuong Giang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -65,10 +65,12 @@ files:
|
|
65
65
|
- bin/kaze
|
66
66
|
- lib/kaze.rb
|
67
67
|
- lib/kaze/commands.rb
|
68
|
-
- lib/kaze/commands/
|
69
|
-
- lib/kaze/commands/
|
70
|
-
- lib/kaze/commands/
|
71
|
-
- lib/kaze/commands/
|
68
|
+
- lib/kaze/commands/app.rb
|
69
|
+
- lib/kaze/commands/app/base_stack.rb
|
70
|
+
- lib/kaze/commands/app/hotwire_stack.rb
|
71
|
+
- lib/kaze/commands/app/inertia_react_stack.rb
|
72
|
+
- lib/kaze/commands/app/inertia_vue_stack.rb
|
73
|
+
- lib/kaze/commands/app/stack_factory.rb
|
72
74
|
- lib/kaze/version.rb
|
73
75
|
- stubs/default/Procfile.dev
|
74
76
|
- stubs/default/app/assets/stylesheets/application.css
|
@@ -150,6 +152,7 @@ files:
|
|
150
152
|
- stubs/hotwire/app/views/layouts/_navigation.html.erb
|
151
153
|
- stubs/hotwire/app/views/layouts/application.html.erb
|
152
154
|
- stubs/hotwire/app/views/layouts/guest.html.erb
|
155
|
+
- stubs/hotwire/app/views/profile/destroy.turbo_stream.erb
|
153
156
|
- stubs/hotwire/app/views/profile/edit.html.erb
|
154
157
|
- stubs/hotwire/app/views/profile/partials/_confirm_user_deletion_modal.html.erb
|
155
158
|
- stubs/hotwire/app/views/profile/partials/_delete_user_form.html.erb
|
@@ -269,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
272
|
- !ruby/object:Gem::Version
|
270
273
|
version: '0'
|
271
274
|
requirements: []
|
272
|
-
rubygems_version: 3.5.
|
275
|
+
rubygems_version: 3.5.14
|
273
276
|
signing_key:
|
274
277
|
specification_version: 4
|
275
278
|
summary: Opinionated minimal Rails authentication scaffolding with Hotwire, React,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module Kaze::Commands::InstallsHotwireStack
|
2
|
-
private
|
3
|
-
|
4
|
-
def install_hotwire_stack
|
5
|
-
# Gems...
|
6
|
-
return unless remove_gems([ 'sprockets-rails', 'stimulus-rails' ])
|
7
|
-
return unless install_gems([ 'propshaft', 'view_component', 'tailwindcss-rails', 'turbo-rails', 'dotenv', 'bcrypt' ])
|
8
|
-
return unless install_gems([ 'hotwire-livereload' ], 'development')
|
9
|
-
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
10
|
-
|
11
|
-
# Controllers...
|
12
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/hotwire/app/controllers", "#{Dir.pwd}/app/controllers")
|
13
|
-
|
14
|
-
# Models...
|
15
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/models", "#{Dir.pwd}/app/models")
|
16
|
-
|
17
|
-
# Forms...
|
18
|
-
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
19
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/forms", "#{Dir.pwd}/app/forms")
|
20
|
-
|
21
|
-
# Validators...
|
22
|
-
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
23
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/validators", "#{Dir.pwd}/app/validators")
|
24
|
-
|
25
|
-
# Mailers...
|
26
|
-
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
27
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
28
|
-
|
29
|
-
# Views...
|
30
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
31
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
32
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/hotwire/app/views", "#{Dir.pwd}/app/views")
|
33
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
34
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
35
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/user_mailer", "#{Dir.pwd}/app/views/user_mailer")
|
36
|
-
|
37
|
-
# Components + Pages...
|
38
|
-
ensure_directory_exists("#{Dir.pwd}/app/components")
|
39
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/hotwire/app/components", "#{Dir.pwd}/app/components")
|
40
|
-
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
41
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/hotwire/app/javascript/application.js", "#{Dir.pwd}/app/javascript/application.js")
|
42
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/hotwire/app/javascript/alpinejs.stub", "#{Dir.pwd}/app/javascript/alpinejs.js")
|
43
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/hotwire/config/importmap.rb", "#{Dir.pwd}/config/importmap.rb")
|
44
|
-
|
45
|
-
# Tests...
|
46
|
-
install_tests
|
47
|
-
|
48
|
-
# Routes...
|
49
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
50
|
-
|
51
|
-
# Migrations...
|
52
|
-
install_migrations
|
53
|
-
|
54
|
-
# Tailwind...
|
55
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
56
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
57
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/hotwire/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
58
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
59
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
60
|
-
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
61
|
-
|
62
|
-
say ''
|
63
|
-
say 'Kaze scaffolding installed successfully.', :green
|
64
|
-
end
|
65
|
-
end
|
@@ -1,163 +0,0 @@
|
|
1
|
-
module Kaze::Commands::InstallsInertiaStacks
|
2
|
-
private
|
3
|
-
|
4
|
-
def install_inertia_react_stack
|
5
|
-
# Gems...
|
6
|
-
return unless remove_gems([ 'sprockets-rails', 'turbo-rails', 'stimulus-rails' ])
|
7
|
-
return unless install_gems([ 'propshaft', 'tailwindcss-rails', 'inertia_rails', 'vite_rails', 'dotenv', 'bcrypt', 'js-routes' ])
|
8
|
-
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
9
|
-
|
10
|
-
# NPM Packages...
|
11
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/package.json", "#{Dir.pwd}/package.json")
|
12
|
-
|
13
|
-
# Controllers...
|
14
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/app/controllers", "#{Dir.pwd}/app/controllers")
|
15
|
-
|
16
|
-
# Models...
|
17
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/models", "#{Dir.pwd}/app/models")
|
18
|
-
|
19
|
-
# Forms...
|
20
|
-
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
21
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/forms", "#{Dir.pwd}/app/forms")
|
22
|
-
|
23
|
-
# Validators...
|
24
|
-
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
25
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/validators", "#{Dir.pwd}/app/validators")
|
26
|
-
|
27
|
-
# Mailers...
|
28
|
-
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
29
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
30
|
-
|
31
|
-
# Views...
|
32
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
33
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
34
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/app/views/layouts/application.html.erb", "#{Dir.pwd}/app/views/layouts/application.html.erb")
|
35
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
36
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
37
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/user_mailer", "#{Dir.pwd}/app/views/user_mailer")
|
38
|
-
|
39
|
-
# Components + Pages...
|
40
|
-
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
41
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/app/javascript", "#{Dir.pwd}/app/javascript")
|
42
|
-
|
43
|
-
# Tests...
|
44
|
-
install_tests
|
45
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/test/integration", "#{Dir.pwd}/test/integration")
|
46
|
-
|
47
|
-
# Routes...
|
48
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
49
|
-
|
50
|
-
# Migrations...
|
51
|
-
install_migrations
|
52
|
-
|
53
|
-
# Tailwind / Vite...
|
54
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
55
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
56
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
57
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/config/vite.json", "#{Dir.pwd}/config/vite.json")
|
58
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/tsconfig.json", "#{Dir.pwd}/tsconfig.json")
|
59
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-react-ts/vite.config.ts", "#{Dir.pwd}/vite.config.ts")
|
60
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
61
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
62
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
63
|
-
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
64
|
-
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
65
|
-
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
66
|
-
|
67
|
-
say ''
|
68
|
-
say 'Installing and building Node dependencies.', :magenta
|
69
|
-
|
70
|
-
if File.exist?("#{Dir.pwd}/pnpm-lock.yaml")
|
71
|
-
run_commands([ 'pnpm install', 'pnpm run build' ])
|
72
|
-
elsif File.exist?("#{Dir.pwd}/yarn.lock")
|
73
|
-
run_commands([ 'yarn install', 'yarn build' ])
|
74
|
-
elsif File.exist?("#{Dir.pwd}/bun.lockb")
|
75
|
-
run_commands([ 'bun install', 'bun run build' ])
|
76
|
-
else
|
77
|
-
run_commands([ 'npm install', 'npm run build' ])
|
78
|
-
end
|
79
|
-
|
80
|
-
say ''
|
81
|
-
say 'Kaze scaffolding installed successfully.', :green
|
82
|
-
end
|
83
|
-
|
84
|
-
def install_inertia_vue_stack
|
85
|
-
# Gems...
|
86
|
-
return unless remove_gems([ 'sprockets-rails', 'turbo-rails', 'stimulus-rails' ])
|
87
|
-
return unless install_gems([ 'propshaft', 'tailwindcss-rails', 'inertia_rails', 'vite_rails', 'dotenv', 'bcrypt', 'js-routes' ])
|
88
|
-
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
|
89
|
-
|
90
|
-
# NPM Packages...
|
91
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/package.json", "#{Dir.pwd}/package.json")
|
92
|
-
|
93
|
-
# Controllers...
|
94
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/app/controllers", "#{Dir.pwd}/app/controllers")
|
95
|
-
|
96
|
-
# Models...
|
97
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/models", "#{Dir.pwd}/app/models")
|
98
|
-
|
99
|
-
# Forms...
|
100
|
-
ensure_directory_exists("#{Dir.pwd}/app/forms")
|
101
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/forms", "#{Dir.pwd}/app/forms")
|
102
|
-
|
103
|
-
# Validators...
|
104
|
-
ensure_directory_exists("#{Dir.pwd}/app/validators")
|
105
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/validators", "#{Dir.pwd}/app/validators")
|
106
|
-
|
107
|
-
# Views...
|
108
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
|
109
|
-
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
|
110
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/app/views/layouts/application.html.erb", "#{Dir.pwd}/app/views/layouts/application.html.erb")
|
111
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
|
112
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
|
113
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/views/user_mailer/reset_password.html.erb", "#{Dir.pwd}/app/views/user_mailer/reset_password.html.erb")
|
114
|
-
|
115
|
-
# Mailers...
|
116
|
-
ensure_directory_exists("#{Dir.pwd}/app/mailers")
|
117
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/app/mailers", "#{Dir.pwd}/app/mailers")
|
118
|
-
|
119
|
-
# Components + Pages...
|
120
|
-
ensure_directory_exists("#{Dir.pwd}/app/javascript")
|
121
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/app/javascript", "#{Dir.pwd}/app/javascript")
|
122
|
-
|
123
|
-
# Tests...
|
124
|
-
install_tests
|
125
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/test/integration", "#{Dir.pwd}/test/integration")
|
126
|
-
|
127
|
-
# Routes...
|
128
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
|
129
|
-
|
130
|
-
# Migrations...
|
131
|
-
install_migrations
|
132
|
-
|
133
|
-
# Tailwind / Vite...
|
134
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
|
135
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
|
136
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
|
137
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/config/vite.json", "#{Dir.pwd}/config/vite.json")
|
138
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/tsconfig.json", "#{Dir.pwd}/tsconfig.json")
|
139
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-vue-ts/vite.config.ts", "#{Dir.pwd}/vite.config.ts")
|
140
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
141
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
142
|
-
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
143
|
-
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
144
|
-
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
145
|
-
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
146
|
-
|
147
|
-
say ''
|
148
|
-
say 'Installing and building Node dependencies.', :magenta
|
149
|
-
|
150
|
-
if File.exist?("#{Dir.pwd}/pnpm-lock.yaml")
|
151
|
-
run_commands([ 'pnpm install', 'pnpm run build' ])
|
152
|
-
elsif File.exist?("#{Dir.pwd}/yarn.lock")
|
153
|
-
run_commands([ 'yarn install', 'yarn build' ])
|
154
|
-
elsif File.exist?("#{Dir.pwd}/bun.lockb")
|
155
|
-
run_commands([ 'bun install', 'bun run build' ])
|
156
|
-
else
|
157
|
-
run_commands([ 'npm install', 'npm run build' ])
|
158
|
-
end
|
159
|
-
|
160
|
-
say ''
|
161
|
-
say 'Kaze scaffolding installed successfully.', :green
|
162
|
-
end
|
163
|
-
end
|