tailwind_dsl 0.0.29 → 0.0.31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a70be418386e67d6810404f966f97be9eff5cb76f29749f09720ce82a5ede862
4
- data.tar.gz: 61177d4aa5b7739ad0f04f1e8dee210d176a166c0b51d71b4797075e320e23cb
3
+ metadata.gz: 997022f0d369f05f7a8f024e5d95fdfa4ef8f260d928bc5e8ba12b0cef13b8b1
4
+ data.tar.gz: 1acdd5ce24924cef66297a22c57580b55d82a6f5a41f6276c73c6d246e6d9c8a
5
5
  SHA512:
6
- metadata.gz: 6a3597b9e27978d20c4fc6a55f087b8a1da50952028b09c97a5ce1bf286a7c4d5de42279bd4c719a328393df26c4734c1d13794513f5aa07f6ac8e5f4cf7d288
7
- data.tar.gz: e252253ba7ff48a6b6ac604e6bd1122dfcc997d51708389218f27be0499ee14fa48a84de6a36e5c7c56481503d2151ffdb7ccd9797a45da7bd78f3d562d80370
6
+ metadata.gz: d1250f3b3874aede08217247d1d48303abf645bf7d59d425a75aa84cf25ba8ea2b1c1e0ae6c4c802c900a07952c066a8f82bef336ba3d079f58fa5f74818d776
7
+ data.tar.gz: 5a3b5c816a552e6892c0b36b97338dd5f2324f2d2f1634269712d1b8733350e3d332f5c883f8b2461ea6667d78fd18d83b54ec492b1139152639a8e52a4e1b10
@@ -0,0 +1,26 @@
1
+ require 'gpt3/builder'
2
+
3
+ # Send an email to the user
4
+ #
5
+ # @param [String] use_ses - use AWS SES to send the email, if you are just testing, then set this value to false
6
+ def send_email(use_ses = nil)
7
+ use_ses ||= true
8
+
9
+ puts 'email sent successfully via Amazon Simple Email Service' if use_ses
10
+ end
11
+
12
+ KManager.action :test do
13
+ action do
14
+
15
+ # Send an email to the user
16
+ send_email
17
+
18
+ # Send an email to the user
19
+ send_email(true)
20
+
21
+ # This is a test, don't send the email
22
+ send_email(false)
23
+ end
24
+ end
25
+
26
+ KManager.opts.sleep = 2
@@ -35,8 +35,15 @@ KManager.action :utilities do
35
35
  components,
36
36
  target_component_model_path,
37
37
  batch_size: 1,
38
- use_prompt: true,
39
- filter_design_system: 'tui',
38
+ filter: {
39
+ design_system: 'tui',
40
+ exclude_group_key: [
41
+ 'application_ui.application_shells.multi_column',
42
+ 'application_ui.application_shells.sidebar',
43
+ 'application_ui.element.avatars',
44
+ 'application_ui.element.badges'
45
+ ]
46
+ },
40
47
  extract_handler: TailwindDsl::Etl::Extractors::DataExtractor
41
48
  )
42
49
  # puts target_component_path
@@ -79,13 +86,12 @@ KManager.action :utilities do
79
86
  # Extracts the next component data using GPT3
80
87
  #
81
88
  # This needs to be supervised and verified, so it will only do a few models at a time
82
- def batch_extraction(components, target_folder, batch_size: 1, use_prompt: false, filter_design_system: nil, extract_handler: nil)
89
+ def batch_extraction(components, target_folder, batch_size: 1, filter: nil, extract_handler: nil)
83
90
  extraction = TailwindDsl::Etl::Extractors::BatchExtraction.new(
84
91
  components,
85
92
  target_folder,
86
93
  batch_size: batch_size,
87
- use_prompt: use_prompt,
88
- filter_design_system: filter_design_system,
94
+ filter: filter,
89
95
  extract_handler: extract_handler)
90
96
  extraction.extract
91
97
  end
