rapidkit 0.11.3 → 0.12.1
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 +99 -411
- package/dist/index.js +507 -640
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/templates/generator.js +175 -0
- package/templates/kits/fastapi-standard/.rapidkit/__init__.py.j2 +1 -0
- package/templates/kits/fastapi-standard/.rapidkit/activate.j2 +24 -0
- package/templates/kits/fastapi-standard/.rapidkit/cli.py.j2 +6 -4
- package/templates/kits/fastapi-standard/.rapidkit/project.json.j2 +3 -2
- package/templates/kits/fastapi-standard/.rapidkit/rapidkit.j2 +31 -0
- package/templates/kits/fastapi-standard/Makefile.j2 +41 -0
- package/templates/kits/fastapi-standard/pyproject.toml.j2 +1 -0
- package/templates/kits/fastapi-standard/rapidkit.j2 +50 -0
- package/templates/kits/nestjs-standard/.env.example.j2 +16 -0
- package/templates/kits/nestjs-standard/.eslintrc.js.j2 +25 -0
- package/templates/kits/nestjs-standard/.gitignore.j2 +26 -0
- package/templates/kits/nestjs-standard/.node-version.j2 +1 -0
- package/templates/kits/nestjs-standard/.nvmrc.j2 +1 -0
- package/templates/kits/nestjs-standard/.prettierrc.j2 +7 -0
- package/templates/kits/nestjs-standard/.rapidkit/activate.j2 +25 -0
- package/templates/kits/nestjs-standard/.rapidkit/project.json.j2 +7 -0
- package/templates/kits/nestjs-standard/.rapidkit/rapidkit.j2 +227 -0
- package/templates/kits/nestjs-standard/README.md.j2 +97 -0
- package/templates/kits/nestjs-standard/jest.config.ts.j2 +21 -0
- package/templates/kits/nestjs-standard/nest-cli.json.j2 +10 -0
- package/templates/kits/nestjs-standard/package.json.j2 +75 -0
- package/templates/kits/nestjs-standard/rapidkit.j2 +5 -0
- package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +12 -0
- package/templates/kits/nestjs-standard/src/app.module.ts.j2 +23 -0
- package/templates/kits/nestjs-standard/src/app.service.ts.j2 +11 -0
- package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +9 -0
- package/templates/kits/nestjs-standard/src/config/index.ts.j2 +2 -0
- package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +11 -0
- package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +11 -0
- package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +24 -0
- package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +10 -0
- package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +33 -0
- package/templates/kits/nestjs-standard/src/main.ts.j2 +51 -0
- package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +22 -0
- package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +48 -0
- package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +28 -0
- package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +15 -0
- package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +12 -0
- package/templates/kits/nestjs-standard/tsconfig.json.j2 +26 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
|
3
|
+
import request from 'supertest';
|
|
4
|
+
|
|
5
|
+
import { AppModule } from '../src/app.module';
|
|
6
|
+
|
|
7
|
+
describe('AppController (e2e)', () => {
|
|
8
|
+
let app: INestApplication;
|
|
9
|
+
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
12
|
+
imports: [AppModule],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
app = moduleFixture.createNestApplication();
|
|
16
|
+
await app.init();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterAll(async () => {
|
|
20
|
+
await app.close();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('/health (GET)', () => {
|
|
24
|
+
return request(app.getHttpServer()).get('/health').expect(200).expect({
|
|
25
|
+
status: 'ok',
|
|
26
|
+
timestamp: expect.any(String),
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('/examples/notes (POST + GET)', async () => {
|
|
31
|
+
const server = app.getHttpServer();
|
|
32
|
+
const createResponse = await request(server)
|
|
33
|
+
.post('/examples/notes')
|
|
34
|
+
.send({ title: 'test', body: 'e2e test note' })
|
|
35
|
+
.expect(201);
|
|
36
|
+
|
|
37
|
+
const noteId = createResponse.body.id;
|
|
38
|
+
|
|
39
|
+
await request(server)
|
|
40
|
+
.get('/examples/notes')
|
|
41
|
+
.expect(200)
|
|
42
|
+
.expect((res) => {
|
|
43
|
+
expect(res.body).toEqual(
|
|
44
|
+
expect.arrayContaining([expect.objectContaining({ id: noteId, title: 'test' })]),
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
|
|
3
|
+
import { ExamplesController } from '../src/examples/examples.controller';
|
|
4
|
+
import { ExamplesService } from '../src/examples/examples.service';
|
|
5
|
+
|
|
6
|
+
describe('ExamplesController', () => {
|
|
7
|
+
let controller: ExamplesController;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
11
|
+
controllers: [ExamplesController],
|
|
12
|
+
providers: [ExamplesService],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
controller = module.get<ExamplesController>(ExamplesController);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('creates and retrieves notes', () => {
|
|
19
|
+
const created = controller.create({ title: 'spec', body: 'covered by tests' });
|
|
20
|
+
expect(created).toMatchObject({ id: 1, title: 'spec' });
|
|
21
|
+
|
|
22
|
+
const list = controller.findAll();
|
|
23
|
+
expect(list).toHaveLength(1);
|
|
24
|
+
|
|
25
|
+
const single = controller.findOne(created.id);
|
|
26
|
+
expect(single).toMatchObject({ id: created.id, title: 'spec' });
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"moduleFileExtensions": ["js", "json", "ts"],
|
|
3
|
+
"rootDir": "../",
|
|
4
|
+
"testEnvironment": "node",
|
|
5
|
+
"testRegex": ".e2e-spec.ts$",
|
|
6
|
+
"transform": {
|
|
7
|
+
"^.+\\.ts$": "ts-jest"
|
|
8
|
+
},
|
|
9
|
+
"setupFiles": ["dotenv/config"],
|
|
10
|
+
"moduleNameMapper": {
|
|
11
|
+
"^@config/(.*)$": "<rootDir>/src/config/$1",
|
|
12
|
+
"^@modules/(.*)$": "<rootDir>/src/modules/$1",
|
|
13
|
+
"^@shared/(.*)$": "<rootDir>/src/shared/$1"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"sourceMap": false,
|
|
7
|
+
"removeComments": true,
|
|
8
|
+
"incremental": false
|
|
9
|
+
},
|
|
10
|
+
"exclude": ["node_modules", "test", "src/**/*.spec.ts", "src/**/*.e2e-spec.ts"],
|
|
11
|
+
"include": ["src/**/*.ts"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"target": "es2021",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"incremental": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@config/*": ["src/config/*"],
|
|
20
|
+
"@modules/*": ["src/modules/*"],
|
|
21
|
+
"@shared/*": ["src/shared/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"exclude": ["node_modules", "dist"],
|
|
25
|
+
"include": ["src/**/*.ts", "test/**/*.ts"]
|
|
26
|
+
}
|