tailwind_dsl 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86fb67e259cee179a6eee1454ec670b68d5c88f03e67b8074fab845116913dc2
4
- data.tar.gz: dfbb4c75a44d45bb92715642d27b94f3de509914e1d7701c16414390157a6e48
3
+ metadata.gz: c311546f3112011590192afd6386ca3e097366b4e32a7d4bdaf90eb2e50bb888
4
+ data.tar.gz: c0720bf9fc432e6931772d819afebfb4e2fa2aa583bcfb36adf8fc18294f1538
5
5
  SHA512:
6
- metadata.gz: f5ac166f49be7f7f61ccb0b1481e55f678a7a37b721d63449efbdb187e9a45000c553169664df2d8d3343c3c9a62f29f9867ff3a439eecb0309e5a18d1481ddf
7
- data.tar.gz: 4841cdcf0af2012c18c356399ab94f2e6e2703dc12ec9af365282b5f07c95b137c2411db82d4e7ab326212cb0786e3ce962fb7094ca5c54005a9d801f551477e
6
+ metadata.gz: 28c7d5f434fb96350a3bac05180d9e1efc58e3172efc5a9b36c6e14e93359e88c5c3f87ecb14177c7e5a02000f1001871e1b7d388f465572b743ed5b21f7f39c
7
+ data.tar.gz: 96b446cb33fbb4a976d5187f205357df2439e2699cf37c9d3b886f1734efe3661823ba255923070197155d1eff68ba0335c0af577cccad2c212e27c36bb94ccf
data/.builders/boot.rb CHANGED
@@ -31,6 +31,7 @@ KConfig.configure(CONFIG_KEY) do |config|
31
31
  config.target_folders.add(:builder , builder_folder)
32
32
  config.target_folders.add(:data , base_folder, '.data')
33
33
  config.target_folders.add(:components , base_folder, '.components')
34
+ config.target_folders.add(:component_models , base_folder, '.component_models')
34
35
 
35
36
  config.target_folders.add(:template_merakiui , global_template, 'tailwind', 'merakiui')
36
37
  config.target_folders.add(:template_devdojo , global_template, 'tailwind', 'devdojo')
@@ -11,21 +11,31 @@ KManager.action :utilities do
11
11
  cd(:data)
12
12
 
13
13
  # Raw components are source HTML/Tailwind files that have embedded information such as tailwind.config.js and usage instructions
14
- raw_component_path = File.expand_path('~/dev/kgems/k_templates/templates/tailwind')
14
+ source_component_path = File.expand_path('~/dev/kgems/k_templates/templates/tailwind')
15
15
 
16
16
  # Target components are the processed components that are ready to be consumed by the TailwindDSL
17
- component_folder = k_builder.target_folders.get(:components)
17
+ target_component_path = k_builder.target_folders.get(:components)
18
+
19
+ # The component data shapes are reflected model based on the data inside of a HTML templates
20
+ target_component_model_path = k_builder.target_folders.get(:component_models)
18
21
 
19
- uikit = helpers.build_design_systems(raw_component_path)
20
- json = JSON.pretty_generate(uikit.to_h)
22
+ # Builds the design_system.json by reading all the HTML templates for every UIKit found the source_component_path
23
+ uikit = helpers.build_design_systems(source_component_path)
21
24
 
22
- add('design_system.json', content: json)
25
+ add('design_system.json', content: JSON.pretty_generate(uikit.to_h))
23
26
 
24
- helpers.generate_components(uikit, raw_component_path, component_folder, reset_root_path: false)
27
+ # Separate clean and raw components, tailwind configuration, settings into their own folders
28
+ component_generator = helpers.generate_components(uikit, source_component_path, target_component_path, reset_root_path: false)
29
+ components = component_generator.components
30
+
31
+ # Use GPT3 to extract component models in supervised fashion
32
+ helpers.extract_next_component_model(components, target_component_model_path, batch_size: 1, use_prompt: true, filter_design_system: 'tui')
33
+ # puts target_component_path
34
+ # /Users/davidcruwys/dev/kgems/tailwind_dsl/.components
25
35
 
26
36
  # Goals
27
37
  # - Generate a Tailwind component complete design system so that I can see both the component plus the original source code
28
- # There should be a deep hierarchy of folders and files in a menu structure
38
+ # [✔️] There should be a deep hierarchy of folders and files in a menu structure
29
39
  # When you click on a menu item, there should be a preview of the component
30
40
  # The menus should be collapsible
31
41
  # The menus should be searchable
@@ -39,21 +49,32 @@ KManager.action :utilities do
39
49
 
40
50
  end
41
51
 
42
- def build_design_systems(raw_component_path)
52
+ def build_design_systems(source_component_path)
43
53
  director = TailwindDsl::Etl::RawComponents::Director.new
44
54
 
