tailwind_dsl 0.0.29 → 0.0.30
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/extractors/batch_extraction.rb +19 -34
- data/lib/tailwind_dsl/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3377172941fc6ad9c2db29fa772f5743714f73ac4b4ef69f911069cb00c4c9d8
|
4
|
+
data.tar.gz: e0204ff9d27587aedac8f33a84d1019eaffafdefb2a8793669d2cdf03f9ea9f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd678c918f7b5de5a6bc91c25988f12e0de6da89a5212aeb9f363ffcaa4b0b79fb21a937c7d2d9bf8b49ecc76d43c673b0f150eca91d0907b029b25a1ed1738e
|
7
|
+
data.tar.gz: a0e1be62691f5aff54e4326658048968eb222b9c8002348e37950961fecba68e4aa424daeb01fd7c4ae6d1ccbb0a92338638b124325596d4235addefece8ad9b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.0.29](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.28...v0.0.29) (2022-10-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* rename raw_component_query ([07b736e](https://github.com/klueless-io/tailwind_dsl/commit/07b736e1602f8be4507a4d1ec5da066c7673e797))
|
7
|
+
|
1
8
|
## [0.0.28](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.27...v0.0.28) (2022-10-24)
|
2
9
|
|
3
10
|
|
@@ -9,8 +9,7 @@ module TailwindDsl
|
|
9
9
|
attr_reader :components
|
10
10
|
attr_reader :target_root_path
|
11
11
|
attr_reader :batch_size
|
12
|
-
attr_reader :
|
13
|
-
attr_reader :filter_design_system # this should be renamed and reshaped to a complex filter object
|
12
|
+
attr_reader :filter
|
14
13
|
|
15
14
|
# Create comment for this initialize method
|
16
15
|
|
@@ -18,56 +17,38 @@ module TailwindDsl
|
|
18
17
|
# @param [String] target_root_path root directory where the extracted data will be written to, this is the root path for all design systems and groups
|
19
18
|
# @param [Hash] args
|
20
19
|
# @option args [Integer] :batch_size number of components to process, default is 1
|
21
|
-
# @option args [
|
22
|
-
#
|
20
|
+
# @option args [Hash] :filter filter components before processing
|
21
|
+
# design_system: name of the design system to filter on, default is nil meaning all
|
23
22
|
# @option args [Class] :extract_handler class that implements an extract method
|
24
23
|
def initialize(components, target_root_path, **args)
|
25
24
|
@components = components
|
26
25
|
@target_root_path = target_root_path
|
27
26
|
@batch_size = args[:batch_size] || 1
|
28
|
-
@
|
29
|
-
@filter_design_system = args[:filter_design_system] || nil
|
27
|
+
@filter = args[:filter] || nil
|
30
28
|
@extract_handler = args[:extract_handler]
|
31
29
|
end
|
32
30
|
|
33
|
-
#
|
34
|
-
# Create a data file at: design_system.name -> group-hierarchy -> component-name.data.json
|
35
|
-
# Create a model file at: design_system.name -> group-hierarchy -> component-name.model.rb
|
36
|
-
|
37
|
-
# Process: Collect all components and optionally filter them by design system name.
|
38
|
-
# Also filter by other keys (to be determined)
|
39
|
-
# Only process files that have not been processed before.
|
40
|
-
# Look for the next component to be processed, if it does not exist in the target folder then process it.
|
41
|
-
# decrement the batch_left counter and continue until batch_left is 0.
|
42
|
-
# if :use_prompt is true then display the input/output files and ask if you wish to process the component or skip.
|
43
|
-
# process the component by calling the GPT3 API and save the results to the target folder.
|
44
|
-
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
45
32
|
def extract
|
46
33
|
raise "Batch size must be greater than 0, got: #{batch_size}" if batch_size <= 0
|
47
34
|
|
48
35
|
remaining = batch_size
|
49
36
|
|
50
37
|
filter_components.each do |component|
|
51
|
-
# puts "Processing: #{component.design_system.name} -> #{component.group.key} -> #{component.name} -> remaining#: #{remaining}"
|
52
|
-
|
53
38
|
component_guard(component)
|
39
|
+
|
54
40
|
extractor.component = component
|
55
41
|
|
56
42
|
next if File.exist?(extractor.target_file)
|
57
43
|
|
58
|
-
|
59
|
-
# puts "Input: #{component.cleansed_html_path}"
|
60
|
-
# puts "Output: #{component_model_path}"
|
61
|
-
# puts 'Process? (y/n)'
|
62
|
-
# next unless STDIN.gets.chomp == 'y'
|
63
|
-
# end
|
64
|
-
|
44
|
+
component.debug
|
65
45
|
extractor.extract
|
66
46
|
|
67
47
|
remaining -= 1
|
68
48
|
break if remaining.zero?
|
69
49
|
end
|
70
50
|
end
|
51
|
+
# rubocop:enable Metrics/AbcSize
|
71
52
|
|
72
53
|
def extractor
|
73
54
|
return @extractor if defined? @extractor
|
@@ -89,15 +70,19 @@ module TailwindDsl
|
|
89
70
|
raise "Folder does not exist: '#{path}', make sure you run component structure generator first." unless File.exist?(path)
|
90
71
|
end
|
91
72
|
|
73
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
92
74
|
def filter_components
|
93
|
-
return components unless
|
94
|
-
|
95
|
-
|
75
|
+
return components unless filter
|
76
|
+
|
77
|
+
result = components
|
78
|
+
# inclusions
|
79
|
+
result = result.select { |component| component.design_system.name == filter[:design_system] } if filter[:design_system]
|
80
|
+
result = result.select { |component| component.group.key == filter[:group_key] } if filter[:group_key]
|
81
|
+
# exclusions
|
82
|
+
result = result.reject { |component| component.group.key == filter[:exclude_group_key] } if filter[:exclude_group_key]
|
83
|
+
result
|
96
84
|
end
|
97
|
-
|
98
|
-
# def target_file(component)
|
99
|
-
# raise NotImplementedError, 'target_file is not implemented'
|
100
|
-
# end
|
85
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
101
86
|
end
|
102
87
|
end
|
103
88
|
end
|
data/lib/tailwind_dsl/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "tailwind_dsl",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.30",
|
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.30",
|
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