@nest-arch/tui 0.2.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 +7 -0
- package/dist/cli.js +1 -1
- package/dist/{constants-BbJ71cex.js → constants-DBtqeoTh.js} +1 -1
- package/dist/index.js +97 -79
- package/dist/templates/base/.env.example.hbs +36 -0
- package/dist/templates/base/.env.hbs +8 -1
- package/dist/templates/base/README.md.hbs +1 -1
- package/dist/templates/base/pnpm-workspace.yaml.hbs +9 -0
- package/dist/templates/base/src/app.module.ts.hbs +21 -1
- package/dist/templates/base/src/database/db.module.ts.hbs +2 -4
- package/dist/templates/base/src/main.ts.hbs +11 -1
- package/dist/templates/extras/swagger/create-docs.ts.hbs +81 -25
- package/dist/templates/feature/graphql/src/graphql/dto/create-todo.input.ts.hbs +13 -0
- package/dist/templates/feature/graphql/src/graphql/dto/update-todo.input.ts.hbs +8 -0
- package/dist/templates/feature/graphql/src/graphql/graphql.module.ts.hbs +33 -0
- package/dist/templates/feature/graphql/src/graphql/models/base.model.ts.hbs +13 -0
- package/dist/templates/feature/graphql/src/graphql/models/pagination.model.ts.hbs +27 -0
- package/dist/templates/feature/graphql/src/graphql/models/todo.model.ts.hbs +23 -0
- package/dist/templates/feature/graphql/src/graphql/models/user.model.ts.hbs +34 -0
- package/dist/templates/feature/graphql/src/graphql/orm/drizzle/drizzle-graphql.module.ts.hbs +42 -0
- package/dist/templates/feature/graphql/src/graphql/orm/typeorm/typeorm-graphql-relations.helper.ts.hbs +23 -0
- package/dist/templates/feature/graphql/src/graphql/resolvers/base.resolver.ts.hbs +50 -0
- package/dist/templates/feature/graphql/src/graphql/resolvers/todo.resolver.ts.hbs +126 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/dto/create-todo.dto.ts.hbs +13 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/dto/update-todo.dto.ts.hbs +13 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.controller.ts.hbs +171 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.module.ts.hbs +24 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.router.ts.hbs +76 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.service.ts.hbs +145 -0
- package/dist/templates/monorepo/apps/api-gateway/src/app.module.ts.hbs +21 -1
- package/dist/templates/monorepo/apps/api-gateway/src/main.ts.hbs +62 -54
- package/dist/templates/monorepo/feature/graphql/src/graphql/dto/create-todo.input.ts.hbs +13 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/dto/update-todo.input.ts.hbs +8 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/graphql.module.ts.hbs +33 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/models/base.model.ts.hbs +13 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/models/todo.model.ts.hbs +23 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/models/user.model.ts.hbs +34 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/orm/drizzle/drizzle-graphql.module.ts.hbs +16 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/orm/prisma/prisma-graphql.service.ts.hbs +9 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/orm/typeorm/typeorm-graphql-relations.helper.ts.hbs +23 -0
- package/dist/templates/monorepo/feature/graphql/src/graphql/resolvers/todo.resolver.ts.hbs +122 -0
- package/dist/templates/monorepo/packages/env/src/api-gateway.ts.hbs +10 -0
- package/dist/templates/monorepo/root/README.md.hbs +1 -1
- package/dist/templates/monorepo/root/pnpm-workspace.yaml.hbs +9 -0
- package/dist/templates/single-project/architecture/nest-api/.env.hbs +25 -1
- package/dist/templates/single-project/architecture/nest-api/pnpm-workspace.yaml.hbs +9 -0
- package/dist/templates/single-project/architecture/nest-api/src/main.ts.hbs +67 -55
- package/dist/templates/single-project/architecture/nest-gateway/src/main.ts.hbs +62 -54
- package/dist/templates/single-project/architecture/nest-microservice/.env.hbs +3 -0
- package/dist/templates/single-project/architecture/nest-microservice/src/main.ts.hbs +62 -54
- package/dist/templates/single-project/shared/config/env.ts.hbs +10 -0
- package/package.json +4 -4
|
@@ -26,66 +26,74 @@ async function bootstrap() {
|
|
|
26
26
|
});
|
|
27
27
|
app.setGlobalPrefix("api");
|
|
28
28
|
{{#if swagger}}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
if (env.NODE_ENV === "development") {
|
|
30
|
+
const docsPath = "/docs";
|
|
31
|
+
{{#if useSwaggerScalar}}
|
|
32
|
+
app.use(
|
|
33
|
+
docsPath,
|
|
34
|
+
apiReference({
|
|
35
|
+
content: await createDocs(app, {
|
|
36
|
+
title: "{{projectNamePascalCase}} API",
|
|
37
|
+
description: "{{description}}",
|
|
38
|
+
version: "1.0.0",
|
|
39
|
+
integrations: {
|
|
40
|
+
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
41
|
+
betterAuth: {
|
|
42
|
+
auth,
|
|
43
|
+
pathPrefix: "/api/auth",
|
|
44
|
+
},
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{#if (includes apis "trpc")}}
|
|
47
|
+
trpc: {
|
|
48
|
+
routerFilePath: "./src/trpc/router.ts",
|
|
49
|
+
pathPrefix: "/trpc",
|
|
50
|
+
},
|
|
51
|
+
{{/if}}
|
|
52
|
+
zod: {
|
|
53
|
+
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
54
|
+
},
|
|
43
55
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
routerFilePath: "./src/trpc/router.ts",
|
|
48
|
-
pathPrefix: "/trpc",
|
|
49
|
-
},
|
|
50
|
-
{{/if}}
|
|
51
|
-
zod: {
|
|
52
|
-
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
56
|
+
}),
|
|
57
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
58
|
+
theme: "default",
|
|
55
59
|
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
zod: {
|
|
79
|
-
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
60
|
+
);
|
|
61
|
+
{{else}}
|
|
62
|
+
const document = await createDocs(app, {
|
|
63
|
+
title: "{{projectNamePascalCase}} API",
|
|
64
|
+
description: "{{description}}",
|
|
65
|
+
version: "1.0.0",
|
|
66
|
+
integrations: {
|
|
67
|
+
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
68
|
+
betterAuth: {
|
|
69
|
+
auth,
|
|
70
|
+
pathPrefix: "/api/auth",
|
|
71
|
+
},
|
|
72
|
+
{{/if}}
|
|
73
|
+
{{#if (includes apis "trpc")}}
|
|
74
|
+
trpc: {
|
|
75
|
+
routerFilePath: "./src/trpc/router.ts",
|
|
76
|
+
pathPrefix: "/trpc",
|
|
77
|
+
},
|
|
78
|
+
{{/if}}
|
|
79
|
+
zod: {
|
|
80
|
+
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
81
|
+
},
|
|
80
82
|
},
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
});
|
|
84
|
+
SwaggerModule.setup(docsPath, app, document);
|
|
85
|
+
{{/if}}
|
|
86
|
+
Logger.log(`Swagger documentation available at http://localhost:${env.PORT ?? 3000}${docsPath}`, "SwaggerDocs");
|
|
87
|
+
}
|
|
86
88
|
{{/if}}
|
|
87
89
|
|
|
88
90
|
await app.listen(env.PORT ?? 3000);
|
|
91
|
+
{{#if hasRest}}
|
|
89
92
|
Logger.log(`Started backend server on http://localhost:${env.PORT ?? 3000}/api`, "Main");
|
|
93
|
+
{{else if hasTrpc}}
|
|
94
|
+
Logger.log(`Started trpc server on http://localhost:${env.PORT ?? 3000}/trpc`, "Main");
|
|
95
|
+
{{else}}
|
|
96
|
+
Logger.log(`Started server on http://localhost:${env.PORT ?? 3000}`, "Main");
|
|
97
|
+
{{/if}}
|
|
90
98
|
}
|
|
91
99
|
await bootstrap();
|
|
@@ -32,67 +32,75 @@ async function bootstrap() {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
{{#if swagger}}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
if (env.NODE_ENV === "development") {
|
|
36
|
+
const docsPath = "/docs";
|
|
37
|
+
{{#if useSwaggerScalar}}
|
|
38
|
+
app.use(
|
|
39
|
+
docsPath,
|
|
40
|
+
apiReference({
|
|
41
|
+
content: await createDocs(app, {
|
|
42
|
+
title: "{{projectNamePascalCase}} API",
|
|
43
|
+
description: "{{description}}",
|
|
44
|
+
version: "1.0.0",
|
|
45
|
+
integrations: {
|
|
46
|
+
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
47
|
+
betterAuth: {
|
|
48
|
+
auth,
|
|
49
|
+
pathPrefix: "/api/auth",
|
|
50
|
+
},
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#if (includes apis "trpc")}}
|
|
53
|
+
trpc: {
|
|
54
|
+
routerFilePath: "./src/trpc/router.ts",
|
|
55
|
+
pathPrefix: "/trpc",
|
|
56
|
+
},
|
|
57
|
+
{{/if}}
|
|
58
|
+
zod: {
|
|
59
|
+
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
60
|
+
},
|
|
49
61
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
routerFilePath: "./src/trpc/router.ts",
|
|
54
|
-
pathPrefix: "/trpc",
|
|
55
|
-
},
|
|
56
|
-
{{/if}}
|
|
57
|
-
zod: {
|
|
58
|
-
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
62
|
+
}),
|
|
63
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
64
|
+
theme: "default",
|
|
61
65
|
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
zod: {
|
|
85
|
-
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
66
|
+
);
|
|
67
|
+
{{else}}
|
|
68
|
+
const document = await createDocs(app, {
|
|
69
|
+
title: "{{projectNamePascalCase}} API",
|
|
70
|
+
description: "{{description}}",
|
|
71
|
+
version: "1.0.0",
|
|
72
|
+
integrations: {
|
|
73
|
+
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
74
|
+
betterAuth: {
|
|
75
|
+
auth,
|
|
76
|
+
pathPrefix: "/api/auth",
|
|
77
|
+
},
|
|
78
|
+
{{/if}}
|
|
79
|
+
{{#if (includes apis "trpc")}}
|
|
80
|
+
trpc: {
|
|
81
|
+
routerFilePath: "./src/trpc/router.ts",
|
|
82
|
+
pathPrefix: "/trpc",
|
|
83
|
+
},
|
|
84
|
+
{{/if}}
|
|
85
|
+
zod: {
|
|
86
|
+
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
87
|
+
},
|
|
86
88
|
},
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
});
|
|
90
|
+
SwaggerModule.setup(docsPath, app, document);
|
|
91
|
+
{{/if}}
|
|
92
|
+
Logger.log(`Swagger documentation available at http://localhost:${env.PORT ?? 3000}${docsPath}`, "SwaggerDocs");
|
|
93
|
+
}
|
|
92
94
|
{{/if}}
|
|
93
95
|
|
|
94
96
|
await app.startAllMicroservices();
|
|
95
97
|
await app.listen(env.PORT ?? 3000);
|
|
98
|
+
{{#if hasRest}}
|
|
96
99
|
Logger.log(`Started backend server on http://localhost:${env.PORT ?? 3000}/api`, "Main");
|
|
100
|
+
{{else if hasTrpc}}
|
|
101
|
+
Logger.log(`Started trpc server on http://localhost:${env.PORT ?? 3000}/trpc`, "Main");
|
|
102
|
+
{{else}}
|
|
103
|
+
Logger.log(`Started server on http://localhost:${env.PORT ?? 3000}`, "Main");
|
|
104
|
+
{{/if}}
|
|
97
105
|
}
|
|
98
106
|
await bootstrap();
|
|
@@ -45,6 +45,16 @@ export const env = createEnv({
|
|
|
45
45
|
{{#if hasMongodb}}
|
|
46
46
|
MONGODB_URL: z.url(),
|
|
47
47
|
{{/if}}
|
|
48
|
+
{{#if hasGraphql}}
|
|
49
|
+
GRAPHQL_PLAYGROUND: z
|
|
50
|
+
.string()
|
|
51
|
+
.transform((val) => val === "true")
|
|
52
|
+
.default(true),
|
|
53
|
+
{{/if}}
|
|
54
|
+
{{#if (and (eq auth "passport") hasDatabase)}}
|
|
55
|
+
JWT_ACCESS_SECRET: z.string().min(32),
|
|
56
|
+
JWT_REFRESH_SECRET: z.string().min(32),
|
|
57
|
+
{{/if}}
|
|
48
58
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
49
59
|
BETTER_AUTH_SECRET: z.string().min(32),
|
|
50
60
|
BETTER_AUTH_URL: z.url(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-arch/tui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactive terminal UI for generating NestJS projects",
|
|
6
6
|
"keywords": [
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"pkgroll": "^2.5.2",
|
|
49
49
|
"tsx": "^4.19.2",
|
|
50
50
|
"vitest": "^4.1.7",
|
|
51
|
-
"@nest-arch/
|
|
52
|
-
"@nest-arch/
|
|
53
|
-
"@nest-arch/
|
|
51
|
+
"@nest-arch/core": "0.2.2",
|
|
52
|
+
"@nest-arch/shared": "0.0.0",
|
|
53
|
+
"@nest-arch/env": "0.0.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"typescript": "^5"
|