@nest-arch/tui 0.2.8 → 0.4.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/README.md +20 -42
- package/dist/cli.js +1 -1
- package/dist/constants-C3xmDWeK.js +1 -0
- package/dist/index.js +297 -84
- package/dist/templates/base/.env.example.hbs +4 -2
- package/dist/templates/base/.env.hbs +4 -2
- package/dist/templates/base/.gitignore.hbs +2 -1
- package/dist/templates/base/.yarnrc.yml.hbs +0 -5
- package/dist/templates/base/README.md.hbs +33 -5
- package/dist/templates/base/nest-cli.json.hbs +2 -1
- package/dist/templates/base/pnpm-workspace.yaml.hbs +9 -0
- package/dist/templates/base/prisma.config.ts.hbs +32 -6
- package/dist/templates/base/src/app.controller.spec.ts.hbs +3 -11
- package/dist/templates/base/src/app.controller.ts.hbs +2 -2
- package/dist/templates/base/src/app.module.ts.hbs +8 -4
- package/dist/templates/base/src/app.router.ts.hbs +2 -2
- package/dist/templates/base/src/database/adapters/interfaces/db-adapter.interface.ts.hbs +7 -0
- package/dist/templates/base/src/database/adapters/mongo/prisma-mongo.adapter.ts.hbs +25 -1
- package/dist/templates/base/src/database/adapters/mongo/raw-mongo.adapter.ts.hbs +17 -12
- package/dist/templates/base/src/database/adapters/sql/drizzle-sql.adapter.ts.hbs +9 -0
- package/dist/templates/base/src/database/adapters/sql/prisma-sql.adapter.ts.hbs +7 -4
- package/dist/templates/base/src/database/adapters/sql/raw-sql.adapter.ts.hbs +37 -0
- package/dist/templates/base/src/database/adapters/sql/typeorm-sql.adapter.ts.hbs +8 -3
- package/dist/templates/base/src/database/db.module.ts.hbs +32 -35
- package/dist/templates/base/src/database/db.service.ts.hbs +40 -6
- package/dist/templates/base/src/database/entities/todo.entity.ts.hbs +12 -7
- package/dist/templates/base/src/database/index.ts.hbs +1 -0
- package/dist/templates/base/src/database/orm/drizzle/schema.ts.hbs +47 -5
- package/dist/templates/base/src/database/orm/typeorm/data-source.ts.hbs +12 -4
- package/dist/templates/base/src/libs/trpc/error.handler.ts.hbs +1 -1
- package/dist/templates/base/src/main.ts.hbs +21 -6
- package/dist/templates/base/test/app.e2e-spec.ts.hbs +208 -6
- package/dist/templates/base/test/bootstrap.e2e-spec.ts.hbs +74 -0
- package/dist/templates/base/tsconfig.build.json.hbs +2 -0
- package/dist/templates/base/vitest.config.e2e.ts.hbs +4 -3
- package/dist/templates/base/vitest.config.ts.hbs +4 -3
- package/dist/templates/base/yarn.lock.hbs +1 -0
- package/dist/templates/extras/docker/Dockerfile.hbs +4 -1
- package/dist/templates/extras/swagger/create-docs.ts.hbs +4 -19
- package/dist/templates/feature/graphql/src/graphql/graphql.module.ts.hbs +8 -1
- package/dist/templates/feature/graphql/src/graphql/models/todo.model.ts.hbs +4 -0
- package/dist/templates/feature/graphql/src/graphql/orm/drizzle/drizzle-graphql.module.ts.hbs +4 -3
- package/dist/templates/feature/graphql/src/graphql/resolvers/todo.resolver.ts.hbs +51 -0
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.controller.ts.hbs +3 -1
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.module.ts.hbs +1 -3
- package/dist/templates/feature/rest/todo-example/src/api/todo/todo.service.ts.hbs +98 -32
- package/dist/templates/monorepo/apps/api-gateway/package.json.hbs +0 -1
- package/dist/templates/monorepo/apps/api-gateway/src/app.controller.spec.ts.hbs +1 -1
- package/dist/templates/monorepo/apps/api-gateway/test/app.e2e-spec.ts.hbs +20 -1
- package/dist/templates/monorepo/apps/api-gateway/tsconfig.build.json.hbs +2 -1
- package/dist/templates/monorepo/apps/api-gateway/vitest.config.e2e.ts.hbs +3 -2
- package/dist/templates/monorepo/apps/api-gateway/vitest.config.ts.hbs +3 -2
- package/dist/templates/monorepo/feature/graphql/src/graphql/resolvers/todo.resolver.ts.hbs +9 -0
- package/dist/templates/monorepo/packages/env/src/api-gateway.ts.hbs +9 -3
- package/dist/templates/monorepo/root/.gitignore.hbs +1 -0
- package/dist/templates/monorepo/root/pnpm-workspace.yaml.hbs +9 -0
- package/dist/templates/monorepo/root/tsconfig.json.hbs +1 -1
- package/dist/templates/monorepo/root/turbo.json.hbs +2 -0
- package/dist/templates/single-project/architecture/nest-api/.env.hbs +3 -1
- package/dist/templates/single-project/architecture/nest-api/package.json.hbs +0 -1
- package/dist/templates/single-project/architecture/nest-api/src/main.ts.hbs +20 -5
- package/dist/templates/single-project/architecture/nest-microservice/.env.hbs +18 -0
- package/dist/templates/single-project/architecture/nest-microservice/proto/app.proto.hbs +13 -0
- package/dist/templates/single-project/architecture/nest-microservice/src/app.controller.ts.hbs +14 -1
- package/dist/templates/single-project/architecture/nest-microservice/src/app.service.ts.hbs +4 -0
- package/dist/templates/single-project/architecture/nest-microservice/src/main.ts.hbs +13 -2
- package/dist/templates/single-project/architecture/nest-microservice/test/microservice.e2e-spec.ts.hbs +64 -0
- package/dist/templates/single-project/shared/config/env.ts.hbs +27 -3
- package/package.json +5 -2
- package/dist/constants-Cgtoxhmd.js +0 -1
|
@@ -2,6 +2,10 @@ packages:
|
|
|
2
2
|
- apps/*
|
|
3
3
|
- packages/*
|
|
4
4
|
allowBuilds:
|
|
5
|
+
{{#if useDrizzle}}
|
|
6
|
+
esbuild: true
|
|
7
|
+
{{/if}}
|
|
8
|
+
protobufjs: true
|
|
5
9
|
'@nestjs/core': true
|
|
6
10
|
esbuild: true
|
|
7
11
|
{{#if swagger}}
|
|
@@ -16,6 +20,11 @@ allowBuilds:
|
|
|
16
20
|
{{#if hasSqlite}}
|
|
17
21
|
better-sqlite3: true
|
|
18
22
|
{{/if}}
|
|
23
|
+
{{#if isPrisma8}}
|
|
24
|
+
esbuild: true
|
|
25
|
+
msgpackr-extract: true
|
|
26
|
+
workerd: true
|
|
27
|
+
{{/if}}
|
|
19
28
|
catalog:
|
|
20
29
|
"@types/node": ^22.13.14
|
|
21
30
|
dotenv: ^17.2.2
|
|
@@ -16,10 +16,12 @@ SQLITE_PATH=file:./src/database/dev.db
|
|
|
16
16
|
{{#if hasMongodb}}
|
|
17
17
|
MONGODB_URL=mongodb://localhost:27017/{{projectNameKebab}}_db
|
|
18
18
|
{{/if}}
|
|
19
|
-
{{#if (
|
|
19
|
+
{{#if (eq auth "passport")}}
|
|
20
20
|
JWT_ACCESS_SECRET=change-me-to-a-random-secret-at-least-32-characters-long
|
|
21
|
+
{{#if hasDatabase}}
|
|
21
22
|
JWT_REFRESH_SECRET=change-me-to-a-different-random-secret-at-least-32-characters
|
|
22
23
|
{{/if}}
|
|
24
|
+
{{/if}}
|
|
23
25
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
24
26
|
BETTER_AUTH_SECRET=change-me-to-a-random-secret-at-least-32-characters-long
|
|
25
27
|
BETTER_AUTH_URL=http://localhost:3000
|
|
@@ -2,10 +2,18 @@ import { NestFactory } from "@nestjs/core";
|
|
|
2
2
|
{{#if (eq httpProvider "fastify")}}
|
|
3
3
|
import { FastifyAdapter, NestFastifyApplication } from "@nestjs/platform-fastify";
|
|
4
4
|
{{/if}}
|
|
5
|
+
{{#if (includes addons "nestjs-zod")}}
|
|
6
|
+
import { Logger } from "@nestjs/common";
|
|
7
|
+
import { ZodValidationPipe } from "nestjs-zod";
|
|
8
|
+
{{else}}
|
|
5
9
|
import { Logger, StandardSchemaValidationPipe } from "@nestjs/common";
|
|
10
|
+
{{/if}}
|
|
6
11
|
|
|
7
12
|
import { AppModule } from "./app.module.js";
|
|
8
13
|
import { env } from "./config/env.js";
|
|
14
|
+
{{#if isPrisma8}}
|
|
15
|
+
import { connectDatabase } from "./prisma/db.js";
|
|
16
|
+
{{/if}}
|
|
9
17
|
{{#if swagger}}
|
|
10
18
|
import { createDocs } from "./docs/create-docs.js";
|
|
11
19
|
{{/if}}
|
|
@@ -20,6 +28,9 @@ import { auth } from "./auth/auth.js";
|
|
|
20
28
|
{{/if}}
|
|
21
29
|
|
|
22
30
|
async function bootstrap() {
|
|
31
|
+
{{#if isPrisma8}}
|
|
32
|
+
await connectDatabase();
|
|
33
|
+
{{/if}}
|
|
23
34
|
const app = await NestFactory.create{{#if (eq httpProvider "fastify")}}<NestFastifyApplication>(AppModule, new FastifyAdapter()){{else}}(AppModule){{/if}};
|
|
24
35
|
app.enableCors({
|
|
25
36
|
origin: env.CORS_ORIGIN,
|
|
@@ -27,7 +38,11 @@ async function bootstrap() {
|
|
|
27
38
|
{{#if hasRest}}
|
|
28
39
|
app.setGlobalPrefix("api");
|
|
29
40
|
{{/if}}
|
|
41
|
+
{{#if (includes addons "nestjs-zod")}}
|
|
42
|
+
app.useGlobalPipes(new ZodValidationPipe());
|
|
43
|
+
{{else}}
|
|
30
44
|
app.useGlobalPipes(new StandardSchemaValidationPipe());
|
|
45
|
+
{{/if}}
|
|
31
46
|
app.enableShutdownHooks();
|
|
32
47
|
{{#if swagger}}
|
|
33
48
|
if (env.NODE_ENV === "development") {
|
|
@@ -87,17 +102,17 @@ async function bootstrap() {
|
|
|
87
102
|
});
|
|
88
103
|
SwaggerModule.setup(docsPath, app, document);
|
|
89
104
|
{{/if}}
|
|
90
|
-
Logger.log(`Swagger documentation available at http://localhost:${env.PORT
|
|
105
|
+
Logger.log(`Swagger documentation available at http://localhost:${env.PORT}${docsPath}`, "SwaggerDocs");
|
|
91
106
|
}
|
|
92
107
|
{{/if}}
|
|
93
108
|
|
|
94
|
-
await app.listen(env.PORT
|
|
109
|
+
await app.listen(env.PORT);
|
|
95
110
|
{{#if hasRest}}
|
|
96
|
-
Logger.log(`Started backend server on http://localhost:${env.PORT
|
|
111
|
+
Logger.log(`Started backend server on http://localhost:${env.PORT}/api`, "Main");
|
|
97
112
|
{{else if hasTrpc}}
|
|
98
|
-
Logger.log(`Started trpc server on http://localhost:${env.PORT
|
|
113
|
+
Logger.log(`Started trpc server on http://localhost:${env.PORT}/trpc`, "Main");
|
|
99
114
|
{{else}}
|
|
100
|
-
Logger.log(`Started server on http://localhost:${env.PORT
|
|
115
|
+
Logger.log(`Started server on http://localhost:${env.PORT}`, "Main");
|
|
101
116
|
{{/if}}
|
|
102
117
|
}
|
|
103
118
|
await bootstrap();
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
PORT=3000
|
|
2
2
|
MICROSERVICE_PORT=3001
|
|
3
3
|
CORS_ORIGIN=http://localhost:3001
|
|
4
|
+
{{#if (includes microservices "redis")}}
|
|
5
|
+
REDIS_URL=redis://127.0.0.1:6379
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if (includes microservices "mqtt")}}
|
|
8
|
+
MQTT_URL=mqtt://127.0.0.1:1883
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#if (includes microservices "nats")}}
|
|
11
|
+
NATS_URL=nats://127.0.0.1:4222
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if (includes microservices "rabbitmq")}}
|
|
14
|
+
RABBITMQ_URL=amqp://127.0.0.1:5672
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if (includes microservices "kafka")}}
|
|
17
|
+
KAFKA_BROKER=127.0.0.1:9092
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{#if (includes microservices "grpc")}}
|
|
20
|
+
GRPC_URL=0.0.0.0:5000
|
|
21
|
+
{{/if}}
|
|
4
22
|
{{#if hasGraphql}}
|
|
5
23
|
GRAPHQL_PLAYGROUND=true
|
|
6
24
|
{{/if}}
|
package/dist/templates/single-project/architecture/nest-microservice/src/app.controller.ts.hbs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Controller,
|
|
1
|
+
import { Controller, Get } from "@nestjs/common";
|
|
2
|
+
import { EventPattern, {{#if (includes microservices "grpc")}}GrpcMethod{{else}}MessagePattern{{/if}} } from "@nestjs/microservices";
|
|
2
3
|
|
|
3
4
|
import { AppService } from "./app.service.js";
|
|
4
5
|
|
|
@@ -6,10 +7,22 @@ import { AppService } from "./app.service.js";
|
|
|
6
7
|
export class AppController {
|
|
7
8
|
constructor(private readonly appService: AppService) {}
|
|
8
9
|
|
|
10
|
+
@Get()
|
|
11
|
+
getHello(): string {
|
|
12
|
+
return this.appService.getHello();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
{{#if (includes microservices "grpc")}}
|
|
16
|
+
@GrpcMethod("AppService", "Ping")
|
|
17
|
+
handleGrpcPing(): { message: string } {
|
|
18
|
+
return { message: this.appService.handlePing() };
|
|
19
|
+
}
|
|
20
|
+
{{else}}
|
|
9
21
|
@MessagePattern("ping")
|
|
10
22
|
handlePing(): string {
|
|
11
23
|
return this.appService.handlePing();
|
|
12
24
|
}
|
|
25
|
+
{{/if}}
|
|
13
26
|
|
|
14
27
|
@EventPattern("log")
|
|
15
28
|
handleLog(data: Record<string, unknown>): void {
|
|
@@ -22,12 +22,23 @@ import { auth } from "./auth/auth.js";
|
|
|
22
22
|
|
|
23
23
|
async function bootstrap() {
|
|
24
24
|
const app = await NestFactory.create{{#if (eq httpProvider "fastify")}}<NestFastifyApplication>(AppModule, new FastifyAdapter()){{else}}(AppModule){{/if}};
|
|
25
|
+
app.enableCors({ origin: env.CORS_ORIGIN });
|
|
26
|
+
app.setGlobalPrefix("api");
|
|
27
|
+
app.enableShutdownHooks();
|
|
25
28
|
|
|
26
29
|
app.connectMicroservice<MicroserviceOptions>({
|
|
27
|
-
transport: Transport.TCP,
|
|
30
|
+
transport: {{#if (includes microservices "redis")}}Transport.REDIS{{else if (includes microservices "mqtt")}}Transport.MQTT{{else if (includes microservices "nats")}}Transport.NATS{{else if (includes microservices "rabbitmq")}}Transport.RMQ{{else if (includes microservices "kafka")}}Transport.KAFKA{{else if (includes microservices "grpc")}}Transport.GRPC{{else}}Transport.TCP{{/if}},
|
|
28
31
|
options: {
|
|
32
|
+
{{#if (includes microservices "redis")}}host: new URL(env.REDIS_URL).hostname, port: Number(new URL(env.REDIS_URL).port || 6379),{{/if}}
|
|
33
|
+
{{#if (includes microservices "mqtt")}}url: env.MQTT_URL ?? "mqtt://127.0.0.1:1883",{{/if}}
|
|
34
|
+
{{#if (includes microservices "nats")}}servers: [env.NATS_URL ?? "nats://127.0.0.1:4222"],{{/if}}
|
|
35
|
+
{{#if (includes microservices "rabbitmq")}}urls: [env.RABBITMQ_URL ?? "amqp://127.0.0.1:5672"], queue: "ping", queueOptions: { durable: false },{{/if}}
|
|
36
|
+
{{#if (includes microservices "kafka")}}client: { brokers: [env.KAFKA_BROKER ?? "127.0.0.1:9092"] },{{/if}}
|
|
37
|
+
{{#if (includes microservices "grpc")}}url: env.GRPC_URL ?? "0.0.0.0:5000", package: "app", protoPath: "proto/app.proto",{{/if}}
|
|
38
|
+
{{#unless (or (includes microservices "redis") (includes microservices "mqtt") (includes microservices "nats") (includes microservices "rabbitmq") (includes microservices "kafka") (includes microservices "grpc"))}}
|
|
29
39
|
host: "0.0.0.0",
|
|
30
|
-
port: env.MICROSERVICE_PORT
|
|
40
|
+
port: env.MICROSERVICE_PORT,
|
|
41
|
+
{{/unless}}
|
|
31
42
|
},
|
|
32
43
|
});
|
|
33
44
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type INestApplication } from "@nestjs/common";
|
|
2
|
+
import {
|
|
3
|
+
ClientProxyFactory,
|
|
4
|
+
{{#if (includes microservices "grpc")}}type ClientGrpc,{{else if (includes microservices "kafka")}}type ClientKafka,{{else}}type ClientProxy,{{/if}}
|
|
5
|
+
type MicroserviceOptions,
|
|
6
|
+
Transport,
|
|
7
|
+
} from "@nestjs/microservices";
|
|
8
|
+
import { Test } from "@nestjs/testing";
|
|
9
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
10
|
+
import { firstValueFrom, type Observable } from "rxjs";
|
|
11
|
+
import { afterAll, expect, it } from "vitest";
|
|
12
|
+
|
|
13
|
+
import { AppModule } from "../src/app.module.js";
|
|
14
|
+
import { env } from "../src/config/env.js";
|
|
15
|
+
|
|
16
|
+
const transport = {{#if (includes microservices "redis")}}Transport.REDIS{{else if (includes microservices "mqtt")}}Transport.MQTT{{else if (includes microservices "nats")}}Transport.NATS{{else if (includes microservices "rabbitmq")}}Transport.RMQ{{else if (includes microservices "kafka")}}Transport.KAFKA{{else if (includes microservices "grpc")}}Transport.GRPC{{else}}Transport.TCP{{/if}};
|
|
17
|
+
|
|
18
|
+
const options = {
|
|
19
|
+
{{#if (includes microservices "redis")}}host: new URL(env.REDIS_URL).hostname, port: Number(new URL(env.REDIS_URL).port || 6379),{{/if}}
|
|
20
|
+
{{#if (includes microservices "mqtt")}}url: env.MQTT_URL,{{/if}}
|
|
21
|
+
{{#if (includes microservices "nats")}}servers: [env.NATS_URL],{{/if}}
|
|
22
|
+
{{#if (includes microservices "rabbitmq")}}urls: [env.RABBITMQ_URL], queue: "ping", queueOptions: { durable: false },{{/if}}
|
|
23
|
+
{{#if (includes microservices "kafka")}}client: { brokers: [env.KAFKA_BROKER] }, consumer: { groupId: "ping-consumer" },{{/if}}
|
|
24
|
+
{{#if (includes microservices "grpc")}}url: env.GRPC_URL, package: "app", protoPath: "proto/app.proto",{{/if}}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let app: INestApplication;
|
|
28
|
+
let client{{#if (includes microservices "grpc")}}: ClientGrpc = ClientProxyFactory.create({ transport, options } as MicroserviceOptions) as unknown as ClientGrpc;{{else if (includes microservices "kafka")}}: ClientKafka = ClientProxyFactory.create({ transport, options } as MicroserviceOptions) as ClientKafka;{{else}}: ClientProxy = ClientProxyFactory.create({ transport, options } as MicroserviceOptions);{{/if}}
|
|
29
|
+
|
|
30
|
+
it("sends ping through the selected message transport", async () => {
|
|
31
|
+
const module = await Test.createTestingModule({ imports: [AppModule] }).compile();
|
|
32
|
+
app = module.createNestApplication();
|
|
33
|
+
app.connectMicroservice<MicroserviceOptions>({ transport, options } as MicroserviceOptions);
|
|
34
|
+
await app.startAllMicroservices();
|
|
35
|
+
await app.init();
|
|
36
|
+
{{#if (includes microservices "kafka")}}
|
|
37
|
+
client.subscribeToResponseOf("ping");
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#unless (includes microservices "grpc")}}
|
|
40
|
+
{{#if (includes microservices "kafka")}}
|
|
41
|
+
try {
|
|
42
|
+
await client.connect();
|
|
43
|
+
} catch {
|
|
44
|
+
await delay(1_000);
|
|
45
|
+
await client.connect();
|
|
46
|
+
}
|
|
47
|
+
{{else}}
|
|
48
|
+
await client.connect();
|
|
49
|
+
{{/if}}
|
|
50
|
+
{{/unless}}
|
|
51
|
+
{{#if (includes microservices "grpc")}}
|
|
52
|
+
const service = client.getService<{
|
|
53
|
+
ping: (request: Record<string, never>) => Observable<{ message: string }>;
|
|
54
|
+
}>("AppService");
|
|
55
|
+
await expect(firstValueFrom(service.ping({}))).resolves.toEqual({ message: "pong" });
|
|
56
|
+
{{else}}
|
|
57
|
+
await expect(firstValueFrom(client.send<string, Record<string, never>>("ping", {}))).resolves.toBe("pong");
|
|
58
|
+
{{/if}}
|
|
59
|
+
}, 20_000);
|
|
60
|
+
|
|
61
|
+
afterAll(async () => {
|
|
62
|
+
await app?.close();
|
|
63
|
+
client.close();
|
|
64
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
import { createEnv } from "@t3-oss/env-core";
|
|
3
|
-
import
|
|
3
|
+
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
export const env = createEnv({
|
|
6
6
|
/**
|
|
@@ -31,8 +31,27 @@ export const env = createEnv({
|
|
|
31
31
|
.default("development"),
|
|
32
32
|
PORT: z
|
|
33
33
|
.string()
|
|
34
|
-
.transform(
|
|
34
|
+
.transform(Number)
|
|
35
35
|
.default(3000),
|
|
36
|
+
{{#if (includes microservices "redis")}}
|
|
37
|
+
REDIS_URL: z.url().default("redis://127.0.0.1:6379"),
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#if (includes microservices "mqtt")}}
|
|
40
|
+
MQTT_URL: z.url().default("mqtt://127.0.0.1:1883"),
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#if (includes microservices "nats")}}
|
|
43
|
+
NATS_URL: z.url().default("nats://127.0.0.1:4222"),
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#if (includes microservices "rabbitmq")}}
|
|
46
|
+
RABBITMQ_URL: z.url().default("amqp://127.0.0.1:5672"),
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{#if (includes microservices "kafka")}}
|
|
49
|
+
KAFKA_BROKER: z.string().default("127.0.0.1:9092"),
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#if (includes microservices "grpc")}}
|
|
52
|
+
GRPC_URL: z.string().default("0.0.0.0:5000"),
|
|
53
|
+
{{/if}}
|
|
54
|
+
MICROSERVICE_PORT: z.string().transform(Number).default(3001),
|
|
36
55
|
{{#if hasPostgres}}
|
|
37
56
|
POSTGRES_URL: z.url(),
|
|
38
57
|
{{/if}}
|
|
@@ -51,10 +70,15 @@ export const env = createEnv({
|
|
|
51
70
|
.transform((val) => val === "true")
|
|
52
71
|
.default(true),
|
|
53
72
|
{{/if}}
|
|
54
|
-
{{#if (
|
|
73
|
+
{{#if (eq auth "passport")}}
|
|
55
74
|
JWT_ACCESS_SECRET: z.string().min(32),
|
|
75
|
+
JWT_ISSUER: z.string().default("{{projectName}}"),
|
|
76
|
+
JWT_AUDIENCE: z.string().default("{{projectName}}-api"),
|
|
77
|
+
JWT_KEY_ID: z.string().default("primary"),
|
|
78
|
+
{{#if hasDatabase}}
|
|
56
79
|
JWT_REFRESH_SECRET: z.string().min(32),
|
|
57
80
|
{{/if}}
|
|
81
|
+
{{/if}}
|
|
58
82
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
59
83
|
BETTER_AUTH_SECRET: z.string().min(32),
|
|
60
84
|
BETTER_AUTH_URL: z.url(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-arch/tui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactive terminal UI for generating NestJS projects",
|
|
6
6
|
"keywords": [
|
|
@@ -40,15 +40,18 @@
|
|
|
40
40
|
"ink-text-input": "^6.0.0",
|
|
41
41
|
"open": "^11.0.0",
|
|
42
42
|
"react": "^18.3.1",
|
|
43
|
+
"semver": "^7.8.5",
|
|
43
44
|
"ts-morph": "^25.0.0",
|
|
44
45
|
"zod": "^4.1.13"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/react": "^18.3.12",
|
|
49
|
+
"@types/semver": "^7.8.0",
|
|
50
|
+
"ink-testing-library": "^4.0.0",
|
|
48
51
|
"pkgroll": "^2.5.2",
|
|
49
52
|
"tsx": "^4.19.2",
|
|
50
53
|
"vitest": "^4.1.7",
|
|
51
|
-
"@nest-arch/core": "0.
|
|
54
|
+
"@nest-arch/core": "0.4.0",
|
|
52
55
|
"@nest-arch/env": "0.0.0",
|
|
53
56
|
"@nest-arch/shared": "0.0.0"
|
|
54
57
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const O="Nest Arch",A="v0.2.7",t="Build production-ready NestJS projects.",o="#e54545",R="#A0A0A0",c="#6B6B6B",s="#E5E5E5",C="#61AFEF",E="#3A3A3A",n="#7FD99A",_="#E8C468",L="#e96142ff";export{O as APP_NAME,t as APP_TAGLINE,A as APP_VERSION,C as COLOR_ACCENT,R as COLOR_DIM,c as COLOR_DIMMER,E as COLOR_DIVIDER,s as COLOR_FG,o as COLOR_RED,n as COLOR_SUCCESS,_ as COLOR_WARM,L as COLOR_WARM_SECONDARY};
|