create-backlist 7.3.1 → 9.0.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.
Files changed (46) hide show
  1. package/bin/index.js +901 -471
  2. package/bin/qa.js +191 -0
  3. package/package.json +27 -18
  4. package/src/ai-agent.js +581 -124
  5. package/src/analyzer.js +628 -528
  6. package/src/env-resolver.js +70 -70
  7. package/src/generators/dotnet.js +134 -134
  8. package/src/generators/java.js +248 -248
  9. package/src/generators/js.js +345 -345
  10. package/src/generators/nestjs.js +277 -277
  11. package/src/generators/python.js +86 -86
  12. package/src/project-detector.js +131 -131
  13. package/src/qa/qa-engine.js +1187 -0
  14. package/src/templates/dotnet/partials/Dockerfile.ejs +27 -27
  15. package/src/templates/dotnet/partials/docker-compose.yml.ejs +33 -33
  16. package/src/templates/js-express/base/server.js +59 -59
  17. package/src/templates/js-express/partials/Dockerfile.ejs +12 -12
  18. package/src/templates/js-express/partials/auth.controller.js.ejs +66 -66
  19. package/src/templates/js-express/partials/auth.middleware.js.ejs +19 -19
  20. package/src/templates/js-express/partials/auth.routes.js.ejs +9 -9
  21. package/src/templates/js-express/partials/controller.js.ejs +53 -53
  22. package/src/templates/js-express/partials/db.js.ejs +19 -19
  23. package/src/templates/js-express/partials/docker-compose.yml.ejs +46 -46
  24. package/src/templates/js-express/partials/model.js.ejs +18 -18
  25. package/src/templates/js-express/partials/package.json.ejs +17 -17
  26. package/src/templates/js-express/partials/prisma.schema.ejs +21 -21
  27. package/src/templates/js-express/partials/routes.js.ejs +19 -19
  28. package/src/templates/js-express/partials/seeder.js.ejs +103 -103
  29. package/src/templates/js-express/partials/service.js.ejs +51 -51
  30. package/src/templates/js-express/partials/swagger.js.ejs +30 -30
  31. package/src/templates/js-express/partials/test.js.ejs +46 -46
  32. package/src/templates/nestjs/base/app.module.ts +9 -9
  33. package/src/templates/nestjs/base/main.ts +23 -23
  34. package/src/templates/nestjs/base/tsconfig.json +21 -21
  35. package/src/templates/nestjs/partials/auth.controller.ts.ejs +17 -17
  36. package/src/templates/nestjs/partials/auth.module.ts.ejs +17 -17
  37. package/src/templates/nestjs/partials/auth.service.ts.ejs +70 -70
  38. package/src/templates/nestjs/partials/controller.ts.ejs +34 -34
  39. package/src/templates/nestjs/partials/create-dto.ts.ejs +22 -22
  40. package/src/templates/nestjs/partials/jwt-guard.ts.ejs +24 -24
  41. package/src/templates/nestjs/partials/module.ts.ejs +10 -10
  42. package/src/templates/nestjs/partials/package.json.ejs +27 -27
  43. package/src/templates/nestjs/partials/prisma.service.ts.ejs +13 -13
  44. package/src/templates/nestjs/partials/schema.ts.ejs +19 -19
  45. package/src/templates/nestjs/partials/service.ts.ejs +67 -67
  46. package/src/templates/nestjs/partials/update-dto.ts.ejs +4 -4