@@ -0,0 +1,37 @@
1
+ {
2
+ "todo": "SVG Icons and Profile Name in footer",
3
+ "sidebar": {
4
+ "items": [
5
+ {
6
+ "title": "Dashboard",
7
+ "icon": "Dashboard",
8
+ "url": "/dashboard"
9
+ },
10
+ {
11
+ "title": "Calendar",
12
+ "icon": "Calendar",
13
+ "url": "/calendar"
14
+ },
15
+ {
16
+ "title": "Teams",
17
+ "icon": "Teams",
18
+ "url": "/teams"
19
+ },
20
+ {
21
+ "title": "Directory",
22
+ "icon": "Directory",
23
+ "url": "/directory"
24
+ },
25
+ {
26
+ "title": "Announcements",
27
+ "icon": "Announcements",
28
+ "url": "/announcements"
29
+ },
30
+ {
31
+ "title": "Office Map",
32
+ "icon": "OfficeMap",
33
+ "url": "/office-map"
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,31 @@
1
+
2
+ {
3
+ "nav": {
4
+ "logo": "https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600",
5
+ "links": [
6
+ {
7
+ "text": "Dashboard",
8
+ "url": "#",
9
+ "active": true
10
+ },
11
+ {
12
+ "text": "Team",
13
+ "url": "#"
14
+ },
15
+ {
16
+ "text": "Projects",
17
+ "url": "#"
18
+ },
19
+ {
20
+ "text": "Calendar",
21
+ "url": "#"
22
+ }
23
+ ],
24
+ "notifications": {
25
+ "url": "#",
26
+ "icon": "https://www.w3.org/2000/svg",
27
+ "icon_viewbox": "0 0 24 24",
28
+ "icon_stroke_width": "1.5",
29
+ "icon_stroke": "currentColor",
30
+ "icon_aria_hidden": true,
31
+ "icon_path": "M14.857 17.082a23.8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.0.30](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.29...v0.0.30) (2022-10-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add inclusion and exclusion filters ([f1112bd](https://github.com/klueless-io/tailwind_dsl/commit/f1112bd926e31efa2f2e7e76df91e9ccd02b4dbe))
7
+
8
+ ## [0.0.29](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.28...v0.0.29) (2022-10-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * rename raw_component_query ([07b736e](https://github.com/klueless-io/tailwind_dsl/commit/07b736e1602f8be4507a4d1ec5da066c7673e797))
14
+
1
15
  ## [0.0.28](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.27...v0.0.28) (2022-10-24)
2
16
 
3
17
 
@@ -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 :use_prompt
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 [Boolean] :use_prompt console based prompt so the user can guide the extractor, default is false
22
- # @option args [String] :filter_design_system name of the design system to filter on, default is nil meaning all
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
- @use_prompt = args[:use_prompt] || false
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
- # Goal: Extract the next (batch_size) component models using GPT3 and save them to target_root_path
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
- # if use_prompt
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,22 @@ 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, Metrics/PerceivedComplexity
92
74
  def filter_components
93
- return components unless filter_design_system
94
-
95
- components.select { |component| component.design_system.name == filter_design_system }
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].is_a?(String)
81
+ result = result.select { |component| filter[:group_key].include?(component.group.key) } if filter[:group_key].is_a?(Array)
82
+ # exclusions
83
+ result = result.reject { |component| component.group.key == filter[:exclude_group_key] } if filter[:exclude_group_key].is_a?(String)
84
+ result = result.reject { |component| filter[:exclude_group_key].include?(component.group.key) } if filter[:exclude_group_key].is_a?(Array)
85
+
86
+ result
96
87
  end
97
-
98
- # def target_file(component)
99
- # raise NotImplementedError, 'target_file is not implemented'
100
- # end
88
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
101
89
  end
102
90
  end
103
91
  end
@@ -30,6 +30,9 @@ module TailwindDsl
30
30
  .message('JSON:')
31
31
  .complete(engine: 'code-davinci-002', max_tokens: tokens, suffix: "\n")
32
32
  .write_result(target_file)
33
+
34
+ puts "Extracted data for #{component_type} component: #{component.name} into file"
35
+ puts target_file
33
36
  end
34
37
  # rubocop:enable Metrics/AbcSize
35
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindDsl
4
- VERSION = '0.0.29'
4
+ VERSION = '0.0.31'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tailwind_dsl",
9
- "version": "0.0.29",
9
+ "version": "0.0.31",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Tailwind DSL will build tailwind websites useing Domain Specific Language conventions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailwind_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdlet
@@ -70,9 +70,11 @@ files:
70
70
  - ".builders/generators/domain-model-to-code.rb"
71
71
  - ".builders/generators/domain-model.rb"
72
72
  - ".builders/generators/project-plan.rb"
73
+ - ".builders/generators/test.rb"
73
74
  - ".builders/generators/utilities.rb"
74
75
  - ".components/readme.md"
75
76
  - ".components/tui/application-ui/application-shells/multi-column/01.clean.html"
77
+ - ".components/tui/application-ui/application-shells/multi-column/01.data.json"
76
78
  - ".components/tui/application-ui/application-shells/multi-column/01.html"
77
79
  - ".components/tui/application-ui/application-shells/multi-column/01.settings.json"
78
80
  - ".components/tui/application-ui/application-shells/multi-column/02.clean.html"
@@ -126,6 +128,7 @@ files:
126
128
  - ".components/tui/application-ui/application-shells/sidebar/08.html"
127
129
  - ".components/tui/application-ui/application-shells/sidebar/08.settings.json"
128
130
  - ".components/tui/application-ui/application-shells/stacked/01.clean.html"
131
+ - ".components/tui/application-ui/application-shells/stacked/01.data.json"
129
132
  - ".components/tui/application-ui/application-shells/stacked/01.html"
130
133
  - ".components/tui/application-ui/application-shells/stacked/01.settings.json"
131
134
  - ".components/tui/application-ui/application-shells/stacked/02.clean.html"