45
- director.add_design_system(File.join(raw_component_path, 'tui'))
46
- # director.add_design_system(File.join(raw_component_path, 'codepen'))
47
- # director.add_design_system(File.join(raw_component_path, 'devdojo'))
48
- # director.add_design_system(File.join(raw_component_path, 'merakiui'))
49
- # director.add_design_system(File.join(raw_component_path, 'noq'))
50
- # director.add_design_system(File.join(raw_component_path, 'starter-kit'))
55
+ director.add_design_system(File.join(source_component_path, 'tui'))
56
+ # director.add_design_system(File.join(source_component_path, 'codepen'))
57
+ # director.add_design_system(File.join(source_component_path, 'devdojo'))
58
+ # director.add_design_system(File.join(source_component_path, 'merakiui'))
59
+ # director.add_design_system(File.join(source_component_path, 'noq'))
60
+ # director.add_design_system(File.join(source_component_path, 'starter-kit'))
51
61
  director.uikit
52
62
  end
53
63
 
54
- def generate_components(uikit, raw_component_path, target_folder, reset_root_path: false)
55
- generator = TailwindDsl::Etl::ComponentStructures::Generator.new(uikit, raw_component_path, target_folder, reset_root_path: reset_root_path)
64
+ def generate_components(uikit, source_component_path, target_folder, reset_root_path: false)
65
+ generator = TailwindDsl::Etl::ComponentStructures::Generator.new(uikit, source_component_path, target_folder, reset_root_path: reset_root_path)
56
66
  generator.generate
67
+ generator
68
+ end
69
+
70
+ # Extracts the next component model using GPT3
71
+ #
72
+ # This needs to be supervised and verified, so it will only do a few models at a time
73
+ def extract_next_component_model(components, target_folder, batch_size: 1, use_prompt: false, filter_design_system: nil)
74
+ puts target_folder
75
+ extractor = TailwindDsl::Etl::ComponentModels::Extractor.new(components, target_folder, batch_size: batch_size, use_prompt: use_prompt, filter_design_system: filter_design_system)
76
+ extractor.extract
57
77
  end
58
78
  end
79
+
59
80
  KManager.opts.sleep = 2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.0.13](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.12...v0.0.13) (2022-10-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refactor tests ([91b730d](https://github.com/klueless-io/tailwind_dsl/commit/91b730d91f99cf06810581d2d1684bb836eae860))
7
+
1
8
  ## [0.0.12](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.11...v0.0.12) (2022-10-14)
2
9
 
3
10
 
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TailwindDsl
4
+ module Etl
5
+ module ComponentModels
6
+ # Extract component models by reading the cleansed component HTML and then using GPT3 to infer both the data/model structure.
7
+ class Extractor
8
+ attr_reader :uikit
9
+ attr_reader :target_root_path
10
+ attr_reader :batch_size
11
+ attr_reader :use_prompt
12
+
13
+ def initialize(uikit, target_root_path, batch_size: 1, use_prompt: false, filter_design_system: nil)
14
+ @uikit = uikit
15
+ @target_root_path = target_root_path
16
+ @batch_size = batch_size
17
+ @batch_left = batch_size
18
+ @use_prompt = use_prompt
19
+ end
20
+
21
+ # Goal: Extract the next (batch_size) component models using GPT3 and save them to target_root_path
22
+ # Create a data file at: design_system.name -> group-hierarchy -> component-name.data.json
23
+ # Create a model file at: design_system.name -> group-hierarchy -> component-name.model.rb
24
+
25
+ # Process: Collect all components and optionally filter them by design system name.
26
+ # Look for the next component to be processed, if it does not exist in the target folder then process it.
27
+ # decrement the batch_left counter and continue until batch_left is 0.
28
+ # if :use_prompt is true then display the input/output files and ask if you wish to process the component or skip.
29
+ # process the component by calling the GPT3 API and save the results to the target folder.
30
+
31
+ def extract; end
32
+
33
+ # def components
34
+ # @components ||= uikit.design_systems.map do |design_system|
35
+ # design_system.components.map do |component|
36
+ # Component.new(design_system, component, source_root_path, target_root_path)
37
+ # end
38
+ # end.flatten
39
+ # end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -3,6 +3,8 @@
3
3
  module TailwindDsl
4
4
  module Etl
5
5
  module RawComponents
6
+ # NOTE: Director is badly named.
7
+
6
8
  # Use the Director to build the UiKit which will store the JSON representations of each Design System plus components.
7
9
  #
8
10
  # This is a raw representation of the source.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindDsl
4
- VERSION = '0.0.13'
4
+ VERSION = '0.0.14'
5
5
  end
data/lib/tailwind_dsl.rb CHANGED
@@ -17,6 +17,8 @@ require_relative 'tailwind_dsl/etl/raw_components/schema/uikit'
17
17
 
18
18
  require_relative 'tailwind_dsl/etl/component_structures/raw_component_query'
19
19
  require_relative 'tailwind_dsl/etl/component_structures/generator'
20
+
21
+ require_relative 'tailwind_dsl/etl/component_models/extractor'
20
22
  # require_relative 'tailwind_dsl/astro_demo/generate_astro_page_data'
21
23
 
22
24
  module TailwindDsl
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tailwind_dsl",
9
- "version": "0.0.13",
9
+ "version": "0.0.14",
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.13",
3
+ "version": "0.0.14",
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,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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -2151,6 +2151,7 @@ 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_models/extractor.rb
2154
2155
  - lib/tailwind_dsl/etl/component_structures/generator.rb
2155
2156
  - lib/tailwind_dsl/etl/component_structures/raw_component_query.rb
2156
2157
  - lib/tailwind_dsl/etl/element.rb