tailwind_dsl 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/tailwind_dsl/etl/component_structures/generator.rb +59 -65
- data/lib/tailwind_dsl/etl/component_structures/raw_component_query.rb +67 -90
- data/lib/tailwind_dsl/version.rb +1 -1
- data/lib/tailwind_dsl.rb +0 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +1 -2
- data/lib/tailwind_dsl/etl/component_structures/data.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 707385386be771dc2457c12377c7522b367fd3dc4fe806136d49f0ee0b3df12a
|
4
|
+
data.tar.gz: 1e79a6487b05453ae75d7b6c5bc68d43371e4068c4b8a2e18182a2353f587989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3295d19615b011bb2b44ef7bb983d3e921723224992c72e07e8cb702086cade1d5b6fe9e4eeb67e30c987b523a2a82a1772d8bbb9bd9f1145685a6059a0eca07
|
7
|
+
data.tar.gz: 233c7879ba2613c8ebf6530793ee4a326e53731c4c3dd3f50061407b3e19b4bae35441c4124837343aed1b20acb1bb872e4e8f06d3b45be144842e44fabbc75d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.0.11](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.10...v0.0.11) (2022-10-14)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add raw component query object for use by component structures ([16cc578](https://github.com/klueless-io/tailwind_dsl/commit/16cc5785ee118b31d90c62e38b88a7ddae9c342f))
|
7
|
+
|
1
8
|
## [0.0.10](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.9...v0.0.10) (2022-10-13)
|
2
9
|
|
3
10
|
|
@@ -20,73 +20,71 @@ module TailwindDsl
|
|
20
20
|
|
21
21
|
# .gsub(/(\n\s*\n)+/, "\n")
|
22
22
|
attr_reader :uikit
|
23
|
-
attr_reader :
|
24
|
-
attr_reader :
|
23
|
+
attr_reader :source_root_path
|
24
|
+
attr_reader :target_root_path
|
25
25
|
attr_reader :reset_root_path
|
26
26
|
|
27
|
-
def initialize(uikit,
|
27
|
+
def initialize(uikit, source_root_path, target_root_path, reset_root_path: false)
|
28
28
|
@uikit = uikit
|
29
|
-
@
|
30
|
-
@
|
29
|
+
@source_root_path = source_root_path
|
30
|
+
@target_root_path = target_root_path
|
31
31
|
@reset_root_path = reset_root_path
|
32
32
|
end
|
33
33
|
|
34
34
|
def generate
|
35
|
-
|
35
|
+
assert_target_root_path_exists
|
36
36
|
|
37
37
|
delete_target_root_path if reset_root_path
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
@components = query_components
|
40
|
+
|
41
|
+
process_components
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
def
|
47
|
-
raise 'Target path does not exist' unless Dir.exist?(
|
46
|
+
def assert_target_root_path_exists
|
47
|
+
raise 'Target path does not exist' unless Dir.exist?(target_root_path)
|
48
48
|
end
|
49
49
|
|
50
50
|
def delete_target_root_path
|
51
|
-
FileUtils.rm_rf(Dir.glob("#{
|
51
|
+
FileUtils.rm_rf(Dir.glob("#{target_root_path}/*"))
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
54
|
+
def query_components
|
55
|
+
RawComponentQuery.query(uikit,
|
56
|
+
raw_component_root_path: source_root_path,
|
57
|
+
component_structure_root_path: target_root_path).records
|
59
58
|
end
|
60
59
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
unless data.source.exist?
|
67
|
-
puts "Source file does not exist: #{data.source.file}"
|
60
|
+
def process_components
|
61
|
+
@components.each do |component|
|
62
|
+
unless File.exist?(component.absolute_path.source_file)
|
63
|
+
puts "Source file does not exist: #{component.absolute_path.source_file}"
|
68
64
|
next
|
69
65
|
end
|
70
66
|
|
71
|
-
|
67
|
+
# puts "DSN: #{component.design_system.name}, GRP: #{component.group.type}, FILE: #{component.relative_path.source_file}"
|
68
|
+
|
69
|
+
process_component(component)
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
75
|
-
def process_component(
|
73
|
+
def process_component(component)
|
76
74
|
# Create a folder for the component
|
77
|
-
make_target_folder(
|
75
|
+
make_target_folder(component)
|
78
76
|
|
79
|
-
# Create a HTML file for each component
|
80
|
-
create_html_file(
|
77
|
+
# # Create a HTML file for each component
|
78
|
+
create_html_file(component)
|
81
79
|
|
82
|
-
# Create a clean HTML file for each component (comments removed)
|
83
|
-
create_clean_html_file(
|
80
|
+
# # Create a clean HTML file for each component (comments removed)
|
81
|
+
create_clean_html_file(component)
|
84
82
|
|
85
|
-
# Create a tailwind config file (if one exists) - look in first comment for the ``` ```
|
86
|
-
create_tailwind_config_file(
|
83
|
+
# # Create a tailwind config file (if one exists) - look in first comment for the ``` ```
|
84
|
+
create_tailwind_config_file(component)
|
87
85
|
|
88
|
-
# Create a settings file after extracting information from the HTML file
|
89
|
-
create_settings_file(
|
86
|
+
# # Create a settings file after extracting information from the HTML file
|
87
|
+
create_settings_file(component)
|
90
88
|
|
91
89
|
# Build a menu of sources
|
92
90
|
# see: https://tailwindui.com/components/application-ui/data-display/description-lists
|
@@ -104,42 +102,38 @@ module TailwindDsl
|
|
104
102
|
# Note that the data file is meant to represent the data in the raw component
|
105
103
|
# Write an Astro file
|
106
104
|
|
107
|
-
def target_path(
|
108
|
-
File.join(
|
109
|
-
end
|
110
|
-
|
111
|
-
def target_file(data, file)
|
112
|
-
File.join(root_target_path, data.design_system_name, file)
|
105
|
+
def target_path(component)
|
106
|
+
File.join(target_root_path, component.design_system.name, component.group.folder)
|
113
107
|
end
|
114
108
|
|
115
|
-
def make_target_folder(
|
116
|
-
FileUtils.mkdir_p(target_path(
|
109
|
+
def make_target_folder(component)
|
110
|
+
FileUtils.mkdir_p(target_path(component))
|
117
111
|
end
|
118
112
|
|
119
|
-
def create_html_file(
|
113
|
+
def create_html_file(component)
|
120
114
|
# rules:
|
121
115
|
# if the html file exists, then read the settings file, if the settings has html overwrite, then overwrite the html file
|
122
116
|
# overwrite = true
|
123
|
-
FileUtils.cp_r(
|
117
|
+
FileUtils.cp_r(component.absolute_path.source_file, component.absolute_path.target_html_file, remove_destination: true) # if overwrite
|
124
118
|
end
|
125
119
|
|
126
|
-
def create_clean_html_file(
|
127
|
-
html =
|
128
|
-
|
129
|
-
|
120
|
+
def create_clean_html_file(component)
|
121
|
+
html = File.read(component.absolute_path.source_file) || ''
|
122
|
+
component.captured_comment_list = html.scan(COMMENT_REGEX)
|
123
|
+
component.captured_comment_text = component.captured_comment_list.join("\n")
|
130
124
|
|
131
125
|
html = html.gsub(COMMENT_REGEX, '').gsub(BLANK_LINE_REGEX, "\n").lstrip
|
132
126
|
|
133
|
-
File.write(
|
127
|
+
File.write(component.absolute_path.target_clean_html_file, html)
|
134
128
|
end
|
135
129
|
|
136
|
-
def create_tailwind_config_file(
|
137
|
-
|
130
|
+
def create_tailwind_config_file(component)
|
131
|
+
component.captured_tailwind_config = extract_tailwind_config(component)
|
138
132
|
|
139
|
-
File.write(
|
133
|
+
File.write(component.absolute_path.target_tailwind_config_file, component.captured_tailwind_config) if component.captured_tailwind_config
|
140
134
|
end
|
141
135
|
|
142
|
-
def create_settings_file(
|
136
|
+
def create_settings_file(component)
|
143
137
|
# CUSTOM
|
144
138
|
# templates/tailwind/tui/ecommerce/page/product-pages/02.html
|
145
139
|
# templates/tailwind/tui/ecommerce/components/product-overviews/04.html
|
@@ -164,31 +158,31 @@ module TailwindDsl
|
|
164
158
|
# templates/tailwind/tui/application-ui/page/home-screens/02.html
|
165
159
|
# templates/tailwind/tui/application-ui/component/list/feed/03.html
|
166
160
|
settings = {
|
167
|
-
source: extract_source(
|
161
|
+
source: extract_source(component),
|
168
162
|
custom_html: {
|
169
|
-
html:
|
170
|
-
body:
|
163
|
+
html: component.captured_comment_text.match(/<html.*>/),
|
164
|
+
body: component.captured_comment_text.match(/<body.*>/)
|
171
165
|
},
|
172
|
-
tailwind_config: tailwind_config_settings(
|
166
|
+
tailwind_config: tailwind_config_settings(component.captured_tailwind_config)
|
173
167
|
}
|
174
168
|
|
175
|
-
File.write(
|
169
|
+
File.write(component.absolute_path.target_settings_file, JSON.pretty_generate(settings))
|
176
170
|
end
|
177
171
|
|
178
|
-
def extract_tailwind_config(
|
179
|
-
return nil if
|
172
|
+
def extract_tailwind_config(component)
|
173
|
+
return nil if component.captured_comment_list.length.zero? || !component.captured_comment_list.first.include?('// tailwind.config.js')
|
180
174
|
|
181
|
-
|
175
|
+
component.captured_comment_list.first.match(TAILWIND_CONFIG_REGEX)[:tailwind]
|
182
176
|
end
|
183
177
|
|
184
|
-
def extract_source(
|
178
|
+
def extract_source(component)
|
185
179
|
# In future I may be able to store the source in a comment in the HTML file
|
186
180
|
# but at the moment all components are generally from TailwindUI and the source
|
187
181
|
# URL can be inferred from the sub keys.
|
188
182
|
|
189
|
-
return "https://tailwindui.com/components/#{
|
183
|
+
return "https://tailwindui.com/components/#{component.group.sub_keys.join('/')}" if component.design_system.name == 'tui'
|
190
184
|
|
191
|
-
"##{
|
185
|
+
"##{component.design_system.name}/#{component.group.sub_keys.join('/')}"
|
192
186
|
end
|
193
187
|
|
194
188
|
def tailwind_config_settings(raw_tailwind_config)
|
@@ -18,14 +18,14 @@ module TailwindDsl
|
|
18
18
|
keyword_init: true
|
19
19
|
)
|
20
20
|
|
21
|
-
|
21
|
+
Group = Struct.new(
|
22
22
|
:key,
|
23
23
|
:type,
|
24
24
|
:sub_keys,
|
25
25
|
:folder,
|
26
26
|
keyword_init: true
|
27
27
|
)
|
28
|
-
|
28
|
+
FilePath = Struct.new(
|
29
29
|
:source_file,
|
30
30
|
:target_html_file,
|
31
31
|
:target_clean_html_file,
|
@@ -37,23 +37,28 @@ module TailwindDsl
|
|
37
37
|
|
38
38
|
class Record
|
39
39
|
attr_reader :design_system
|
40
|
-
attr_reader :
|
41
|
-
attr_reader :
|
42
|
-
attr_reader :
|
40
|
+
attr_reader :group
|
41
|
+
attr_reader :absolute_path
|
42
|
+
attr_reader :relative_path
|
43
43
|
|
44
|
-
|
44
|
+
# Storage buckets for data that is extracted from the source file
|
45
|
+
attr_accessor :captured_comment_text
|
46
|
+
attr_accessor :captured_comment_list
|
47
|
+
attr_accessor :captured_tailwind_config
|
48
|
+
|
49
|
+
def initialize(design_system:, group:, absolute_path:, relative_path:)
|
45
50
|
@design_system = design_system
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
51
|
+
@group = group
|
52
|
+
@absolute_path = absolute_path
|
53
|
+
@relative_path = relative_path
|
49
54
|
end
|
50
55
|
|
51
56
|
def to_h
|
52
57
|
{
|
53
58
|
design_system: design_system.to_h,
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
group: group.to_h,
|
60
|
+
absolute_path: absolute_path.to_h,
|
61
|
+
relative_path: relative_path.to_h
|
57
62
|
}
|
58
63
|
end
|
59
64
|
end
|
@@ -63,6 +68,7 @@ module TailwindDsl
|
|
63
68
|
attr_reader :component_structure_root_path
|
64
69
|
attr_reader :current_design_system
|
65
70
|
attr_reader :debug
|
71
|
+
attr_reader :records
|
66
72
|
|
67
73
|
def initialize(uikit, **args)
|
68
74
|
@uikit = uikit
|
@@ -79,53 +85,52 @@ module TailwindDsl
|
|
79
85
|
end
|
80
86
|
|
81
87
|
def call
|
82
|
-
|
83
|
-
|
84
|
-
# {
|
85
|
-
# list: list.map(&:to_h)
|
86
|
-
# }
|
88
|
+
@records = build_records
|
89
|
+
|
87
90
|
self
|
88
91
|
end
|
89
92
|
|
90
93
|
# Flattened list of records in hash format
|
91
94
|
# @return [Array<Hash>] list
|
92
95
|
def to_h
|
93
|
-
|
96
|
+
records.map(&:to_h)
|
94
97
|
end
|
95
98
|
|
96
|
-
|
97
|
-
#
|
98
|
-
# @return [Array<Record>] list
|
99
|
-
def records
|
100
|
-
@list
|
101
|
-
end
|
99
|
+
private
|
102
100
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
101
|
+
def build_records
|
102
|
+
uikit.design_systems.flat_map do |design_system|
|
103
|
+
@current_design_system = design_system
|
104
|
+
design_system.groups.flat_map do |group|
|
105
|
+
group.files.map do |file|
|
106
|
+
Record.new(
|
107
|
+
design_system: DesignSystem.new(**map_design_system),
|
108
|
+
group: Group.new(**map_group(group)),
|
109
|
+
absolute_path: FilePath.new(**map_absolute_file(file)),
|
110
|
+
relative_path: FilePath.new(**map_relative_file(file))
|
111
|
+
)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
108
116
|
|
109
|
-
|
117
|
+
def design_system_name
|
118
|
+
current_design_system.name
|
110
119
|
end
|
111
120
|
|
112
|
-
|
121
|
+
def source_path
|
122
|
+
File.join(raw_component_root_path, design_system_name)
|
123
|
+
end
|
113
124
|
|
114
|
-
def
|
115
|
-
|
116
|
-
@current_design_system = design_system
|
117
|
-
map_design_system
|
118
|
-
end
|
125
|
+
def target_path
|
126
|
+
File.join(component_structure_root_path, design_system_name)
|
119
127
|
end
|
120
128
|
|
121
129
|
def map_design_system
|
122
130
|
{
|
123
|
-
name:
|
131
|
+
name: design_system_name,
|
124
132
|
source_path: source_path,
|
125
|
-
target_path: target_path
|
126
|
-
groups: current_design_system.groups.map do |group|
|
127
|
-
map_group(group)
|
128
|
-
end
|
133
|
+
target_path: target_path
|
129
134
|
}
|
130
135
|
end
|
131
136
|
|
@@ -134,63 +139,35 @@ module TailwindDsl
|
|
134
139
|
key: group.key,
|
135
140
|
type: group.type,
|
136
141
|
sub_keys: group.sub_keys,
|
137
|
-
|
138
|
-
map_file(file)
|
139
|
-
end
|
142
|
+
folder: group.folder
|
140
143
|
}
|
141
144
|
end
|
142
145
|
|
143
|
-
|
144
|
-
def map_file(file)
|
146
|
+
def map_relative_file(file)
|
145
147
|
{
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
target_astro_file: file.target.astro_file
|
154
|
-
},
|
155
|
-
absolute: {
|
156
|
-
source_file: File.join(source_path, file.file),
|
157
|
-
target_html_file: File.join(target_path, file.target.html_file),
|
158
|
-
target_clean_html_file: File.join(target_path, file.target.clean_html_file),
|
159
|
-
target_tailwind_config_file: File.join(target_path, file.target.tailwind_config_file),
|
160
|
-
target_settings_file: File.join(target_path, file.target.settings_file),
|
161
|
-
target_data_file: File.join(target_path, file.target.data_file),
|
162
|
-
target_astro_file: File.join(target_path, file.target.astro_file)
|
163
|
-
}
|
148
|
+
source_file: file.file,
|
149
|
+
target_html_file: file.target.html_file,
|
150
|
+
target_clean_html_file: file.target.clean_html_file,
|
151
|
+
target_tailwind_config_file: file.target.tailwind_config_file,
|
152
|
+
target_settings_file: file.target.settings_file,
|
153
|
+
target_data_file: file.target.data_file,
|
154
|
+
target_astro_file: file.target.astro_file
|
164
155
|
}
|
165
156
|
end
|
166
|
-
# rubocop:enable Metrics/AbcSize
|
167
|
-
|
168
|
-
def design_system_name
|
169
|
-
current_design_system.name
|
170
|
-
end
|
171
157
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
group[:files].map do |file|
|
184
|
-
Record.new(
|
185
|
-
design_system: DesignSystem.new(**design_system.slice(:name, :source_path, :target_path)),
|
186
|
-
component_group: ComponentGroup.new(**group.slice(:key, :type, :sub_keys)),
|
187
|
-
absolute_component: ComponentInfo.new(**file[:absolute]),
|
188
|
-
relative_component: ComponentInfo.new(**file[:relative])
|
189
|
-
)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
158
|
+
# rubocop:disable Metrics/AbcSize
|
159
|
+
def map_absolute_file(file)
|
160
|
+
{
|
161
|
+
source_file: File.join(source_path, file.file),
|
162
|
+
target_html_file: File.join(target_path, file.target.html_file),
|
163
|
+
target_clean_html_file: File.join(target_path, file.target.clean_html_file),
|
164
|
+
target_tailwind_config_file: File.join(target_path, file.target.tailwind_config_file),
|
165
|
+
target_settings_file: File.join(target_path, file.target.settings_file),
|
166
|
+
target_data_file: File.join(target_path, file.target.data_file),
|
167
|
+
target_astro_file: File.join(target_path, file.target.astro_file)
|
168
|
+
}
|
193
169
|
end
|
170
|
+
# rubocop:enable Metrics/AbcSize
|
194
171
|
end
|
195
172
|
end
|
196
173
|
end
|
data/lib/tailwind_dsl/version.rb
CHANGED
data/lib/tailwind_dsl.rb
CHANGED
@@ -15,7 +15,6 @@ require_relative 'tailwind_dsl/etl/raw_components/schema/group'
|
|
15
15
|
require_relative 'tailwind_dsl/etl/raw_components/schema/design_system'
|
16
16
|
require_relative 'tailwind_dsl/etl/raw_components/schema/uikit'
|
17
17
|
|
18
|
-
require_relative 'tailwind_dsl/etl/component_structures/data'
|
19
18
|
require_relative 'tailwind_dsl/etl/component_structures/raw_component_query'
|
20
19
|
require_relative 'tailwind_dsl/etl/component_structures/generator'
|
21
20
|
# require_relative 'tailwind_dsl/astro_demo/generate_astro_page_data'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "tailwind_dsl",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.12",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "tailwind_dsl",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.12",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwind_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -2151,7 +2151,6 @@ files:
|
|
2151
2151
|
- lib/_.rb
|
2152
2152
|
- lib/tailwind_dsl.rb
|
2153
2153
|
- lib/tailwind_dsl/astro_demo/generate_astro_page_data.rb
|
2154
|
-
- lib/tailwind_dsl/etl/component_structures/data.rb
|
2155
2154
|
- lib/tailwind_dsl/etl/component_structures/generator.rb
|
2156
2155
|
- lib/tailwind_dsl/etl/component_structures/raw_component_query.rb
|
2157
2156
|
- lib/tailwind_dsl/etl/element.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TailwindDsl
|
4
|
-
module Etl
|
5
|
-
module ComponentStructures
|
6
|
-
# -----------------------------------------------------------------------------------------------
|
7
|
-
# Internal Data Structure
|
8
|
-
class Data
|
9
|
-
attr_reader :design_system_name
|
10
|
-
attr_reader :group # Component group information
|
11
|
-
attr_reader :source # Source file information for the component
|
12
|
-
attr_reader :target # Multiple target file information
|
13
|
-
|
14
|
-
# Storage buckets for data that is extracted from the source file
|
15
|
-
attr_accessor :captured_comment_text
|
16
|
-
attr_accessor :captured_comment_list
|
17
|
-
attr_accessor :captured_tailwind_config
|
18
|
-
|
19
|
-
# rubocop:disable Metrics/AbcSize
|
20
|
-
def initialize(design_system_name, group, file, root_raw_component_path)
|
21
|
-
@design_system_name = design_system_name
|
22
|
-
|
23
|
-
@captured_comment_text = ''
|
24
|
-
@captured_comment_list = []
|
25
|
-
@captured_tailwind_config = ''
|
26
|
-
|
27
|
-
@group = Group.new(key: group.key, type: group.type, sub_keys: group.sub_keys)
|
28
|
-
@source = Source.new(file: File.join(root_raw_component_path, design_system_name, file.file))
|
29
|
-
@target = Target.new(
|
30
|
-
folder: group.folder,
|
31
|
-
html_file: file.target.html_file,
|
32
|
-
clean_html_file: file.target.clean_html_file,
|
33
|
-
tailwind_config_file: file.target.tailwind_config_file,
|
34
|
-
settings_file: file.target.settings_file,
|
35
|
-
data_file: file.target.data_file,
|
36
|
-
astro_file: file.target.astro_file
|
37
|
-
)
|
38
|
-
end
|
39
|
-
# rubocop:enable Metrics/AbcSize
|
40
|
-
|
41
|
-
Group = Struct.new(:key, :type, :sub_keys, keyword_init: true)
|
42
|
-
Source = Struct.new(:file, keyword_init: true) do
|
43
|
-
def exist?
|
44
|
-
File.exist?(file)
|
45
|
-
end
|
46
|
-
|
47
|
-
def content
|
48
|
-
@content ||= File.exist?(file) ? File.read(file) : ''
|
49
|
-
end
|
50
|
-
end
|
51
|
-
Target = Struct.new(:folder, :html_file, :clean_html_file, :tailwind_config_file, :settings_file, :data_file, :astro_file, keyword_init: true)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|