ru.Bee 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/rubee +36 -4
- data/lib/app/views/app.tsx +27 -0
- data/lib/app/views/index.html +47 -0
- data/lib/app/views/layout.erb +3 -3
- data/lib/app/views/utils/redirectToBackend.tsx +9 -0
- data/lib/app/views/welcome_show.erb +1 -1
- data/lib/config/base_configuration.rb +9 -0
- data/lib/config/routes.rb +1 -0
- data/lib/esbuild.config.js +33 -0
- data/lib/js/app.js +13 -0
- data/lib/js/app.js.map +7 -0
- data/lib/js/bundle.js +26157 -0
- data/lib/js/bundle.js.map +7 -0
- data/lib/node_modules/@types/cookie/LICENSE +21 -0
- data/lib/node_modules/@types/cookie/README.md +15 -0
- data/lib/node_modules/@types/cookie/index.d.ts +154 -0
- data/lib/node_modules/@types/cookie/package.json +30 -0
- data/lib/node_modules/cookie/LICENSE +24 -0
- data/lib/node_modules/cookie/README.md +248 -0
- data/lib/node_modules/cookie/dist/index.d.ts +114 -0
- data/lib/node_modules/cookie/dist/index.js +239 -0
- data/lib/node_modules/cookie/dist/index.js.map +1 -0
- data/lib/node_modules/cookie/package.json +42 -0
- data/lib/node_modules/js-tokens/CHANGELOG.md +151 -0
- data/lib/node_modules/js-tokens/LICENSE +21 -0
- data/lib/node_modules/js-tokens/README.md +240 -0
- data/lib/node_modules/js-tokens/index.js +23 -0
- data/lib/node_modules/js-tokens/package.json +30 -0
- data/lib/node_modules/loose-envify/LICENSE +21 -0
- data/lib/node_modules/loose-envify/README.md +45 -0
- data/lib/node_modules/loose-envify/cli.js +16 -0
- data/lib/node_modules/loose-envify/custom.js +4 -0
- data/lib/node_modules/loose-envify/index.js +3 -0
- data/lib/node_modules/loose-envify/loose-envify.js +36 -0
- data/lib/node_modules/loose-envify/package.json +36 -0
- data/lib/node_modules/loose-envify/replace.js +65 -0
- data/lib/node_modules/react/LICENSE +21 -0
- data/lib/node_modules/react/README.md +37 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1315 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.development.js +1333 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
- data/lib/node_modules/react/cjs/react.development.js +2740 -0
- data/lib/node_modules/react/cjs/react.production.min.js +26 -0
- data/lib/node_modules/react/cjs/react.shared-subset.development.js +20 -0
- data/lib/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
- data/lib/node_modules/react/index.js +7 -0
- data/lib/node_modules/react/jsx-dev-runtime.js +7 -0
- data/lib/node_modules/react/jsx-runtime.js +7 -0
- data/lib/node_modules/react/package.json +47 -0
- data/lib/node_modules/react/react.shared-subset.js +7 -0
- data/lib/node_modules/react/umd/react.development.js +3343 -0
- data/lib/node_modules/react/umd/react.production.min.js +31 -0
- data/lib/node_modules/react/umd/react.profiling.min.js +31 -0
- data/lib/node_modules/react-dom/LICENSE +21 -0
- data/lib/node_modules/react-dom/README.md +60 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7029 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7093 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7014 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.node.development.js +7070 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
- data/lib/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1763 -0
- data/lib/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
- data/lib/node_modules/react-dom/cjs/react-dom.development.js +29923 -0
- data/lib/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
- data/lib/node_modules/react-dom/cjs/react-dom.profiling.min.js +366 -0
- data/lib/node_modules/react-dom/client.js +25 -0
- data/lib/node_modules/react-dom/index.js +38 -0
- data/lib/node_modules/react-dom/package.json +62 -0
- data/lib/node_modules/react-dom/profiling.js +38 -0
- data/lib/node_modules/react-dom/server.browser.js +17 -0
- data/lib/node_modules/react-dom/server.js +3 -0
- data/lib/node_modules/react-dom/server.node.js +17 -0
- data/lib/node_modules/react-dom/test-utils.js +7 -0
- data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7026 -0
- data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
- data/lib/node_modules/react-dom/umd/react-dom-server.browser.development.js +7011 -0
- data/lib/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
- data/lib/node_modules/react-dom/umd/react-dom-test-utils.development.js +1759 -0
- data/lib/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
- data/lib/node_modules/react-dom/umd/react-dom.development.js +29924 -0
- data/lib/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
- data/lib/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
- data/lib/node_modules/react-router/CHANGELOG.md +1526 -0
- data/lib/node_modules/react-router/LICENSE.md +23 -0
- data/lib/node_modules/react-router/README.md +7 -0
- data/lib/node_modules/react-router/dist/development/chunk-KNED5TY2.mjs +10476 -0
- data/lib/node_modules/react-router/dist/development/dom-export.d.mts +23 -0
- data/lib/node_modules/react-router/dist/development/dom-export.d.ts +23 -0
- data/lib/node_modules/react-router/dist/development/dom-export.js +6111 -0
- data/lib/node_modules/react-router/dist/development/dom-export.mjs +234 -0
- data/lib/node_modules/react-router/dist/development/fog-of-war-1hWhK5ey.d.mts +1690 -0
- data/lib/node_modules/react-router/dist/development/fog-of-war-oa9CGk10.d.ts +1690 -0
- data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.mts +21 -0
- data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.ts +21 -0
- data/lib/node_modules/react-router/dist/development/index.d.mts +841 -0
- data/lib/node_modules/react-router/dist/development/index.d.ts +841 -0
- data/lib/node_modules/react-router/dist/development/index.js +10624 -0
- data/lib/node_modules/react-router/dist/development/index.mjs +242 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.mts +209 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.ts +209 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.js +28 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.mjs +10 -0
- data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.mts +1716 -0
- data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.ts +1716 -0
- data/lib/node_modules/react-router/dist/production/chunk-ZIM7OIE3.mjs +10476 -0
- data/lib/node_modules/react-router/dist/production/dom-export.d.mts +23 -0
- data/lib/node_modules/react-router/dist/production/dom-export.d.ts +23 -0
- data/lib/node_modules/react-router/dist/production/dom-export.js +6111 -0
- data/lib/node_modules/react-router/dist/production/dom-export.mjs +234 -0
- data/lib/node_modules/react-router/dist/production/fog-of-war-1hWhK5ey.d.mts +1690 -0
- data/lib/node_modules/react-router/dist/production/fog-of-war-oa9CGk10.d.ts +1690 -0
- data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.mts +21 -0
- data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.ts +21 -0
- data/lib/node_modules/react-router/dist/production/index.d.mts +841 -0
- data/lib/node_modules/react-router/dist/production/index.d.ts +841 -0
- data/lib/node_modules/react-router/dist/production/index.js +10624 -0
- data/lib/node_modules/react-router/dist/production/index.mjs +242 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.mts +209 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.ts +209 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.js +28 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.mjs +10 -0
- data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.mts +1716 -0
- data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.ts +1716 -0
- data/lib/node_modules/react-router/package.json +116 -0
- data/lib/node_modules/react-router-dom/LICENSE.md +23 -0
- data/lib/node_modules/react-router-dom/README.md +6 -0
- data/lib/node_modules/react-router-dom/dist/index.d.mts +2 -0
- data/lib/node_modules/react-router-dom/dist/index.d.ts +2 -0
- data/lib/node_modules/react-router-dom/dist/index.js +45 -0
- data/lib/node_modules/react-router-dom/dist/index.mjs +18 -0
- data/lib/node_modules/react-router-dom/package.json +82 -0
- data/lib/node_modules/scheduler/LICENSE +21 -0
- data/lib/node_modules/scheduler/README.md +9 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
- data/lib/node_modules/scheduler/cjs/scheduler.development.js +634 -0
- data/lib/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
- data/lib/node_modules/scheduler/index.js +7 -0
- data/lib/node_modules/scheduler/package.json +36 -0
- data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
- data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
- data/lib/node_modules/scheduler/umd/scheduler.development.js +152 -0
- data/lib/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
- data/lib/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
- data/lib/node_modules/scheduler/unstable_mock.js +7 -0
- data/lib/node_modules/scheduler/unstable_post_task.js +7 -0
- data/lib/node_modules/set-cookie-parser/LICENSE +21 -0
- data/lib/node_modules/set-cookie-parser/README.md +202 -0
- data/lib/node_modules/set-cookie-parser/lib/set-cookie.js +224 -0
- data/lib/node_modules/set-cookie-parser/package.json +45 -0
- data/lib/node_modules/turbo-stream/LICENSE +7 -0
- data/lib/node_modules/turbo-stream/README.md +31 -0
- data/lib/node_modules/turbo-stream/dist/flatten.d.ts +2 -0
- data/lib/node_modules/turbo-stream/dist/flatten.js +203 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.d.ts +13 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.js +207 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.mjs +673 -0
- data/lib/node_modules/turbo-stream/dist/unflatten.d.ts +2 -0
- data/lib/node_modules/turbo-stream/dist/unflatten.js +243 -0
- data/lib/node_modules/turbo-stream/dist/utils.d.ts +44 -0
- data/lib/node_modules/turbo-stream/dist/utils.js +55 -0
- data/lib/node_modules/turbo-stream/package.json +50 -0
- data/lib/package-lock.json +133 -0
- data/lib/package.json +12 -0
- data/lib/rubee/controllers/base_controller.rb +14 -0
- data/lib/rubee.rb +58 -19
- data/lib/tests/rubeeapp_test.rb +17 -0
- data/lib/tests/test.db +0 -0
- data/lib/tests/user_model_test.rb +1 -0
- data/readme.md +104 -2
- metadata +170 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60bb8f17e35447c9cedd635d719a6b0d988486f9fe04668e0e07763a99cb740
|
4
|
+
data.tar.gz: a56dcac76060f5bb9ec71959ef4d21fa7c3e9b858eb6088e873e3ba50e4684f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03be1679bf032a1f292b4490a41286eb02f3a56984cf8dc7281715db53f880dc3ded8feb445ae41a22d60c2a4c3a5e47f8b8fe1be5f4c8188d26e57d403b746e
|
7
|
+
data.tar.gz: 0ffa4e0cc8c436d2ce7ac784c92465333d12ebaa67172f08bcfc55e59dd6f29472aa70211a3c2b766c234ef089b51d1c47a130cc6c0c8ab35e896f659b1ba43d
|
data/bin/rubee
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
|
3
5
|
require_relative '../lib/inits/print_colors'
|
4
6
|
require_relative '../lib/rubee'
|
5
7
|
|
8
|
+
|
6
9
|
ENV['RACK_ENV'] ||= 'development'
|
7
10
|
|
8
11
|
LIB_ROOT = File.expand_path('../lib', File.dirname(__FILE__))
|
@@ -43,6 +46,24 @@ elsif command == 'stop'
|
|
43
46
|
exec('pkill -f rubee')
|
44
47
|
elsif command == 'status'
|
45
48
|
exec('ps aux | grep rubee')
|
49
|
+
elsif command == 'react'
|
50
|
+
case ARGV[1]
|
51
|
+
when 'prepare'
|
52
|
+
if Rubee::PROJECT_NAME == 'rubee'
|
53
|
+
exec('cd ./lib && npm run prepare')
|
54
|
+
else
|
55
|
+
exec('npm run prepare')
|
56
|
+
end
|
57
|
+
when 'watch'
|
58
|
+
if Rubee::PROJECT_NAME == 'rubee'
|
59
|
+
exec('cd ./lib && npm run watch')
|
60
|
+
else
|
61
|
+
exec('npm run watch')
|
62
|
+
end
|
63
|
+
else
|
64
|
+
color_puts "Unknown command: #{command}", color: :red
|
65
|
+
exit 1
|
66
|
+
end
|
46
67
|
elsif command == 'project'
|
47
68
|
project_name = ARGV[1]
|
48
69
|
if project_name.nil?
|
@@ -69,7 +90,7 @@ elsif command == 'project'
|
|
69
90
|
# Define blacklist
|
70
91
|
blacklist_files = %w[rubee.rb print_colors.rb version.rb config.ru test_helper.rb Gemfile.lock test.yml test.db
|
71
92
|
development.db production.db]
|
72
|
-
blacklist_dirs = %w[rubee tests .git .github .idea]
|
93
|
+
blacklist_dirs = %w[rubee tests .git .github .idea node_modules db]
|
73
94
|
|
74
95
|
# Copy files, excluding blacklisted ones
|
75
96
|
Dir.glob("#{source_dir}/**/*", File::FNM_DOTMATCH).each do |file|
|
@@ -94,6 +115,11 @@ elsif command == 'project'
|
|
94
115
|
FileUtils.mkdir_p("#{target_dir}/tests")
|
95
116
|
FileUtils.cp("#{source_dir}/tests/user_model_test.rb", "#{target_dir}/tests/user_model_test.rb")
|
96
117
|
|
118
|
+
# create db dir
|
119
|
+
FileUtils.mkdir_p("#{target_dir}/db")
|
120
|
+
FileUtils.cp("#{source_dir}/db/structure.rb", "#{target_dir}/db/structure.rb")
|
121
|
+
FileUtils.cp("#{source_dir}/db/create_users.rb", "#{target_dir}/db/create_users.rb")
|
122
|
+
|
97
123
|
# create a gemfile context
|
98
124
|
gemfile = <<~GEMFILE
|
99
125
|
source 'https://rubygems.org'
|
@@ -140,6 +166,11 @@ elsif command == 'project'
|
|
140
166
|
|
141
167
|
elsif command == 'version'
|
142
168
|
color_puts "ru.Bee v#{Rubee::VERSION}", color: :yellow
|
169
|
+
elsif command == 'routes'
|
170
|
+
file = Rubee::PROJECT_NAME == 'rubee' ? File.join('/lib', 'config/routes.rb') : 'config/routes.rb'
|
171
|
+
routes = eval(File.read(file))
|
172
|
+
|
173
|
+
puts routes
|
143
174
|
elsif command == 'test'
|
144
175
|
|
145
176
|
ENV['RACK_ENV'] = 'test'
|
@@ -155,8 +186,8 @@ elsif command == 'test'
|
|
155
186
|
elsif %w[generate gen].include?(command)
|
156
187
|
method, path = ARGV[1..2]
|
157
188
|
ENV['RACK_ENV'] ||= 'development'
|
158
|
-
|
159
|
-
routes = eval(File.read(
|
189
|
+
file = Rubee::PROJECT_NAME == 'rubee' ? File.join('/lib', 'config/routes.rb') : 'config/routes.rb'
|
190
|
+
routes = eval(File.read(file))
|
160
191
|
route = routes.find { |route| route[:path] == path.to_s && route[:method] == method.to_sym }
|
161
192
|
color_puts("Route not found with path: #{path} and method: #{method}", color: :red) unless route
|
162
193
|
|
@@ -164,7 +195,8 @@ elsif %w[generate gen].include?(command)
|
|
164
195
|
route[:model]&.[](:name),
|
165
196
|
route[:model]&.[](:attributes),
|
166
197
|
"#{route[:controller]&.capitalize}Controller",
|
167
|
-
route[:action]
|
198
|
+
route[:action],
|
199
|
+
react: route[:react]
|
168
200
|
).call
|
169
201
|
elsif command == 'db'
|
170
202
|
Rubee::Autoload.call
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom";
|
3
|
+
|
4
|
+
const Home = () => (
|
5
|
+
<div>
|
6
|
+
<h2>Reactive Bee</h2>
|
7
|
+
<p>Welcome to Reactive Bee ...</p>
|
8
|
+
<img src="images/rubee.svg" alt="rubee"></img>
|
9
|
+
<nav>
|
10
|
+
<Link to="/home">Home</Link><br />
|
11
|
+
</nav>
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
|
15
|
+
const NotFound = () => <h2>404 Not Found</h2>;
|
16
|
+
|
17
|
+
export function App() {
|
18
|
+
return (
|
19
|
+
<Router>
|
20
|
+
<Routes>
|
21
|
+
<Route path="/home" element={<Home />} />
|
22
|
+
<Route path="*" element={<NotFound />} />
|
23
|
+
</Routes>
|
24
|
+
</Router>
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>React App</title>
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
display: flex;
|
10
|
+
justify-content: center;
|
11
|
+
align-items: center;
|
12
|
+
height: 100vh;
|
13
|
+
margin: 0;
|
14
|
+
background-color: #fdf6a5;
|
15
|
+
text-align: center;
|
16
|
+
font-family: Arial, sans-serif;
|
17
|
+
}
|
18
|
+
.container {
|
19
|
+
padding: 20px;
|
20
|
+
background: white;
|
21
|
+
border-radius: 10px;
|
22
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
23
|
+
}
|
24
|
+
img {
|
25
|
+
width: 50px;
|
26
|
+
height: auto;
|
27
|
+
margin-top: 10px;
|
28
|
+
}
|
29
|
+
h1 {
|
30
|
+
font-size: 1.8rem;
|
31
|
+
margin: 10px 0;
|
32
|
+
}
|
33
|
+
@media (max-width: 600px) {
|
34
|
+
h1 {
|
35
|
+
font-size: 1.5rem;
|
36
|
+
}
|
37
|
+
img {
|
38
|
+
width: 60px;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
</style>
|
42
|
+
</head>
|
43
|
+
<body>
|
44
|
+
<div id="app"></div>
|
45
|
+
<script type="module" src="./../../js/bundle.js"></script>
|
46
|
+
</body>
|
47
|
+
</html>
|
data/lib/app/views/layout.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="container">
|
2
2
|
<%= render_template :welcome_header %>
|
3
3
|
<br/>
|
4
|
-
<img src="images/rubee.svg" alt="
|
4
|
+
<img src="images/rubee.svg" alt="rubee">
|
5
5
|
<br/>
|
6
6
|
<p>rubee homepage: <a href="https://github.com/nucleom42/rubee"><br/>https://github.com/nucleom42/rubee</a></p>
|
7
7
|
<br/>
|
@@ -1,11 +1,20 @@
|
|
1
1
|
Rubee::Configuration.setup(env = :development) do |config|
|
2
2
|
config.database_url = { url: 'sqlite://db/development.db', env: }
|
3
|
+
|
4
|
+
# Uncomment, if you want to use react
|
5
|
+
# config.react = { on: true, env: }
|
3
6
|
end
|
4
7
|
|
5
8
|
Rubee::Configuration.setup(env = :test) do |config|
|
6
9
|
config.database_url = { url: 'sqlite://db/test.db', env: }
|
10
|
+
|
11
|
+
# Uncomment, if you want to use react
|
12
|
+
# config.react = { on: true, env: } # required if you want to use react
|
7
13
|
end
|
8
14
|
|
9
15
|
Rubee::Configuration.setup(env = :production) do |config|
|
10
16
|
config.database_url = { url: 'sqlite://db/production.db', env: }
|
17
|
+
|
18
|
+
# Uncomment,if you want to use react
|
19
|
+
# config.react = { on: true, env: } # required if you want to use react
|
11
20
|
end
|
data/lib/config/routes.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
// esbuild.config.js (CommonJS style)
|
2
|
+
const esbuild = require("esbuild");
|
3
|
+
|
4
|
+
const buildOptions = {
|
5
|
+
entryPoints: ["js/app.js"], // Can be .ts or .tsx too
|
6
|
+
outfile: "js/bundle.js",
|
7
|
+
bundle: true,
|
8
|
+
format: "esm",
|
9
|
+
loader: {
|
10
|
+
".js": "jsx",
|
11
|
+
".jsx": "jsx",
|
12
|
+
".ts": "ts",
|
13
|
+
".tsx": "tsx",
|
14
|
+
},
|
15
|
+
allowOverwrite: true,
|
16
|
+
sourcemap: true,
|
17
|
+
};
|
18
|
+
|
19
|
+
async function run() {
|
20
|
+
if (process.argv.includes("--watch")) {
|
21
|
+
const ctx = await esbuild.context(buildOptions);
|
22
|
+
await ctx.watch();
|
23
|
+
console.log("👀 Watching for changes...");
|
24
|
+
} else {
|
25
|
+
await esbuild.build(buildOptions);
|
26
|
+
console.log("✅ Build complete");
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
run().catch((err) => {
|
31
|
+
console.error("Build failed:", err);
|
32
|
+
process.exit(1);
|
33
|
+
});
|
data/lib/js/app.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { createRoot } from "react-dom/client";
|
3
|
+
import { App } from "../app/views/app.tsx";
|
4
|
+
|
5
|
+
document.addEventListener("DOMContentLoaded", () => {
|
6
|
+
const container = document.getElementById("app");
|
7
|
+
if (container) {
|
8
|
+
const root = createRoot(container);
|
9
|
+
root.render(<App />);
|
10
|
+
} else {
|
11
|
+
console.error('React root element "#app" not found in DOM.');
|
12
|
+
}
|
13
|
+
});
|