Skip to content

Commit 18b2b36

Browse files
committed
Don't make use of Inputs for commands that don't have inputs
1 parent 6042f8e commit 18b2b36

File tree

7 files changed

+41
-29
lines changed

7 files changed

+41
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.0.9] - 2025-04-08
2+
3+
- Don't make use of inputs for commands that don't have inputs
4+
15
## [0.0.8] - 2025-03-22
26

37
- Use password inputs for sensitive types

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem "rake"
1111
# gem "foobara-typescript-remote-command-generator", path: "../typescript-remote-command-generator"
1212

1313
group :development do
14-
gem "foobara-rubocop-rules"
14+
gem "foobara-rubocop-rules", "~> 0.0.1"
1515
gem "guard-rspec"
1616
gem "rubocop-rake"
1717
gem "rubocop-rspec"
@@ -23,7 +23,7 @@ group :development, :test do
2323
end
2424

2525
group :test do
26-
gem "foobara-spec-helpers"
26+
gem "foobara-spec-helpers", "~> 0.0.1"
2727
gem "rspec"
2828
gem "rspec-its"
2929
gem "simplecov"

Gemfile.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
PATH
22
remote: .
33
specs:
4-
foobara-typescript-react-command-form-generator (0.0.8)
5-
foobara
6-
foobara-files-generator
7-
foobara-typescript-remote-command-generator
4+
foobara-typescript-react-command-form-generator (0.0.9)
5+
foobara-typescript-remote-command-generator (~> 0.0.1)
86

97
GEM
108
remote: https://rubygems.org/
119
specs:
1210
ast (2.4.3)
1311
bigdecimal (3.1.9)
14-
byebug (11.1.3)
12+
byebug (12.0.0)
1513
coderay (1.1.3)
16-
diff-lcs (1.6.0)
14+
diff-lcs (1.6.1)
1715
docile (1.4.1)
1816
ffi (1.17.1-x86_64-linux-gnu)
19-
foobara (0.0.85)
17+
foobara (0.0.95)
2018
bigdecimal
21-
foobara-lru-cache
22-
foobara-util
19+
foobara-lru-cache (~> 0.0.2)
20+
foobara-util (~> 0.0.11)
2321
foobara-files-generator (0.0.5)
2422
foobara
2523
foobara-lru-cache (0.0.2)
@@ -28,9 +26,9 @@ GEM
2826
rubocop-rspec
2927
foobara-spec-helpers (0.0.4)
3028
foobara-util
31-
foobara-typescript-remote-command-generator (0.0.13)
32-
foobara
33-
foobara-files-generator
29+
foobara-typescript-remote-command-generator (0.0.16)
30+
foobara (~> 0.0.88)
31+
foobara-files-generator (~> 0.0.1)
3432
foobara-util (0.0.11)
3533
formatador (1.1.0)
3634
guard (2.19.1)
@@ -55,7 +53,7 @@ GEM
5553
listen (3.9.0)
5654
rb-fsevent (~> 0.10, >= 0.10.3)
5755
rb-inotify (~> 0.9, >= 0.9.10)
58-
logger (1.6.6)
56+
logger (1.7.0)
5957
lumberjack (1.2.10)
6058
method_source (1.1.0)
6159
nenv (0.3.0)
@@ -64,15 +62,16 @@ GEM
6462
shellany (~> 0.0)
6563
ostruct (0.6.1)
6664
parallel (1.26.3)
67-
parser (3.3.7.2)
65+
parser (3.3.7.4)
6866
ast (~> 2.4.1)
6967
racc
70-
pry (0.14.2)
68+
prism (1.4.0)
69+
pry (0.15.2)
7170
coderay (~> 1.1)
7271
method_source (~> 1.0)
73-
pry-byebug (3.10.1)
74-
byebug (~> 11.0)
75-
pry (>= 0.13, < 0.15)
72+
pry-byebug (3.11.0)
73+
byebug (~> 12.0)
74+
pry (>= 0.13, < 0.16)
7675
racc (1.8.1)
7776
rainbow (3.1.1)
7877
rake (13.2.1)
@@ -96,19 +95,20 @@ GEM
9695
diff-lcs (>= 1.2.0, < 2.0)
9796
rspec-support (~> 3.13.0)
9897
rspec-support (3.13.2)
99-
rubocop (1.74.0)
98+
rubocop (1.75.2)
10099
json (~> 2.3)
101100
language_server-protocol (~> 3.17.0.2)
102101
lint_roller (~> 1.1.0)
103102
parallel (~> 1.10)
104103
parser (>= 3.3.0.2)
105104
rainbow (>= 2.2.2, < 4.0)
106105
regexp_parser (>= 2.9.3, < 3.0)
107-
rubocop-ast (>= 1.38.0, < 2.0)
106+
rubocop-ast (>= 1.44.0, < 2.0)
108107
ruby-progressbar (~> 1.7)
109108
unicode-display_width (>= 2.4.0, < 4.0)
110-
rubocop-ast (1.41.0)
109+
rubocop-ast (1.44.0)
111110
parser (>= 3.3.7.2)
111+
prism (~> 1.4)
112112
rubocop-rake (0.7.1)
113113
lint_roller (~> 1.1)
114114
rubocop (>= 1.72.1)
@@ -132,8 +132,8 @@ PLATFORMS
132132
x86_64-linux
133133

