@aponiajs/cli 0.1.0 → 0.2.2
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/README.md +14 -3
- package/dist/index.d.mts +33 -2
- package/dist/index.mjs +623 -15
- package/package.json +11 -1
- package/src/arguments.ts +226 -12
- package/src/component-names.ts +42 -0
- package/src/index.ts +45 -1
- package/src/module-registration.ts +115 -0
- package/src/schematic-generator.ts +624 -0
package/README.md
CHANGED
|
@@ -16,12 +16,23 @@ bun add --dev @aponiajs/cli
|
|
|
16
16
|
bunx aponia new my-api
|
|
17
17
|
bunx aponia n my-api --dry-run
|
|
18
18
|
bunx aponia new my-api --skip-install
|
|
19
|
+
bunx aponia generate controller users
|
|
20
|
+
bunx aponia g s users
|
|
21
|
+
bunx aponia g resource users --type rest
|
|
22
|
+
bunx aponia g router health --no-spec
|
|
19
23
|
bunx aponia --version
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
The
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
The generate command supports the complete built-in Nest schematic catalog:
|
|
27
|
+
application, library, class, controller, decorator, filter, gateway, guard,
|
|
28
|
+
interface, interceptor, middleware, module, pipe, provider, resolver, resource,
|
|
29
|
+
and service. Nest aliases are supported, and `router`, `routers`, and `route`
|
|
30
|
+
map to Aponia controllers.
|
|
31
|
+
|
|
32
|
+
Generated controllers, providers, services, modules, and resources are
|
|
33
|
+
registered in the nearest Aponia module unless `--skip-import` is used.
|
|
34
|
+
Resource transports include REST, GraphQL code-first, GraphQL schema-first,
|
|
35
|
+
microservices, and WebSockets.
|
|
25
36
|
|
|
26
37
|
For one-command project creation, use the separately published
|
|
27
38
|
[`create-aponia`](https://www.npmjs.com/package/create-aponia) entrypoint:
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,24 @@ interface NewCommandOptions {
|
|
|
5
5
|
readonly dryRun: boolean;
|
|
6
6
|
readonly skipInstall: boolean;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const generateSchematics: readonly ["app", "library", "class", "controller", "decorator", "filter", "gateway", "guard", "interface", "interceptor", "middleware", "module", "pipe", "provider", "resolver", "resource", "service"];
|
|
9
|
+
type GenerateSchematic = (typeof generateSchematics)[number];
|
|
10
|
+
type ResourceTransport = "rest" | "graphql-code-first" | "graphql-schema-first" | "microservice" | "ws";
|
|
11
|
+
interface GenerateCommandOptions {
|
|
12
|
+
readonly command: "generate";
|
|
13
|
+
readonly schematic: GenerateSchematic;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly dryRun: boolean;
|
|
16
|
+
readonly flat?: boolean;
|
|
17
|
+
readonly spec?: boolean;
|
|
18
|
+
readonly skipImport: boolean;
|
|
19
|
+
readonly path?: string;
|
|
20
|
+
readonly module?: string;
|
|
21
|
+
readonly project?: string;
|
|
22
|
+
readonly crud: boolean;
|
|
23
|
+
readonly type: ResourceTransport;
|
|
24
|
+
}
|
|
25
|
+
type CliCommand = NewCommandOptions | GenerateCommandOptions | {
|
|
9
26
|
readonly command: "help";
|
|
10
27
|
} | {
|
|
11
28
|
readonly command: "version";
|
|
@@ -27,7 +44,21 @@ interface GenerateProjectResult {
|
|
|
27
44
|
}
|
|
28
45
|
declare function generateProject(options: GenerateProjectOptions): Promise<GenerateProjectResult>;
|
|
29
46
|
//#endregion
|
|
47
|
+
//#region src/schematic-generator.d.ts
|
|
48
|
+
interface GenerateSchematicOptions extends GenerateCommandOptions {
|
|
49
|
+
readonly cwd?: string;
|
|
50
|
+
}
|
|
51
|
+
interface SchematicChange {
|
|
52
|
+
readonly kind: "CREATE" | "UPDATE";
|
|
53
|
+
readonly path: string;
|
|
54
|
+
}
|
|
55
|
+
interface GenerateSchematicResult {
|
|
56
|
+
readonly changes: readonly SchematicChange[];
|
|
57
|
+
readonly dryRun: boolean;
|
|
58
|
+
}
|
|
59
|
+
declare function generateSchematic(options: GenerateSchematicOptions): Promise<GenerateSchematicResult>;
|
|
60
|
+
//#endregion
|
|
30
61
|
//#region src/index.d.ts
|
|
31
62
|
declare function runCli(arguments_: readonly string[]): Promise<number>;
|
|
32
63
|
//#endregion
|
|
33
|
-
export { type CliCommand, type GenerateProjectOptions, type GenerateProjectResult, generateProject, parseArguments, runCli };
|
|
64
|
+
export { type CliCommand, type GenerateCommandOptions, type GenerateProjectOptions, type GenerateProjectResult, type GenerateSchematic, type GenerateSchematicOptions, type GenerateSchematicResult, type ResourceTransport, type SchematicChange, generateProject, generateSchematic, generateSchematics, parseArguments, runCli };
|