@@ -1,13 +1,13 @@
1
- import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
- import { PrismaClient } from '@prisma/client';
3
-
4
- @Injectable()
5
- export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
6
- async onModuleInit() {
7
- await this.$connect();
8
- }
9
-
10
- async onModuleDestroy() {
11
- await this.$disconnect();
12
- }
13
- }
1
+ import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
+ import { PrismaClient } from '@prisma/client';
3
+
4
+ @Injectable()
5
+ export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
6
+ async onModuleInit() {
7
+ await this.$connect();
8
+ }
9
+
10
+ async onModuleDestroy() {
11
+ await this.$disconnect();
12
+ }
13
+ }
@@ -1,19 +1,19 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { Document } from 'mongoose';
3
-
4
- export type <%= modelName %>Document = <%= modelName %> & Document;
5
-
6
- @Schema({ timestamps: true })
7
- export class <%= modelName %> {
8
- <% fields.forEach(field => { %>
9
- <% if (field.isUnique) { %>
10
- @Prop({ unique: true<%= field.name === 'email' ? ', lowercase: true, trim: true' : '' %> })
11
- <% } else { %>
12
- @Prop()
13
- <% } %>
14
- <%= field.name %>: string;
15
-
16
- <% }); %>
17
- }
18
-
19
- export const <%= modelName %>Schema = SchemaFactory.createForClass(<%= modelName %>);
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { Document } from 'mongoose';
3
+
4
+ export type <%= modelName %>Document = <%= modelName %> & Document;
5
+
6
+ @Schema({ timestamps: true })
7
+ export class <%= modelName %> {
8
+ <% fields.forEach(field => { %>
9
+ <% if (field.isUnique) { %>
10
+ @Prop({ unique: true<%= field.name === 'email' ? ', lowercase: true, trim: true' : '' %> })
11
+ <% } else { %>
12
+ @Prop()
13
+ <% } %>
14
+ <%= field.name %>: string;
15
+
16
+ <% }); %>
17
+ }
18
+
19
+ export const <%= modelName %>Schema = SchemaFactory.createForClass(<%= modelName %>);
@@ -1,67 +1,67 @@
1
- import { Injectable, NotFoundException } from '@nestjs/common';
2
- <% if (dbType === 'mongoose') { %>
3
- import { InjectModel } from '@nestjs/mongoose';
4
- import { Model } from 'mongoose';
5
- import { <%= modelName %>, <%= modelName %>Document } from './<%= modelName.toLowerCase() %>.schema';
6
- <% } else if (dbType === 'prisma') { %>
7
- import { PrismaService } from '../prisma/prisma.service';
8
- <% } %>
9
- import { Create<%= modelName %>Dto } from './dto/create-<%= modelName.toLowerCase() %>.dto';
10
- import { Update<%= modelName %>Dto } from './dto/update-<%= modelName.toLowerCase() %>.dto';
11
-
12
- @Injectable()
13
- export class <%= modelName %>Service {
14
- <% if (dbType === 'mongoose') { %>
15
- constructor(@InjectModel(<%= modelName %>.name) private readonly model: Model<<%= modelName %>Document>) {}
16
-
17
- async findAll() {
18
- return this.model.find().exec();
19
- }
20
-
21
- async findOne(id: string) {
22
- const doc = await this.model.findById(id).exec();
23
- if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
24
- return doc;
25
- }
26
-
27
- async create(dto: Create<%= modelName %>Dto) {
28
- return this.model.create(dto);
29
- }
30
-
31
- async update(id: string, dto: Update<%= modelName %>Dto) {
32
- const doc = await this.model.findByIdAndUpdate(id, dto, { new: true, runValidators: true }).exec();
33
- if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
34
- return doc;
35
- }
36
-
37
- async remove(id: string) {
38
- const doc = await this.model.findByIdAndDelete(id).exec();
39
- if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
40
- return doc;
41
- }
42
- <% } else { %>
43
- constructor(private readonly prisma: PrismaService) {}
44
-
45
- async findAll() {
46
- return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.findMany();
47
- }
48
-
49
- async findOne(id: string) {
50
- const record = await this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.findUnique({ where: { id } });
51
- if (!record) throw new NotFoundException(`<%= modelName %> #${id} not found`);
52
- return record;
53
- }
54
-
55
- async create(dto: Create<%= modelName %>Dto) {
56
- return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.create({ data: dto });
57
- }
58
-
59
- async update(id: string, dto: Update<%= modelName %>Dto) {
60
- return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.update({ where: { id }, data: dto });
61
- }
62
-
63
- async remove(id: string) {
64
- return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.delete({ where: { id } });
65
- }
66
- <% } %>
67
- }
1
+ import { Injectable, NotFoundException } from '@nestjs/common';
2
+ <% if (dbType === 'mongoose') { %>
3
+ import { InjectModel } from '@nestjs/mongoose';
4
+ import { Model } from 'mongoose';
5
+ import { <%= modelName %>, <%= modelName %>Document } from './<%= modelName.toLowerCase() %>.schema';
6
+ <% } else if (dbType === 'prisma') { %>
7
+ import { PrismaService } from '../prisma/prisma.service';
8
+ <% } %>
9
+ import { Create<%= modelName %>Dto } from './dto/create-<%= modelName.toLowerCase() %>.dto';
10
+ import { Update<%= modelName %>Dto } from './dto/update-<%= modelName.toLowerCase() %>.dto';
11
+
12
+ @Injectable()
13
+ export class <%= modelName %>Service {
14
+ <% if (dbType === 'mongoose') { %>
15
+ constructor(@InjectModel(<%= modelName %>.name) private readonly model: Model<<%= modelName %>Document>) {}
16
+
17
+ async findAll() {
18
+ return this.model.find().exec();
19
+ }
20
+
21
+ async findOne(id: string) {
22
+ const doc = await this.model.findById(id).exec();
23
+ if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
24
+ return doc;
25
+ }
26
+
27
+ async create(dto: Create<%= modelName %>Dto) {
28
+ return this.model.create(dto);
29
+ }
30
+
31
+ async update(id: string, dto: Update<%= modelName %>Dto) {
32
+ const doc = await this.model.findByIdAndUpdate(id, dto, { new: true, runValidators: true }).exec();
33
+ if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
34
+ return doc;
35
+ }
36
+
37
+ async remove(id: string) {
38
+ const doc = await this.model.findByIdAndDelete(id).exec();
39
+ if (!doc) throw new NotFoundException(`<%= modelName %> #${id} not found`);
40
+ return doc;
41
+ }
42
+ <% } else { %>
43
+ constructor(private readonly prisma: PrismaService) {}
44
+
45
+ async findAll() {
46
+ return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.findMany();
47
+ }
48
+
49
+ async findOne(id: string) {
50
+ const record = await this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.findUnique({ where: { id } });
51
+ if (!record) throw new NotFoundException(`<%= modelName %> #${id} not found`);
52
+ return record;
53
+ }
54
+
55
+ async create(dto: Create<%= modelName %>Dto) {
56
+ return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.create({ data: dto });
57
+ }
58
+
59
+ async update(id: string, dto: Update<%= modelName %>Dto) {
60
+ return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.update({ where: { id }, data: dto });
61
+ }
62
+
63
+ async remove(id: string) {
64
+ return this.prisma.<%= modelName.charAt(0).toLowerCase() + modelName.slice(1) %>.delete({ where: { id } });
65
+ }
66
+ <% } %>
67
+ }
@@ -1,4 +1,4 @@
1
- import { PartialType } from '@nestjs/common';
2
- import { Create<%= modelName %>Dto } from './create-<%= modelName.toLowerCase() %>.dto';
3
-
4
- export class Update<%= modelName %>Dto extends PartialType(Create<%= modelName %>Dto) {}
1
+ import { PartialType } from '@nestjs/common';
2
+ import { Create<%= modelName %>Dto } from './create-<%= modelName.toLowerCase() %>.dto';
3
+
4
+ export class Update<%= modelName %>Dto extends PartialType(Create<%= modelName %>Dto) {}