134134
DEPENDENCIES
135-
foobara-rubocop-rules
136-
foobara-spec-helpers
135+
foobara-rubocop-rules (~> 0.0.1)
136+
foobara-spec-helpers (~> 0.0.1)
137137
foobara-typescript-react-command-form-generator!
138138
guard-rspec
139139
pry

foobara-typescript-react-command-form-generator.gemspec

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ Gem::Specification.new do |spec|
2121
spec.metadata["source_code_uri"] = spec.homepage
2222
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
2323

24-
spec.add_dependency "foobara"
25-
spec.add_dependency "foobara-files-generator"
26-
spec.add_dependency "foobara-typescript-remote-command-generator"
24+
spec.add_dependency "foobara-typescript-remote-command-generator", "~> 0.0.1"
2725

2826
spec.files = Dir[
2927
"lib/**/*",

src/typescript_react_command_form_generator.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def templates_dir
7777
"#{__dir__}/../templates"
7878
end
7979

80+
def empty_inputs?
81+
inputs_type.empty?
82+
end
83+
8084
def inputs_class_name
8185
"#{command_name}Inputs"
8286
end

templates/CommandForm.tsx.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import React, { useState, JSX } from 'react'
33
import { Outcome } from "<%= path_to_root %>/base/Outcome"
44

55
import { <%= command_name %> } from "<%= path_to_root %><%= command_generator.import_path %>"
6+
<% unless empty_inputs? %>
67
import <%= inputs_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Inputs"
8+
<% end %>
79
import <%= result_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Result"
810
import { Error as <%= error_class_name %> } from "<%= path_to_root %><%= command_generator.import_path %>/Errors"
911

@@ -37,9 +39,13 @@ export default function <%= command_name %>Form (): JSX.Element {
3739
}
3840
<% end %>
3941

42+
<% if empty_inputs? %>
43+
const command = new <%= command_name %>()
44+
<% else %>
4045
const inputs: <%= inputs_class_name %> = <%= populated_inputs_object %>
4146

4247
const command = new <%= command_name %>(inputs)
48+
<% end %>
4349

4450
try {
4551
setResult("Thinking...")

version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Foobara
22
module Generators
33
module TypescriptReactCommandFormGenerator
4-
VERSION = "0.0.8".freeze
4+
VERSION = "0.0.9".freeze
55

66
local_ruby_version = File.read("#{__dir__}/.ruby-version").chomp
77
local_ruby_version_minor = local_ruby_version[/\A(\d+\.\d+)\.\d+\z/, 1]

0 commit comments

Comments
 (0)