@odg/command 1.12.0 → 1.14.0
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.
- package/agents.md +334 -26
- package/dist/Generators/MakeFile.d.ts +46 -35
- package/dist/Generators/MakeFile.js +94 -52
- package/dist/Generators/MakeFile.js.map +1 -1
- package/dist/Generators/StubCreator.d.ts +1 -1
- package/dist/Generators/StubCreator.js +17 -42
- package/dist/Generators/StubCreator.js.map +1 -1
- package/dist/Registrations/pascal-to-dot-lower.d.ts +15 -0
- package/dist/Registrations/pascal-to-dot-lower.js +31 -0
- package/dist/Registrations/pascal-to-dot-lower.js.map +1 -0
- package/dist/Registrations/register.d.ts +2 -0
- package/dist/Registrations/register.js +215 -0
- package/dist/Registrations/register.js.map +1 -0
- package/dist/Registrations/ts-mutators.d.ts +40 -0
- package/dist/Registrations/ts-mutators.js +202 -0
- package/dist/Registrations/ts-mutators.js.map +1 -0
- package/dist/Registrations/types.d.ts +34 -0
- package/dist/Registrations/types.js +3 -0
- package/dist/Registrations/types.js.map +1 -0
- package/dist/index.js +79 -13
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/stubs/event.stub +7 -7
- package/stubs/handler.stub +11 -33
- package/stubs/page.stub +3 -23
- package/stubs/selector.stub +2 -0
package/agents.md
CHANGED
|
@@ -1,32 +1,340 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
# @odg/command - Proposed Agent Guidance
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
- `@odg/command` is a CLI-first package.
|
|
6
|
+
- Agents MUST treat it as a scaffolding tool consumed through `yarn odg <command>`.
|
|
7
|
+
- Do not describe or use it as a library-first API.
|
|
8
|
+
|
|
9
|
+
## Core Rule
|
|
10
|
+
|
|
11
|
+
- Always reason from the real CLI contract: command, positional input, flags, defaults and generated files.
|
|
12
|
+
- Before proposing manual file creation, check whether `yarn odg` already covers the artifact.
|
|
13
|
+
- If the correct command or naming is still unclear after checking the contract, ask the user.
|
|
14
|
+
|
|
15
|
+
## Command Reference
|
|
16
|
+
|
|
17
|
+
### make:page
|
|
18
|
+
|
|
19
|
+
Purpose:
|
|
20
|
+
|
|
21
|
+
- Generate a new crawler page scaffold.
|
|
22
|
+
|
|
23
|
+
Syntax:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn odg make:page <pageName>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Flags:
|
|
30
|
+
|
|
31
|
+
- `-p, --path` → output path for the page. Default: `./src/Pages/`
|
|
32
|
+
- `--selectors` → also generate selectors for the page
|
|
33
|
+
- `--selectorPath` → custom selector output path
|
|
34
|
+
- `-e, --event` → also generate the event/listener scaffold for this page
|
|
35
|
+
- `--eventPath` → custom listener output path. Default: `./src/app/Listeners/`
|
|
36
|
+
- `--handlerPath` → custom handler output path when generating linked handler
|
|
37
|
+
- `--handler-from` → generate handler using `<from>To<to>Handler` convention
|
|
38
|
+
- `--handler-to` → generate handler using `<from>To<to>Handler` convention
|
|
39
|
+
- `--register` → enable post-scaffold registration. Default: `false`
|
|
40
|
+
- `--containerEnumPath` → custom ContainerName enum path. Default: `./src/app/Enums/ContainerName.ts`
|
|
41
|
+
- `--eventEnumPath` → custom EventName enum path. Default: `./src/app/Enums/EventName.ts`
|
|
42
|
+
- `--configEnumPath` → custom ConfigName enum path. Default: `./src/app/Enums/ConfigName.ts`
|
|
43
|
+
- `--containerInterfacePath` → custom ContainerInterface path. Default: `./@types/ContainerInterface.d.ts`
|
|
44
|
+
- `--eventsInterfacePath` → custom EventsInterface path. Default: `./@types/EventsInterface.d.ts`
|
|
45
|
+
- `--pagesIndexPath` → custom pages barrel path. Default: `./src/Pages/index.ts`
|
|
46
|
+
- `--selectorsIndexPath` → custom selectors barrel path. Default: `./src/Selectors/index.ts`
|
|
47
|
+
- `--handlersIndexPath` → custom handlers barrel path. Default: `./src/Handlers/index.ts`
|
|
48
|
+
- `--listenersIndexPath` → custom listeners barrel path. Default: `./src/app/Listeners/index.ts`
|
|
49
|
+
- `--envExamplePath` → custom `.env.example` path. Default: `./.env.example`
|
|
50
|
+
- `--typeImport <statement>` → explicit top-level import statement to inject. Repeatable.
|
|
51
|
+
- `--eventPayloadType <type>` → explicit EventsInterface payload type. Default: `EventBrowserParameters`
|
|
52
|
+
|
|
53
|
+
Operational notes:
|
|
54
|
+
|
|
55
|
+
- `make:page` only triggers handler generation if `handlerPath` exists and at least one of `handler-from` or `handler-to` is provided.
|
|
56
|
+
- The command input is the base page name, not the final class name with `Page` suffix.
|
|
57
|
+
- When `--register` is enabled, registration flags are also forwarded to selector/event/handler add-ons generated by the same `make:page` command.
|
|
58
|
+
- Prefer explicit registration flags instead of assuming app structure when the target project differs from the default ODG layout.
|
|
59
|
+
|
|
60
|
+
Examples:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Generate only page
|
|
64
|
+
# Arquivo gerado: src/Pages/SearchPage.ts
|
|
65
|
+
yarn odg make:page Search
|
|
66
|
+
|
|
67
|
+
# Generate Page + selector
|
|
68
|
+
# output file: src/Pages/LoginPage.ts & src/Selectors/LoginSelector.ts
|
|
69
|
+
yarn odg make:page Login --selectors
|
|
70
|
+
|
|
71
|
+
# Generate Page + event listener
|
|
72
|
+
# output file: src/Pages/LoginPage.ts & src/app/Listeners/LoginEventListener.ts
|
|
73
|
+
yarn odg make:page Login --event
|
|
74
|
+
|
|
75
|
+
# Generate Page + selector + listener (complete combination)
|
|
76
|
+
# output files: src/Pages/LoginPage.ts & src/Selectors/LoginSelector.ts & src/app/Listeners/LoginEventListener.ts
|
|
77
|
+
yarn odg make:page Login --selectors --event
|
|
78
|
+
|
|
79
|
+
# Generate Page + transition handler (requires at least one of --handler-from/--handler-to)
|
|
80
|
+
# output files: src/Pages/LoginPage.ts & src/Handlers/Auth/LoginToSearchHandler.ts
|
|
81
|
+
yarn odg make:page Login --handler-to Search --handlerPath src/Handlers/Auth
|
|
82
|
+
|
|
83
|
+
# Generate Page + transition handler (requires --handler-from/--handler-to)
|
|
84
|
+
# output files: src/Pages/LoginPage.ts & src/Handlers/HomeToLoginHandler.ts
|
|
85
|
+
yarn odg make:page Login --handler-from Home --handlerPath src/Handlers
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### make:selector
|
|
89
|
+
|
|
90
|
+
Purpose:
|
|
91
|
+
|
|
92
|
+
- Generate a selector object HTML scaffold.
|
|
93
|
+
|
|
94
|
+
Syntax:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
yarn odg make:selector <selectorName>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Flags:
|
|
101
|
+
|
|
102
|
+
- `-p, --path` → output path for selectors. Default: `./src/Selectors/`
|
|
103
|
+
- `--register` → enable post-scaffold registration. Default: `false`
|
|
104
|
+
- `--selectorsIndexPath` → custom selectors barrel path. Default: `./src/Selectors/index.ts`
|
|
105
|
+
- `--typeImport <statement>` → explicit top-level import statement to inject. Repeatable.
|
|
106
|
+
|
|
107
|
+
Operational notes:
|
|
108
|
+
|
|
109
|
+
- The command input is the base selector name.
|
|
110
|
+
- Preserve the naming convention already used by the selector namespace.
|
|
111
|
+
|
|
112
|
+
Examples:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Generate selector in default path
|
|
116
|
+
# Output file: src/Selectors/SearchSelector.ts
|
|
117
|
+
yarn odg make:selector Search
|
|
118
|
+
|
|
119
|
+
# Generate selector in specific subdirectory
|
|
120
|
+
# Output file: src/Selectors/Auth/GoogleLoginSelector.ts
|
|
121
|
+
yarn odg make:selector GoogleLogin -p src/Selectors/Auth
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### make:handler
|
|
125
|
+
|
|
126
|
+
Purpose:
|
|
127
|
+
|
|
128
|
+
- Generate a handler scaffold.
|
|
129
|
+
|
|
130
|
+
Syntax:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
yarn odg make:handler <handlerName>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Flags:
|
|
137
|
+
|
|
138
|
+
- `--handler-from` → origin name for `FromTo` handler generation
|
|
139
|
+
- `--handler-to` → destination name for `FromTo` handler generation
|
|
140
|
+
- `-p, --path` → output path for handlers. Default: `./src/Handlers/`
|
|
141
|
+
- `--register` → enable post-scaffold registration. Default: `false`
|
|
142
|
+
- `--containerEnumPath` → custom ContainerName enum path. Default: `./src/app/Enums/ContainerName.ts`
|
|
143
|
+
- `--containerInterfacePath` → custom ContainerInterface path. Default: `./@types/ContainerInterface.d.ts`
|
|
144
|
+
- `--handlersIndexPath` → custom handlers barrel path. Default: `./src/Handlers/index.ts`
|
|
145
|
+
- `--typeImport <statement>` → explicit top-level import statement to inject. Repeatable.
|
|
146
|
+
|
|
147
|
+
Generated naming:
|
|
148
|
+
|
|
149
|
+
- Without `--handler-from` and `--handler-to` → `<HandlerName>Handler`
|
|
150
|
+
- With either flag → `<From>To<To>Handler`
|
|
151
|
+
|
|
152
|
+
Operational notes:
|
|
153
|
+
|
|
154
|
+
- Use `ExampleHandler` when the handler validates a result.
|
|
155
|
+
- Use `ExampleToDestinationHandler` only when the handler validates a specific transition.
|
|
156
|
+
- If the validation responsibility is unclear, ask before choosing the name.
|
|
157
|
+
|
|
158
|
+
Examples:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Generate handler — check a result (without transition)
|
|
162
|
+
# Output file: src/Handlers/LoginHandler.ts
|
|
163
|
+
yarn odg make:handler Login
|
|
164
|
+
|
|
165
|
+
# Transition handler — validate transition from Buy to Payment
|
|
166
|
+
# Output file: src/Handlers/BuyToPaymentHandler.ts
|
|
167
|
+
yarn odg make:handler Buy --handler-to Payment
|
|
168
|
+
|
|
169
|
+
# Transition handler with explicit from and to in custom path
|
|
170
|
+
# The positional argument (Flow) is ignored in the name when --handler-from or --handler-to are used
|
|
171
|
+
# Output file: src/Handlers/Checkout/BuyToPaymentHandler.ts
|
|
172
|
+
yarn odg make:handler Flow --handler-from Buy --handler-to Payment -p src/Handlers/Checkout
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### `make:event <eventName>`
|
|
176
|
+
|
|
177
|
+
Purpose:
|
|
178
|
+
|
|
179
|
+
- Generate an event/listener scaffold.
|
|
180
|
+
|
|
181
|
+
Syntax:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
yarn odg make:event <eventName>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Flags:
|
|
188
|
+
|
|
189
|
+
- `-p, --path` → output path for listeners. Default: `./src/app/Listeners/`
|
|
190
|
+
- `--register` → enable post-scaffold registration. Default: `false`
|
|
191
|
+
- `--containerEnumPath` → custom ContainerName enum path. Default: `./src/app/Enums/ContainerName.ts`
|
|
192
|
+
- `--eventEnumPath` → custom EventName enum path. Default: `./src/app/Enums/EventName.ts`
|
|
193
|
+
- `--containerInterfacePath` → custom ContainerInterface path. Default: `./@types/ContainerInterface.d.ts`
|
|
194
|
+
- `--eventsInterfacePath` → custom EventsInterface path. Default: `./@types/EventsInterface.d.ts`
|
|
195
|
+
- `--listenersIndexPath` → custom listeners barrel path. Default: `./src/app/Listeners/index.ts`
|
|
196
|
+
- `--typeImport <statement>` → explicit top-level import statement to inject. Repeatable.
|
|
197
|
+
- `--eventPayloadType <type>` → explicit EventsInterface payload type. Default: `EventBrowserParameters`
|
|
198
|
+
|
|
199
|
+
Operational notes:
|
|
200
|
+
|
|
201
|
+
- The command input is the base resource name, not the final enum name.
|
|
202
|
+
|
|
203
|
+
Examples:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Correto: usar o nome-base do recurso
|
|
207
|
+
# Arquivo gerado: src/app/Listeners/SearchEventListener.ts
|
|
208
|
+
yarn odg make:event Search
|
|
209
|
+
|
|
210
|
+
# Correto: path explícito
|
|
211
|
+
# Arquivo gerado: src/app/Listeners/Auth/LoginEventListener.ts
|
|
212
|
+
yarn odg make:event Login -p src/app/Listeners/Auth
|
|
213
|
+
|
|
214
|
+
# ERRADO: nunca passar o nome final do enum como input
|
|
215
|
+
# yarn odg make:event LoginPageEvent ← gera LoginPageEventEventListener (nome duplicado)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### make:config
|
|
219
|
+
|
|
220
|
+
Purpose:
|
|
221
|
+
|
|
222
|
+
- Register a new config key in the existing config wiring.
|
|
223
|
+
|
|
224
|
+
Syntax:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
yarn odg make:config <configName>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Flags:
|
|
231
|
+
|
|
232
|
+
- `-v, --validator <validator>` → zod validator expression. Default: `zod.string()`
|
|
233
|
+
- `--register` → enable registration. Default: `false`
|
|
234
|
+
- `--configEnumPath` → custom ConfigName enum path. Default: `./src/app/Enums/ConfigName.ts`
|
|
235
|
+
- `--configValidatorPath` → path to the file containing `configValidator = zod.object({...})`. Default: `./src/Configs/index.ts`
|
|
236
|
+
- `--envExamplePath` → custom `.env.example` path. Default: `./.env.example`
|
|
237
|
+
- `--typeImport <statement>` → explicit top-level import statement to inject. Repeatable.
|
|
238
|
+
|
|
239
|
+
Operational notes:
|
|
240
|
+
|
|
241
|
+
- `make:config` does not create a new config stub file.
|
|
242
|
+
- It mutates the existing `configValidator = zod.object({...})` file and appends a new property.
|
|
243
|
+
- The command input is normalized to `CONST_CASE` before registration.
|
|
244
|
+
- If the input is already `CONST_CASE`, it is preserved as-is.
|
|
245
|
+
- The `.env.example` block is appended with one blank line above it, then:
|
|
246
|
+
`# CONFIG_NAME`
|
|
247
|
+
`CONFIG_NAME=""`
|
|
248
|
+
|
|
249
|
+
Examples:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# PascalCase input → normalized to APP_URL
|
|
253
|
+
# Mutations:
|
|
254
|
+
# - ConfigName.APP_URL = "APP_URL"
|
|
255
|
+
# - configValidator gains [ConfigName.APP_URL]: zod.string()
|
|
256
|
+
# - .env.example gains a blank line, comment and APP_URL=""
|
|
257
|
+
yarn odg make:config APP_URL --register
|
|
258
|
+
|
|
259
|
+
# CONST_CASE input is preserved as-is
|
|
260
|
+
# Mutations use ZECA_URL, not Z_E_C_A__U_R_L
|
|
261
|
+
yarn odg make:config ZECA_URL --register
|
|
262
|
+
|
|
263
|
+
# Custom validator expression in existing config validator file
|
|
264
|
+
yarn odg make:config USE_HEADLESS --register --validator "CustomValidator.zodStringToBoolean()"
|
|
265
|
+
|
|
266
|
+
# Custom config validator path
|
|
267
|
+
yarn odg make:config APP_URL --register --configValidatorPath src/Config/index.ts
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### make:exception
|
|
271
|
+
|
|
272
|
+
Purpose:
|
|
273
|
+
|
|
274
|
+
- Generate an exception scaffold.
|
|
275
|
+
|
|
276
|
+
Syntax:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
yarn odg make:exception <exceptionName>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Flags:
|
|
283
|
+
|
|
284
|
+
- `-u, --isUnknown` → generate unknown exception variant
|
|
285
|
+
- `-p, --path` → output path for exceptions. Default: `./src/Exceptions/`
|
|
286
|
+
|
|
287
|
+
Examples:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# Exception padrão
|
|
291
|
+
# Arquivo gerado: src/Exceptions/LoginException.ts
|
|
292
|
+
yarn odg make:exception Login
|
|
293
|
+
|
|
294
|
+
# Exception do tipo Unknown (para erros não antecipados)
|
|
295
|
+
# Arquivo gerado: src/Exceptions/RequestFailureUnknownException.ts
|
|
296
|
+
yarn odg make:exception RequestFailure --isUnknown
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Naming Rules
|
|
300
|
+
|
|
301
|
+
### Event input
|
|
302
|
+
|
|
303
|
+
- Pass the base resource name to `make:event`.
|
|
304
|
+
- The final enum/listener naming is derived later by scaffold convention and project wiring.
|
|
305
|
+
|
|
306
|
+
### Handler naming
|
|
307
|
+
|
|
308
|
+
- If the handler validates a result, use `ExampleHandler`.
|
|
309
|
+
- If the handler validates a transition, use `ExampleToDestinationHandler`.
|
|
310
|
+
- Do not name a handler only by the next service step.
|
|
311
|
+
|
|
312
|
+
### Selector naming
|
|
313
|
+
|
|
314
|
+
- Follow the naming convention already used in the selector namespace.
|
|
315
|
+
- Do not mix prefixed and non-prefixed selectors in the same domain without explicit reason.
|
|
17
316
|
|
|
18
317
|
## 🚦 Rules (Usage)
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
318
|
+
|
|
319
|
+
- Prefer examples derived from `yarn odg --help` and `yarn odg make:* --help`.
|
|
320
|
+
- execute in **root app** where default paths and stubs are expected; otherwise, use `-p` to specify custom paths
|
|
321
|
+
- use `--handler-from` and/or `--handler-to` to trigger linked handler generation
|
|
322
|
+
- if generate page, events, sectors and handlers prefer `yarn odg make:page` with flags instead of separate commands to ensure consistent naming and linking
|
|
323
|
+
- registration is opt-in: only expect enum/interface/barrel mutation when `--register` is explicitly present
|
|
324
|
+
- when registration is enabled, prefer explicit path flags over assumptions if the app does not match the default ODG folder layout
|
|
325
|
+
- `--typeImport` is repeatable and intended for explicit imports required before mutating enums/interfaces/barrels
|
|
22
326
|
|
|
23
327
|
## 💥 Exceptions
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
328
|
+
|
|
329
|
+
- `InvalidArgumentException` (`@odg/exception`): if file already exists - message error `The {name} already exists.`
|
|
330
|
+
- Handling: do not create again with the same name in the same path; delete/rename the existing file or change `-p`/name
|
|
331
|
+
- Node I/O failures (reading stub, writing, mkdir) may propagate native error not encapsulated in package-specific type
|
|
27
332
|
|
|
28
333
|
## ⚠️ Integration Pitfalls
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- `
|
|
334
|
+
|
|
335
|
+
- Paths default to `./src/...` structure; if the app has a different structure, the agent must use `-p` to specify correct paths.
|
|
336
|
+
- Registration defaults are conservative: no enum/interface/barrel mutation happens unless `--register` is passed.
|
|
337
|
+
- If `index.ts` exists in the target directory, the generator may **append** `export * from "./{FileName}";` — risk of duplicate or undesired export order
|
|
338
|
+
- `make:page --register` can mutate multiple files transitively if `--selectors`, `--event`, or linked handler generation are also enabled, because registration options propagate to generated add-ons
|
|
339
|
+
- Stubs in `./stubs` in the CWD **override** package stubs for that `.stub` file name
|
|
340
|
+
- `main`/`types` point to `dist/` of runtime CLI; do not expect public API types beyond what the package exports in `package.json` (currently: focus on bin + assets)
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import type { LoggerInterface } from "@odg/log";
|
|
2
|
-
|
|
2
|
+
import type { RegistrationTargets } from "../Registrations/types";
|
|
3
|
+
interface RegistrationOptions {
|
|
4
|
+
register?: boolean;
|
|
5
|
+
registrationTargets?: Omit<RegistrationTargets, "enabled">;
|
|
6
|
+
containerEnumPath?: string;
|
|
7
|
+
eventEnumPath?: string;
|
|
8
|
+
configEnumPath?: string;
|
|
9
|
+
configValidatorPath?: string;
|
|
10
|
+
containerInterfacePath?: string;
|
|
11
|
+
eventsInterfacePath?: string;
|
|
12
|
+
pagesIndexPath?: string;
|
|
13
|
+
selectorsIndexPath?: string;
|
|
14
|
+
handlersIndexPath?: string;
|
|
15
|
+
listenersIndexPath?: string;
|
|
16
|
+
envExamplePath?: string;
|
|
17
|
+
eventPayloadType?: string;
|
|
18
|
+
containerEnumMemberValue?: string;
|
|
19
|
+
typeImport?: string[];
|
|
20
|
+
typeImports?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface MakePageOptions extends RegistrationOptions {
|
|
3
23
|
selectors: boolean;
|
|
4
24
|
event: boolean;
|
|
5
25
|
path: string;
|
|
@@ -9,63 +29,54 @@ interface MakePageInterface {
|
|
|
9
29
|
handlerFrom?: string;
|
|
10
30
|
handlerTo?: string;
|
|
11
31
|
}
|
|
12
|
-
interface
|
|
32
|
+
export interface MakeSelectorOptions extends RegistrationOptions {
|
|
13
33
|
path: string;
|
|
14
34
|
}
|
|
15
|
-
interface
|
|
35
|
+
export interface MakeHandlerOptions extends RegistrationOptions {
|
|
16
36
|
path: string;
|
|
17
37
|
handlerFrom?: string;
|
|
18
38
|
handlerTo?: string;
|
|
19
39
|
}
|
|
20
|
-
interface
|
|
40
|
+
export interface MakeEventOptions extends RegistrationOptions {
|
|
21
41
|
path: string;
|
|
22
42
|
}
|
|
23
|
-
interface
|
|
43
|
+
export interface MakeExceptionOptions {
|
|
24
44
|
path: string;
|
|
25
45
|
isUnknown: boolean;
|
|
26
46
|
}
|
|
47
|
+
export interface MakeConfigOptions extends RegistrationOptions {
|
|
48
|
+
path?: string;
|
|
49
|
+
/** Zod validator expression written into configValidator, e.g. `zod.string()` */
|
|
50
|
+
validator?: string;
|
|
51
|
+
/** Path to the file that exports `configValidator = zod.object({...})`. */
|
|
52
|
+
configValidatorPath?: string;
|
|
53
|
+
}
|
|
27
54
|
export default class MakeFile {
|
|
28
55
|
private readonly logger;
|
|
56
|
+
private readonly stubCreator;
|
|
29
57
|
constructor(logger: LoggerInterface);
|
|
30
58
|
/**
|
|
31
59
|
* Use this function to create Page Crawler class
|
|
32
60
|
*
|
|
33
61
|
* @param {string} pageName Selector file name
|
|
34
|
-
* @param {
|
|
35
|
-
* @returns {Promise<void>}
|
|
36
|
-
*/
|
|
37
|
-
makePage(pageName: string, options: MakePageInterface): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Use this function to create selector class
|
|
40
|
-
*
|
|
41
|
-
* @param {string} selectorName Page Selector file name
|
|
42
|
-
* @param {MakeSelectorInterface} options Options command
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*/
|
|
45
|
-
makeSelectors(selectorName: string, options: MakeSelectorInterface): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Use this function to create handler file
|
|
48
|
-
*
|
|
49
|
-
* @param {string} handlerName Handler name to make
|
|
50
|
-
* @param {MakeHandlerInterface} options Options command
|
|
51
|
-
* @returns {Promise<void>}
|
|
52
|
-
*/
|
|
53
|
-
makeHandler(handlerName: string, options: MakeHandlerInterface): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Use this function to create handler file
|
|
56
|
-
*
|
|
57
|
-
* @param {string} eventName Event name to make
|
|
58
|
-
* @param {MakeEventInterface} options Options command
|
|
62
|
+
* @param {MakePageOptions} options Options command
|
|
59
63
|
* @returns {Promise<void>}
|
|
60
64
|
*/
|
|
61
|
-
|
|
65
|
+
makePage(pageName: string, options: MakePageOptions): Promise<void>;
|
|
66
|
+
makeSelectors(selectorName: string, options: MakeSelectorOptions): Promise<void>;
|
|
67
|
+
makeHandler(handlerName: string, options: MakeHandlerOptions): Promise<void>;
|
|
68
|
+
makeEvent(eventName: string, options: MakeEventOptions): Promise<void>;
|
|
69
|
+
makeConfig(configName: string, options: MakeConfigOptions): Promise<void>;
|
|
70
|
+
makeException(exceptionName: string, options: MakeExceptionOptions): Promise<void>;
|
|
71
|
+
private buildRegistrationTargets;
|
|
62
72
|
/**
|
|
63
|
-
*
|
|
73
|
+
* Runs optional selector, event, and handler file generation from make:page, forwarding `register` and
|
|
74
|
+
* `registrationTargets` so enums and barrels stay in sync with the parent command.
|
|
64
75
|
*
|
|
65
|
-
* @param {string}
|
|
66
|
-
* @param {
|
|
76
|
+
* @param {string} pageName Base page name (same as make:page first argument)
|
|
77
|
+
* @param {MakePageOptions} options Full make:page options including paths and registration targets
|
|
67
78
|
* @returns {Promise<void>}
|
|
68
79
|
*/
|
|
69
|
-
|
|
80
|
+
private scaffoldPageAddOns;
|
|
70
81
|
}
|
|
71
82
|
export {};
|