Skip to content

Commit 0ee73b2

Browse files
committed
Fix generators type
1 parent 93c4475 commit 0ee73b2

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,39 +139,119 @@ export default async () => ({});
139139
export type Config = {
140140
generators?: {
141141
component?: {
142+
// Generate a `class-based` component, instead of a `template-only` component:
142143
classBased?: boolean;
144+
// Copy the generated component to the clipboard, instead of writing it to disk:
145+
copy?: boolean;
146+
// Log the generated component to the console, instead of writing it to disk:
147+
log?: boolean;
148+
// The component's name:
149+
name?: string;
150+
// Generate a nested colocated component, e.g. `foo/bar/index.gts`:
143151
nested?: boolean;
152+
// Generate a component at a custom path, e.g. `--path=src/-private`:
144153
path?: string;
154+
// Generate a `.gts` component, instead of a `.gjs` component:
145155
typescript?: boolean;
146156
};
147157
"component-test"?: {
158+
// Copy the generated component-test to the clipboard, instead of writing it to disk:
159+
copy?: boolean;
160+
// Log the generated component-test to the console, instead of writing it to disk:
161+
log?: boolean;
162+
// The component-test's name:
163+
name?: string;
164+
// Generate a component-test at a custom path, e.g. `--path=src/-private`:
148165
path?: string;
166+
// Generate a `.gts` component-test, instead of a `.gjs` component-test:
149167
typescript?: boolean;
150168
};
151169
helper?: {
170+
// Generate a `class-based` helper, instead of a `function-based` helper:
152171
classBased?: boolean;
172+
// Copy the generated helper to the clipboard, instead of writing it to disk:
173+
copy?: boolean;
174+
// Log the generated helper to the console, instead of writing it to disk:
175+
log?: boolean;
176+
// The helper's name:
177+
name?: string;
178+
// Generate a helper at a custom path, e.g. `--path=src/-private`:
153179
path?: string;
180+
// Generate a `.ts` helper, instead of a `.js` helper:
154181
typescript?: boolean;
155182
};
156183
"helper-test"?: {
184+
// Copy the generated helper-test to the clipboard, instead of writing it to disk:
185+
copy?: boolean;
186+
// Log the generated helper-test to the console, instead of writing it to disk:
187+
log?: boolean;
188+
// The helper-test's name:
189+
name?: string;
190+
// Generate a helper-test at a custom path, e.g. `--path=src/-private`:
157191
path?: string;
192+
// Generate a `.gts` helper-test, instead of a `.gjs` helper-test:
158193
typescript?: boolean;
159194
};
160195
modifier?: {
196+
// Generate a `class-based` modifier, instead of a `function-based` modifier:
161197
classBased?: boolean;
198+
// Copy the generated modifier to the clipboard, instead of writing it to disk:
199+
copy?: boolean;
200+
// Log the generated modifier to the console, instead of writing it to disk:
201+
log?: boolean;
202+
// The modifier's name:
203+
name?: string;
204+
// Generate a modifier at a custom path, e.g. `--path=src/-private`:
162205
path?: string;
206+
// Generate a `.ts` modifier, instead of a `.js` modifier:
163207
typescript?: boolean;
164208
};
165209
"modifier-test"?: {
210+
// Copy the generated modifier-test to the clipboard, instead of writing it to disk:
211+
copy?: boolean;
212+
// Log the generated modifier-test to the console, instead of writing it to disk:
213+
log?: boolean;
214+
// The modifier-test's name:
215+
name?: string;
216+
// Generate a modifier-test at a custom path, e.g. `--path=src/-private`:
166217
path?: string;
218+
// Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test:
167219
typescript?: boolean;
168220
};
169221
service?: {
222+
// Copy the generated service to the clipboard, instead of writing it to disk:
223+
copy?: boolean;
224+
// Log the generated service to the console, instead of writing it to disk:
225+
log?: boolean;
226+
// The service's name:
227+
name?: string;
228+
// Generate a service at a custom path, e.g. `--path=src/-private`:
170229
path?: string;
230+
// Generate a `.ts` service, instead of a `.js` service:
171231
typescript?: boolean;
172232
};
173233
"service-test"?: {
234+
// Copy the generated service-test to the clipboard, instead of writing it to disk:
235+
copy?: boolean;
236+
// Log the generated service-test to the console, instead of writing it to disk:
237+
log?: boolean;
238+
// The service-test's name:
239+
name?: string;
240+
// Generate a service-test at a custom path, e.g. `--path=src/-private`:
174241
path?: string;
242+
// Generate a `.ts` service-test, instead of a `.js` service-test:
243+
typescript?: boolean;
244+
};
245+
"acceptance-test"?: {
246+
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
247+
copy?: boolean;
248+
// Log the generated acceptance-test to the console, instead of writing it to disk:
249+
log?: boolean;
250+
// The acceptance-test's name:
251+
name?: string;
252+
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
253+
path?: string;
254+
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
175255
typescript?: boolean;
176256
};
177257
};

dev/generators-type.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// eslint-disable-next-line n/no-missing-import
2+
import { generators } from "../dist/generators.js";
3+
4+
let generatorsType = "";
5+
6+
for (const generator of generators) {
7+
generatorsType += `${generator.name.includes("-") ? `"${generator.name}"` : generator.name}?: {\n`;
8+
9+
for (const arg of generator.args) {
10+
generatorsType += ` // ${arg.description}:\n`;
11+
generatorsType += ` ${arg.name}?: ${arg.type === "positional" ? "string" : arg.type};\n`;
12+
}
13+
14+
generatorsType += `};\n`;
15+
}
16+
17+
console.log(generatorsType);

src/config.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,119 @@ import type { GeneratorFile } from "./types.js";
66
export type Config = {
77
generators?: {
88
component?: {
9+
// Generate a `class-based` component, instead of a `template-only` component:
910
classBased?: boolean;
11+
// Copy the generated component to the clipboard, instead of writing it to disk:
12+
copy?: boolean;
13+
// Log the generated component to the console, instead of writing it to disk:
14+
log?: boolean;
15+
// The component's name:
16+
name?: string;
17+
// Generate a nested colocated component, e.g. `foo/bar/index.gts`:
1018
nested?: boolean;
19+
// Generate a component at a custom path, e.g. `--path=src/-private`:
1120
path?: string;
21+
// Generate a `.gts` component, instead of a `.gjs` component:
1222
typescript?: boolean;
1323
};
1424
"component-test"?: {
25+
// Copy the generated component-test to the clipboard, instead of writing it to disk:
26+
copy?: boolean;
27+
// Log the generated component-test to the console, instead of writing it to disk:
28+
log?: boolean;
29+
// The component-test's name:
30+
name?: string;
31+
// Generate a component-test at a custom path, e.g. `--path=src/-private`:
1532
path?: string;
33+
// Generate a `.gts` component-test, instead of a `.gjs` component-test:
1634
typescript?: boolean;
1735
};
1836
helper?: {
37+
// Generate a `class-based` helper, instead of a `function-based` helper:
1938
classBased?: boolean;
39+
// Copy the generated helper to the clipboard, instead of writing it to disk:
40+
copy?: boolean;
41+
// Log the generated helper to the console, instead of writing it to disk:
42+
log?: boolean;
43+
// The helper's name:
44+
name?: string;
45+
// Generate a helper at a custom path, e.g. `--path=src/-private`:
2046
path?: string;
47+
// Generate a `.ts` helper, instead of a `.js` helper:
2148
typescript?: boolean;
2249
};
2350
"helper-test"?: {
51+
// Copy the generated helper-test to the clipboard, instead of writing it to disk:
52+
copy?: boolean;
53+
// Log the generated helper-test to the console, instead of writing it to disk:
54+
log?: boolean;
55+
// The helper-test's name:
56+
name?: string;
57+
// Generate a helper-test at a custom path, e.g. `--path=src/-private`:
2458
path?: string;
59+
// Generate a `.gts` helper-test, instead of a `.gjs` helper-test:
2560
typescript?: boolean;
2661
};
2762
modifier?: {
63+
// Generate a `class-based` modifier, instead of a `function-based` modifier:
2864
classBased?: boolean;
65+
// Copy the generated modifier to the clipboard, instead of writing it to disk:
66+
copy?: boolean;
67+
// Log the generated modifier to the console, instead of writing it to disk:
68+
log?: boolean;
69+
// The modifier's name:
70+
name?: string;
71+
// Generate a modifier at a custom path, e.g. `--path=src/-private`:
2972
path?: string;
73+
// Generate a `.ts` modifier, instead of a `.js` modifier:
3074
typescript?: boolean;
3175
};
3276
"modifier-test"?: {
77+
// Copy the generated modifier-test to the clipboard, instead of writing it to disk:
78+
copy?: boolean;
79+
// Log the generated modifier-test to the console, instead of writing it to disk:
80+
log?: boolean;
81+
// The modifier-test's name:
82+
name?: string;
83+
// Generate a modifier-test at a custom path, e.g. `--path=src/-private`:
3384
path?: string;
85+
// Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test:
3486
typescript?: boolean;
3587
};
3688
service?: {
89+
// Copy the generated service to the clipboard, instead of writing it to disk:
90+
copy?: boolean;
91+
// Log the generated service to the console, instead of writing it to disk:
92+
log?: boolean;
93+
// The service's name:
94+
name?: string;
95+
// Generate a service at a custom path, e.g. `--path=src/-private`:
3796
path?: string;
97+
// Generate a `.ts` service, instead of a `.js` service:
3898
typescript?: boolean;
3999
};
40100
"service-test"?: {
101+
// Copy the generated service-test to the clipboard, instead of writing it to disk:
102+
copy?: boolean;
103+
// Log the generated service-test to the console, instead of writing it to disk:
104+
log?: boolean;
105+
// The service-test's name:
106+
name?: string;
107+
// Generate a service-test at a custom path, e.g. `--path=src/-private`:
41108
path?: string;
109+
// Generate a `.ts` service-test, instead of a `.js` service-test:
110+
typescript?: boolean;
111+
};
112+
"acceptance-test"?: {
113+
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
114+
copy?: boolean;
115+
// Log the generated acceptance-test to the console, instead of writing it to disk:
116+
log?: boolean;
117+
// The acceptance-test's name:
118+
name?: string;
119+
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
120+
path?: string;
121+
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
42122
typescript?: boolean;
43123
};
44124
};

0 commit comments

Comments
 (0)