foobara-typescript-react-command-form-generator 0.0.3 → 0.0.5
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/CHANGELOG.md +9 -0
- data/src/typescript_react_command_form_generator.rb +17 -15
- data/templates/CommandForm.tsx.erb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98f12c88a8181b6b5e97ce639cf82f169e085e7a2f2ad0766028d20cdee4ee01
|
4
|
+
data.tar.gz: 88965d8870c4b33f9f7456abc9e9a5d348acd61b8bffe1833ba4f28494a75381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b5d9b8836f3306141791e7c4f02ba929439a7f82679003bbc7b36d55995e63ef9e102feb3e3704d9f8cab3d442a6106654d93af6567d8db36dd17c625cb9aeb
|
7
|
+
data.tar.gz: d62086d2df517d675be8f99df7e2dba8f50d7a490d369497b6b2c49427f44022313a8b8af45158285ceb6e774d5afb0f4b8aa598ea6e8606cacb2d320b885202
|
data/CHANGELOG.md
CHANGED
@@ -32,37 +32,39 @@ module Foobara
|
|
32
32
|
@command_generator ||= RemoteGenerator::Services::CommandGenerator.new(command_manifest)
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
return @
|
35
|
+
def type_generators(type_declaration = inputs_type, initial = true)
|
36
|
+
return @type_generators if defined?(@type_generators)
|
37
37
|
|
38
|
-
generators = if
|
38
|
+
generators = if type_declaration.entity?
|
39
39
|
generator_class = RemoteGenerator::Services::UnloadedEntityGenerator
|
40
|
-
[generator_class.new(
|
41
|
-
elsif
|
40
|
+
[generator_class.new(type_declaration.to_entity)]
|
41
|
+
elsif type_declaration.model?
|
42
42
|
generator_class = RemoteGenerator::Services::AtomModelGenerator
|
43
|
-
[generator_class.new(
|
44
|
-
elsif
|
45
|
-
|
46
|
-
|
43
|
+
[generator_class.new(type_declaration.to_model)]
|
44
|
+
elsif type_declaration.type.to_sym == :attributes
|
45
|
+
type_declaration.attribute_declarations.values.map do |attribute_declaration|
|
46
|
+
type_generators(attribute_declaration, false)
|
47
47
|
end.flatten.uniq
|
48
|
-
elsif
|
49
|
-
if
|
50
|
-
|
48
|
+
elsif type_declaration.is_a?(Manifest::Array)
|
49
|
+
if type_declaration.element_type
|
50
|
+
type_generators(type_declaration.element_type, false)
|
51
51
|
end
|
52
|
+
elsif type_declaration.custom?
|
53
|
+
generator_for(type_declaration.to_type)
|
52
54
|
else
|
53
55
|
# TODO: handle tuples and associative arrays
|
54
56
|
[]
|
55
57
|
end
|
56
58
|
|
57
59
|
if initial
|
58
|
-
@
|
60
|
+
@type_generators = generators
|
59
61
|
end
|
60
62
|
|
61
63
|
generators
|
62
64
|
end
|
63
65
|
|
64
66
|
def dependencies
|
65
|
-
[
|
67
|
+
[type_generators, *type_generators.map(&:dependencies)].flatten.uniq
|
66
68
|
end
|
67
69
|
|
68
70
|
def dependencies_to_generate
|
@@ -103,7 +105,7 @@ module Foobara
|
|
103
105
|
non_colliding_inputs(type_declaration.to_type.attributes_type, result, path)
|
104
106
|
elsif type_declaration.array?
|
105
107
|
if type_declaration.element_type
|
106
|
-
|
108
|
+
type_generators(type_declaration.element_type, false)
|
107
109
|
end
|
108
110
|
else
|
109
111
|
result << FlattenedAttribute.new(self, path, type_declaration)
|
@@ -7,6 +7,10 @@ import <%= inputs_class_name %> from "<%= path_to_root %><%= command_generator.i
|
|
7
7
|
import <%= result_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Result"
|
8
8
|
import { Error as <%= error_class_name %> } from "<%= path_to_root %><%= command_generator.import_path %>/Errors"
|
9
9
|
|
10
|
+
<% dependency_roots.each do |dependency_root| %>
|
11
|
+
import <%= dependency_root.import_destructure %> from "<%= path_to_root %><%= dependency_root.import_path %>"
|
12
|
+
<% end %>
|
13
|
+
|
10
14
|
export default function <%= command_name %>Form (): JSX.Element {
|
11
15
|
<% non_colliding_inputs.each do |flattened_attribute| %>
|
12
16
|
<% if flattened_attribute.has_default? %>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-typescript-react-command-form-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: foobara
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.6.
|
91
|
+
rubygems_version: 3.6.3
|
92
92
|
specification_version: 4
|
93
93
|
summary: Generates Typescript React forms for Foobara remote commands
|
94
94
|
test_files: []
|