fernandes-ui 0.1.0 β 0.1.1
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/README.md +61 -61
- data/app/assets/stylesheets/ui/application.css +621 -3
- data/lib/generators/ui/css_generator.rb +58 -0
- data/lib/generators/ui/install_generator.rb +140 -0
- data/lib/ui/version.rb +1 -1
- metadata +3 -3
- data/app/assets/stylesheets/ui/sonner.css +0 -610
- data/lib/generators/ui/install/install_generator.rb +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
module UI
|
|
2
|
-
module Generators
|
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
|
4
|
-
source_root File.expand_path("templates", __dir__)
|
|
5
|
-
|
|
6
|
-
def detect_asset_pipeline
|
|
7
|
-
@asset_pipeline = if defined?(Propshaft)
|
|
8
|
-
:propshaft
|
|
9
|
-
elsif defined?(Sprockets)
|
|
10
|
-
:sprockets
|
|
11
|
-
else
|
|
12
|
-
:unknown
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
@js_bundler = if File.exist?(Rails.root.join("config/importmap.rb"))
|
|
16
|
-
:importmap
|
|
17
|
-
elsif File.exist?(Rails.root.join("package.json"))
|
|
18
|
-
:node
|
|
19
|
-
else
|
|
20
|
-
:none
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def show_asset_pipeline_info
|
|
25
|
-
say "\nπ Detecting your setup...\n", :yellow
|
|
26
|
-
say " Asset pipeline: #{@asset_pipeline}", :green
|
|
27
|
-
say " JavaScript bundler: #{@js_bundler}", :green
|
|
28
|
-
say "\n"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def install_tailwind_css
|
|
32
|
-
say "π¦ Installing Tailwind CSS 4...\n", :yellow
|
|
33
|
-
|
|
34
|
-
# Create Tailwind CSS config file
|
|
35
|
-
template "application.tailwind.css", Rails.root.join("app/assets/stylesheets/application.tailwind.css")
|
|
36
|
-
|
|
37
|
-
# Create builds directory
|
|
38
|
-
create_file Rails.root.join("app/assets/builds/.keep")
|
|
39
|
-
|
|
40
|
-
# Add to gitignore
|
|
41
|
-
append_to_file Rails.root.join(".gitignore"), "\n# Compiled CSS\n/app/assets/builds/**/*.css\n"
|
|
42
|
-
|
|
43
|
-
say " β Created app/assets/stylesheets/application.tailwind.css", :green
|
|
44
|
-
say " β Created app/assets/builds directory", :green
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def install_package_json
|
|
48
|
-
if @js_bundler == :node || !File.exist?(Rails.root.join("package.json"))
|
|
49
|
-
say "\nπ Setting up package.json...\n", :yellow
|
|
50
|
-
template "package.json", Rails.root.join("package.json")
|
|
51
|
-
say " β Created package.json with Tailwind CLI", :green
|
|
52
|
-
else
|
|
53
|
-
say "\nπ Updating existing package.json...\n", :yellow
|
|
54
|
-
# TODO: Merge scripts into existing package.json
|
|
55
|
-
say " β Please add Tailwind scripts to your package.json manually", :yellow
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def install_procfile
|
|
60
|
-
if !File.exist?(Rails.root.join("Procfile.dev"))
|
|
61
|
-
say "\nπ Setting up Procfile.dev...\n", :yellow
|
|
62
|
-
template "Procfile.dev", Rails.root.join("Procfile.dev")
|
|
63
|
-
say " β Created Procfile.dev", :green
|
|
64
|
-
else
|
|
65
|
-
say "\n β Procfile.dev already exists, skipping", :yellow
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def install_javascript
|
|
70
|
-
case @js_bundler
|
|
71
|
-
when :importmap
|
|
72
|
-
install_importmap_javascript
|
|
73
|
-
when :node
|
|
74
|
-
install_node_javascript
|
|
75
|
-
else
|
|
76
|
-
say "\nβ No JavaScript bundler detected", :yellow
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def show_next_steps
|
|
81
|
-
say "\n"
|
|
82
|
-
say "="*60, :green
|
|
83
|
-
say "β
UI Engine installed successfully!", :green
|
|
84
|
-
say "="*60, :green
|
|
85
|
-
say "\n"
|
|
86
|
-
say "π Next steps:\n", :yellow
|
|
87
|
-
say "\n"
|
|
88
|
-
|
|
89
|
-
say " 1. Install dependencies:", :cyan
|
|
90
|
-
say " $ bun install\n", :white
|
|
91
|
-
say "\n"
|
|
92
|
-
|
|
93
|
-
say " 2. Build Tailwind CSS:", :cyan
|
|
94
|
-
say " $ bun run build:css\n", :white
|
|
95
|
-
say "\n"
|
|
96
|
-
|
|
97
|
-
say " 3. Update your layout file to include:", :cyan
|
|
98
|
-
say " <%= stylesheet_link_tag 'application' %>\n", :white
|
|
99
|
-
say "\n"
|
|
100
|
-
|
|
101
|
-
if @js_bundler == :importmap
|
|
102
|
-
say " 4. Import UI Engine in your JavaScript:", :cyan
|
|
103
|
-
say " import UI from 'ui'\n", :white
|
|
104
|
-
say " UI.init()\n", :white
|
|
105
|
-
say "\n"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
say " 5. Start development with:", :cyan
|
|
109
|
-
say " $ bin/dev\n", :white
|
|
110
|
-
say "\n"
|
|
111
|
-
|
|
112
|
-
say "="*60, :green
|
|
113
|
-
say "π Documentation: https://github.com/your-repo/ui", :cyan
|
|
114
|
-
say "="*60, :green
|
|
115
|
-
say "\n"
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
private
|
|
119
|
-
|
|
120
|
-
def install_importmap_javascript
|
|
121
|
-
say "\nπΊοΈ Configuring importmap...\n", :yellow
|
|
122
|
-
|
|
123
|
-
# Add UI engine pin to the host app's importmap
|
|
124
|
-
if File.exist?(Rails.root.join("config/importmap.rb"))
|
|
125
|
-
append_to_file Rails.root.join("config/importmap.rb"), <<~RUBY
|
|
126
|
-
|
|
127
|
-
# UI Engine
|
|
128
|
-
pin "ui", to: "ui/index.js"
|
|
129
|
-
RUBY
|
|
130
|
-
say " β Added 'ui' pin to config/importmap.rb", :green
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def install_node_javascript
|
|
135
|
-
say "\nπ¦ Node.js setup detected\n", :yellow
|
|
136
|
-
say " βΉ UI Engine JavaScript is available in the gem", :cyan
|
|
137
|
-
say " βΉ Import it in your JavaScript bundle as needed", :cyan
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|