@nathapp/na-cli 1.0.7 → 1.0.8
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/dist/templates/nestjs-api/.gitignore-rename +1 -0
- package/dist/templates/nestjs-api/.oxlintrc.json +18 -0
- package/dist/templates/nestjs-api/Dockerfile +15 -21
- package/dist/templates/nestjs-api/README.md +22 -30
- package/dist/templates/nestjs-api/package.json +58 -72
- package/dist/templates/nestjs-api/vitest.config.mts +33 -0
- package/dist/templates/nestjs-library/.gitignore-rename +1 -0
- package/dist/templates/nestjs-library/.npmignore-rename +5 -2
- package/dist/templates/nestjs-library/.oxlintrc.json +18 -0
- package/dist/templates/nestjs-library/README.md +24 -0
- package/dist/templates/nestjs-library/package.json +43 -33
- package/dist/templates/nestjs-library/vitest.config.mts +29 -0
- package/package.json +1 -1
- package/dist/templates/nestjs-api/test/jest-e2e.json +0 -12
- package/dist/templates/nestjs-api/test/jest-test.json +0 -26
- package/dist/templates/nestjs-library/test/jest-test.json +0 -23
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "oxc"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "error"
|
|
6
|
+
},
|
|
7
|
+
"env": {
|
|
8
|
+
"node": true,
|
|
9
|
+
"es2022": true,
|
|
10
|
+
"vitest": true
|
|
11
|
+
},
|
|
12
|
+
"ignorePatterns": ["dist/", "node_modules/", "coverage/", ".turbo/"],
|
|
13
|
+
"rules": {
|
|
14
|
+
"typescript/no-explicit-any": "off",
|
|
15
|
+
"typescript/explicit-module-boundary-types": "off",
|
|
16
|
+
"no-unused-vars": "off"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
##
|
|
1
|
+
## multi-stage build optimized for kaniko cache
|
|
2
|
+
## keep the bun image version in step with `packageManager`: bun.lock is versioned per bun release
|
|
2
3
|
FROM nathapp/apline-jq:3.18 AS deps
|
|
3
4
|
|
|
4
5
|
# https://stackoverflow.com/a/58487433
|
|
5
|
-
#
|
|
6
|
+
# Strip the version so a release bump does not invalidate the dependency layers
|
|
7
|
+
COPY package.json /tmp/
|
|
8
|
+
RUN jq '{ name, dependencies, devDependencies, scripts, packageManager }' < /tmp/package.json > /tmp/deps.json
|
|
6
9
|
|
|
7
|
-
COPY package.json package-lock.json /tmp/
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
RUN jq '{ name, lockfileVersion, requires, packages, dependencies }' < /tmp/package-lock.json > /tmp/deps-lock.json
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
FROM nathapp/node-bun:22.21.0-1.2.23-alpine AS builder
|
|
11
|
+
FROM nathapp/node-bun:24.22.0-1.4.3-alpine-builder AS builder
|
|
14
12
|
WORKDIR /app/
|
|
15
13
|
|
|
16
14
|
COPY --from=deps /tmp/deps.json ./package.json
|
|
17
|
-
COPY
|
|
18
|
-
|
|
19
|
-
ADD ./bun.lockb ./tsconfig.json ./tsconfig.build.json ./nest-cli.json /app/
|
|
15
|
+
COPY bun.lock ./
|
|
20
16
|
|
|
21
17
|
## install dependencies first
|
|
22
|
-
RUN bun install --
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
RUN bun install --frozen-lockfile
|
|
19
|
+
COPY tsconfig.json tsconfig.build.json nest-cli.json ./
|
|
20
|
+
COPY src ./src
|
|
25
21
|
RUN bun run build
|
|
26
22
|
|
|
27
23
|
|
|
28
|
-
FROM nathapp/node-bun:22.
|
|
24
|
+
FROM nathapp/node-bun:24.22.0-1.4.3-alpine
|
|
29
25
|
WORKDIR /app/
|
|
30
26
|
|
|
31
|
-
COPY bun.lockb ./
|
|
32
27
|
COPY --from=deps /tmp/deps.json ./package.json
|
|
33
|
-
COPY
|
|
34
|
-
|
|
35
|
-
RUN bun install --freeze-lockfile --production
|
|
28
|
+
COPY bun.lock ./
|
|
29
|
+
RUN bun install --frozen-lockfile --production --ignore-scripts
|
|
36
30
|
|
|
37
31
|
COPY --from=builder /app/dist /app/dist
|
|
38
|
-
COPY package
|
|
39
|
-
CMD ["bun", "run", "start:prod"]
|
|
32
|
+
COPY package.json ./
|
|
33
|
+
CMD ["bun", "run", "start:prod"]
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# <%= projectName %>
|
|
2
2
|
|
|
3
|
-
## Issue
|
|
4
|
-
|
|
5
|
-
1. if u having Cannot find module 'typescript' error. https://github.com/toonvanstrijp/nestjs-i18n/issues/551
|
|
6
|
-
|
|
7
3
|
### Getting Started
|
|
8
4
|
|
|
9
5
|
The <%= projectName %> API endpoints.
|
|
10
6
|
|
|
7
|
+
Stack: NestJS 12, `@nathapp/nestjs-*` 4.x, Bun, Vitest, oxlint. Requires Node >= 22.12 (see `.nvmrc`).
|
|
8
|
+
|
|
11
9
|
### How to setup environment?
|
|
12
10
|
|
|
13
11
|
1. Clone this repository.
|
|
@@ -16,39 +14,34 @@ The <%= projectName %> API endpoints.
|
|
|
16
14
|
|
|
17
15
|
3. Install package dependencies.
|
|
18
16
|
```
|
|
19
|
-
|
|
17
|
+
bun install
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
2. Run unit-test command.
|
|
27
|
-
|
|
28
|
-
- To run single module unit-test.
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
npm run test-this src/app-service.test.ts
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
- To run all unit-test.
|
|
35
|
-
```
|
|
36
|
-
npm run test
|
|
37
|
-
```
|
|
20
|
+
4. Start the API in watch mode (reads `.env`, then `.env.local`). With `ENV_NAME=local` (the `.env` default) the Swagger UI is served at `/swagger-ui.html`.
|
|
21
|
+
```
|
|
22
|
+
bun run start:dev
|
|
23
|
+
```
|
|
38
24
|
|
|
39
|
-
### How to
|
|
25
|
+
### How to run tests?
|
|
40
26
|
|
|
41
|
-
|
|
27
|
+
Unit specs live next to the code as `src/**/*.spec.ts`; e2e specs live in `test/**/*.e2e-spec.ts`.
|
|
42
28
|
|
|
43
|
-
|
|
29
|
+
- Run all unit tests: `bun run test`
|
|
30
|
+
- Run one spec: `bunx vitest run src/app.controller.spec.ts`
|
|
31
|
+
- Run e2e tests: `bun run test:e2e`
|
|
32
|
+
- Coverage: `bun run test:cov`
|
|
33
|
+
- Watch mode: `bun run test:watch`
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
Use `vi` (not `jest`) for mocks and spies, and `createMock` from `@golevelup/ts-vitest`.
|
|
46
36
|
|
|
47
|
-
|
|
48
|
-
npm run debug-this src/app-service.test.ts
|
|
49
|
-
```
|
|
37
|
+
### Quality checks
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
```
|
|
40
|
+
bun run lint
|
|
41
|
+
bun run type-check
|
|
42
|
+
bun run type-check:spec
|
|
43
|
+
bun run build
|
|
44
|
+
```
|
|
52
45
|
|
|
53
46
|
### How to release version?
|
|
54
47
|
|
|
@@ -68,4 +61,3 @@ Git pipeline will perform unit-test, build container image and push to the conta
|
|
|
68
61
|
|
|
69
62
|
If you want to merge into `default` branch without triggering the pipeline, write commit message that contain `run-without-release`.
|
|
70
63
|
|
|
71
|
-
chatbot: 0
|
|
@@ -5,20 +5,25 @@
|
|
|
5
5
|
"author": "<%= author %>",
|
|
6
6
|
"private": true,
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22.12.0"
|
|
10
|
+
},
|
|
8
11
|
"scripts": {
|
|
9
|
-
"clean": "rimraf dist/ .turbo/",
|
|
12
|
+
"clean": "rimraf dist/ .turbo/ coverage/",
|
|
10
13
|
"build": "nest build",
|
|
14
|
+
"type-check": "tsc -p tsconfig.build.json --noEmit",
|
|
15
|
+
"type-check:spec": "tsc -p tsconfig.spec.json",
|
|
11
16
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
12
17
|
"start": "nest start --env-file=.env --env-file=.env.local",
|
|
13
18
|
"start:dev": "nest start --env-file=.env --env-file=.env.local --watch",
|
|
14
19
|
"start:debug": "nest start --env-file=.env --env-file=.env.local --debug --watch",
|
|
15
20
|
"start:prod": "ENV_NAME=production bun dist/main",
|
|
16
|
-
"lint": "
|
|
17
|
-
"
|
|
18
|
-
"test
|
|
19
|
-
"test:
|
|
20
|
-
"test:
|
|
21
|
-
"test:e2e": "
|
|
21
|
+
"lint": "oxlint src test --max-warnings=0",
|
|
22
|
+
"lint:fix": "oxlint src test --fix",
|
|
23
|
+
"test": "vitest run --exclude \"test/**/*.e2e-spec.ts\"",
|
|
24
|
+
"test:cov": "vitest run --coverage --exclude \"test/**/*.e2e-spec.ts\"",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:e2e": "vitest run test/",
|
|
22
27
|
"typeorm": "ts-node ./node_modules/typeorm/cli",
|
|
23
28
|
"migration:run": "npm run typeorm migration:run -- -d ./ormconfig.ts",
|
|
24
29
|
"migration:generate": "npm run typeorm -- -d ./ormconfig.ts migration:generate ./src/migrations/$npm_config_name",
|
|
@@ -27,72 +32,53 @@
|
|
|
27
32
|
"migration:sql": "ts-node -r tsconfig-paths/register ./node_modules/@nathapp/typeorm-migrate-to-sql/bin/typeorm-migrate-sql.js -d ./src/migrations/ -c ./ormconfig.ts -n $npm_config_name"
|
|
28
33
|
},
|
|
29
34
|
"dependencies": {
|
|
30
|
-
|
|
31
|
-
<%if (isFastify) { -%>"@fastify/
|
|
32
|
-
"@
|
|
33
|
-
"@nathapp/
|
|
34
|
-
"@nathapp/
|
|
35
|
-
"@nathapp/nestjs-
|
|
36
|
-
"@nathapp/nestjs-
|
|
37
|
-
"@nathapp/nestjs-
|
|
38
|
-
"@nathapp/nestjs-
|
|
39
|
-
"@nestjs
|
|
40
|
-
"@nestjs
|
|
41
|
-
"@nestjs/
|
|
42
|
-
"@nestjs/
|
|
43
|
-
"@nestjs/
|
|
44
|
-
"@nestjs/
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
35
|
+
"@casl/ability": "^6.8.1",
|
|
36
|
+
<%if (isFastify) { -%>"@fastify/helmet": "^13.2.0",
|
|
37
|
+
"@fastify/static": "^10.1.6",
|
|
38
|
+
<% } -%>"@nathapp/auth": "^1.0.2",
|
|
39
|
+
"@nathapp/common": "^0.1.15",
|
|
40
|
+
"@nathapp/nestjs-app": "~4.2.2",
|
|
41
|
+
"@nathapp/nestjs-auth": "~4.2.2",
|
|
42
|
+
"@nathapp/nestjs-common": "~4.2.2",
|
|
43
|
+
"@nathapp/nestjs-data": "~4.2.2",
|
|
44
|
+
"@nathapp/nestjs-logging": "~4.2.2",
|
|
45
|
+
"@nathapp/nestjs-microservices": "~4.2.2",
|
|
46
|
+
"@nestjs/common": "^12.1.3",
|
|
47
|
+
"@nestjs/config": "^12.0.1",
|
|
48
|
+
"@nestjs/core": "^12.1.3",
|
|
49
|
+
"@nestjs/microservices": "^12.1.3",
|
|
50
|
+
"@nestjs/passport": "^12.0.0",
|
|
51
|
+
"@nestjs/platform-<%= nestjsPlatform %>": "^12.1.3",
|
|
52
|
+
"@nestjs/swagger": "^12.0.2",
|
|
53
|
+
"class-transformer": "^0.5.1",
|
|
54
|
+
"class-validator": "^0.14.0",
|
|
55
|
+
<%if (!isFastify) { -%>"helmet": "^8.3.0",
|
|
56
|
+
<% } -%>"mysql2": "^3.24.6",
|
|
57
|
+
"nestjs-i18n": "^10.8.5",
|
|
58
|
+
"passport": "^0.7.0",
|
|
50
59
|
"reflect-metadata": "^0.2.2",
|
|
51
|
-
"rxjs": "^7.2
|
|
60
|
+
"rxjs": "^7.8.2"
|
|
52
61
|
},
|
|
53
62
|
"devDependencies": {
|
|
54
|
-
"@golevelup/ts-
|
|
55
|
-
"@nestjs/cli": "^
|
|
56
|
-
"@nestjs/schematics": "^
|
|
57
|
-
"@nestjs/testing": "^
|
|
58
|
-
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/node": "^22.0.0",
|
|
61
|
-
"@types/supertest": "^2.0
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"ts-node": "^10.0.0",
|
|
74
|
-
"tsconfig-paths": "4.1.1",
|
|
75
|
-
"typescript": "^5"
|
|
76
|
-
},
|
|
77
|
-
"jest": {
|
|
78
|
-
"moduleFileExtensions": [
|
|
79
|
-
"js",
|
|
80
|
-
"json",
|
|
81
|
-
"ts"
|
|
82
|
-
],
|
|
83
|
-
"rootDir": "src",
|
|
84
|
-
"testRegex": ".*\\.spec\\.ts$",
|
|
85
|
-
"transform": {
|
|
86
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
|
87
|
-
},
|
|
88
|
-
"collectCoverageFrom": [
|
|
89
|
-
"**/*.(t|j)s"
|
|
90
|
-
],
|
|
91
|
-
"coverageDirectory": "../coverage",
|
|
92
|
-
"testEnvironment": "node",
|
|
93
|
-
"moduleNameMapper": {
|
|
94
|
-
"^@/(.*)$": "<rootDir>/../src/$1"
|
|
95
|
-
}
|
|
63
|
+
"@golevelup/ts-vitest": "^4.0.0",
|
|
64
|
+
"@nestjs/cli": "^12.0.8",
|
|
65
|
+
"@nestjs/schematics": "^12.0.0",
|
|
66
|
+
"@nestjs/testing": "^12.1.3",
|
|
67
|
+
"@swc/core": "^1.16.13",
|
|
68
|
+
<%if (!isFastify) { -%>"@types/express": "^5.0.0",
|
|
69
|
+
<% } -%>"@types/node": "^22.0.0",
|
|
70
|
+
"@types/supertest": "^7.2.0",
|
|
71
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
72
|
+
"oxlint": "^1.87.0",
|
|
73
|
+
"prettier": "^3.6.0",
|
|
74
|
+
"rimraf": "^6.0.1",
|
|
75
|
+
"source-map-support": "^0.5.21",
|
|
76
|
+
"supertest": "^7.2.2",
|
|
77
|
+
"ts-node": "^10.9.2",
|
|
78
|
+
"tsconfig-paths": "^4.2.0",
|
|
79
|
+
"typescript": "^5.9.0",
|
|
80
|
+
"unplugin-swc": "^2.0.0",
|
|
81
|
+
"vitest": "^4.1.11"
|
|
96
82
|
},
|
|
97
|
-
"packageManager": "bun@1.
|
|
98
|
-
}
|
|
83
|
+
"packageManager": "bun@1.4.3"
|
|
84
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import swc from 'unplugin-swc';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { defineConfig } from 'vitest/config';
|
|
4
|
+
|
|
5
|
+
// Nest DI reads `design:paramtypes`, which Vite's default transform does not emit,
|
|
6
|
+
// so specs are compiled with SWC (legacy decorators + decorator metadata).
|
|
7
|
+
const swcPlugin = swc.vite({
|
|
8
|
+
module: { type: 'es6' },
|
|
9
|
+
jsc: {
|
|
10
|
+
target: 'es2022',
|
|
11
|
+
parser: { syntax: 'typescript', decorators: true },
|
|
12
|
+
transform: { legacyDecorator: true, decoratorMetadata: true },
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
plugins: [swcPlugin],
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
|
20
|
+
},
|
|
21
|
+
test: {
|
|
22
|
+
globals: true,
|
|
23
|
+
environment: 'node',
|
|
24
|
+
include: ['src/**/*.spec.ts', 'test/**/*.e2e-spec.ts'],
|
|
25
|
+
exclude: ['**/node_modules/**', '**/dist/**'],
|
|
26
|
+
coverage: {
|
|
27
|
+
provider: 'v8',
|
|
28
|
+
include: ['src/**/*.ts'],
|
|
29
|
+
exclude: ['src/**/*.spec.ts', 'src/main.ts'],
|
|
30
|
+
reportsDirectory: './coverage',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -16,13 +16,15 @@ nodemon-debug.json
|
|
|
16
16
|
package-lock.json
|
|
17
17
|
tsconfig.json
|
|
18
18
|
tsconfig.spec.json
|
|
19
|
+
vitest.config.mts
|
|
20
|
+
.oxlintrc.json
|
|
19
21
|
tsconfig.build.json
|
|
20
22
|
tslint.json
|
|
21
23
|
webpack.config.js
|
|
22
24
|
yarn.lock
|
|
23
25
|
bun.lockb
|
|
26
|
+
bun.lock
|
|
24
27
|
README.md
|
|
25
|
-
.eslintrc.js
|
|
26
28
|
.dockerignore
|
|
27
29
|
|
|
28
30
|
.npmrc
|
|
@@ -31,4 +33,5 @@ README.md
|
|
|
31
33
|
Makefile
|
|
32
34
|
|
|
33
35
|
.npm/
|
|
34
|
-
test/
|
|
36
|
+
test/
|
|
37
|
+
coverage/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "oxc"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "error"
|
|
6
|
+
},
|
|
7
|
+
"env": {
|
|
8
|
+
"node": true,
|
|
9
|
+
"es2022": true,
|
|
10
|
+
"vitest": true
|
|
11
|
+
},
|
|
12
|
+
"ignorePatterns": ["dist/", "node_modules/", "coverage/"],
|
|
13
|
+
"rules": {
|
|
14
|
+
"typescript/no-explicit-any": "off",
|
|
15
|
+
"typescript/explicit-module-boundary-types": "off",
|
|
16
|
+
"no-unused-vars": "off"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
# <%= projectName %> Library
|
|
2
2
|
|
|
3
|
+
NestJS library (NestJS 10-12 as peers). Source lives in `lib/`, compiled output in `dist/`.
|
|
3
4
|
|
|
5
|
+
Requires Node >= 22.12 (see `.nvmrc`) and Bun.
|
|
6
|
+
|
|
7
|
+
## Development
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
bun install
|
|
11
|
+
bun run build
|
|
12
|
+
bun run lint
|
|
13
|
+
bun run type-check
|
|
14
|
+
bun run type-check:spec
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Tests
|
|
18
|
+
|
|
19
|
+
Specs are `lib/**/*.spec.ts` and `test/**/*.spec.ts`, run with Vitest (`vi` for mocks, `createMock` from `@golevelup/ts-vitest`).
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
bun run test
|
|
23
|
+
bun run test:cov
|
|
24
|
+
bun run test:watch
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`test/app/` holds a throwaway Nest app for exercising the library end to end.
|
|
@@ -3,48 +3,58 @@
|
|
|
3
3
|
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "<%= projectName %>",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"test
|
|
11
|
-
"
|
|
6
|
+
"clean": "rimraf dist/ coverage/",
|
|
7
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
8
|
+
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
9
|
+
"type-check:spec": "tsc -p tsconfig.spec.json",
|
|
10
|
+
"test": "vitest run --passWithNoTests",
|
|
11
|
+
"test:cov": "vitest run --coverage --passWithNoTests",
|
|
12
|
+
"test:watch": "vitest",
|
|
13
|
+
"lint": "oxlint lib test --max-warnings=0",
|
|
14
|
+
"lint:fix": "oxlint lib test --fix",
|
|
15
|
+
"format": "prettier --write \"lib/**/*.ts\" \"test/**/*.ts\""
|
|
12
16
|
},
|
|
13
17
|
"author": "<%= author %>",
|
|
14
18
|
"license": "ISC",
|
|
15
19
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
20
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
17
21
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"@nestjs/platform-express": "^11.0.0",
|
|
21
|
-
"@nestjs/platform-fastify": "^11.0.0",
|
|
22
|
-
"@nestjs/testing": "^11.0.0",
|
|
23
|
-
"@types/jest": "^29.5.2",
|
|
24
|
-
"@types/node": "18.11.18",
|
|
25
|
-
"@types/supertest": "^2.0.12",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^4",
|
|
27
|
-
"@typescript-eslint/parser": "^4",
|
|
28
|
-
"eslint": "*",
|
|
29
|
-
"eslint-config-prettier": "^6",
|
|
30
|
-
"eslint-plugin-prettier": "^3",
|
|
31
|
-
"jest": "^29.5.0",
|
|
32
|
-
"prettier": "^2",
|
|
33
|
-
"supertest": "^6.3.3",
|
|
34
|
-
"ts-jest": "^29.1.0",
|
|
35
|
-
"typescript": "^5"
|
|
36
|
-
},
|
|
37
|
-
"types": "./index.d.ts",
|
|
38
|
-
"main": "index.js",
|
|
22
|
+
"main": "dist/index.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
39
24
|
"directories": {
|
|
40
25
|
"lib": "lib"
|
|
41
26
|
},
|
|
42
27
|
"dependencies": {},
|
|
43
28
|
"peerDependencies": {
|
|
44
|
-
"@nestjs/common": "^
|
|
45
|
-
"@nestjs/core": "^
|
|
29
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
30
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
46
31
|
"class-transformer": "*",
|
|
47
32
|
"class-validator": "*",
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
}
|
|
33
|
+
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
34
|
+
"rxjs": "^7.8.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@golevelup/ts-vitest": "^4.0.0",
|
|
38
|
+
"@nestjs/common": "^12.1.3",
|
|
39
|
+
"@nestjs/core": "^12.1.3",
|
|
40
|
+
"@nestjs/platform-express": "^12.1.3",
|
|
41
|
+
"@nestjs/platform-fastify": "^12.1.3",
|
|
42
|
+
"@nestjs/testing": "^12.1.3",
|
|
43
|
+
"@swc/core": "^1.16.13",
|
|
44
|
+
"@types/node": "^22.0.0",
|
|
45
|
+
"@types/supertest": "^7.2.0",
|
|
46
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
47
|
+
"class-transformer": "^0.5.1",
|
|
48
|
+
"class-validator": "^0.14.0",
|
|
49
|
+
"oxlint": "^1.87.0",
|
|
50
|
+
"prettier": "^3.6.0",
|
|
51
|
+
"reflect-metadata": "^0.2.2",
|
|
52
|
+
"rimraf": "^6.0.1",
|
|
53
|
+
"rxjs": "^7.8.2",
|
|
54
|
+
"supertest": "^7.2.2",
|
|
55
|
+
"typescript": "^5.9.0",
|
|
56
|
+
"unplugin-swc": "^2.0.0",
|
|
57
|
+
"vitest": "^4.1.11"
|
|
58
|
+
},
|
|
59
|
+
"packageManager": "bun@1.4.3"
|
|
60
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import swc from "unplugin-swc";
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
|
+
|
|
4
|
+
// Nest DI reads `design:paramtypes`, which Vite's default transform does not emit,
|
|
5
|
+
// so specs are compiled with SWC (legacy decorators + decorator metadata).
|
|
6
|
+
const swcPlugin = swc.vite({
|
|
7
|
+
module: { type: "es6" },
|
|
8
|
+
jsc: {
|
|
9
|
+
target: "es2022",
|
|
10
|
+
parser: { syntax: "typescript", decorators: true },
|
|
11
|
+
transform: { legacyDecorator: true, decoratorMetadata: true },
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
plugins: [swcPlugin],
|
|
17
|
+
test: {
|
|
18
|
+
globals: true,
|
|
19
|
+
environment: "node",
|
|
20
|
+
include: ["lib/**/*.spec.ts", "test/**/*.spec.ts"],
|
|
21
|
+
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
22
|
+
coverage: {
|
|
23
|
+
provider: "v8",
|
|
24
|
+
include: ["lib/**/*.ts"],
|
|
25
|
+
exclude: ["lib/**/*.spec.ts"],
|
|
26
|
+
reportsDirectory: "./coverage",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"moduleFileExtensions": [
|
|
3
|
-
"js",
|
|
4
|
-
"json",
|
|
5
|
-
"ts",
|
|
6
|
-
"d.ts"
|
|
7
|
-
],
|
|
8
|
-
"rootDir": "../",
|
|
9
|
-
"testEnvironment": "node",
|
|
10
|
-
"testRegex": ".spec.ts$",
|
|
11
|
-
"transform": {
|
|
12
|
-
"^.+\\.(t)s$": [
|
|
13
|
-
"ts-jest",
|
|
14
|
-
{
|
|
15
|
-
"diagnostics": true
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"collectCoverageFrom": [
|
|
20
|
-
"lib/**/*.ts",
|
|
21
|
-
"!**/node_modules/**"
|
|
22
|
-
],
|
|
23
|
-
"moduleNameMapper": {
|
|
24
|
-
"^@/(.*)$": "<rootDir>/src/$1"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"moduleFileExtensions": [
|
|
3
|
-
"js",
|
|
4
|
-
"json",
|
|
5
|
-
"ts",
|
|
6
|
-
"d.ts"
|
|
7
|
-
],
|
|
8
|
-
"rootDir": "../",
|
|
9
|
-
"testEnvironment": "node",
|
|
10
|
-
"testRegex": ".spec.ts$",
|
|
11
|
-
"transform": {
|
|
12
|
-
"^.+\\.(t|j)s$": [
|
|
13
|
-
"ts-jest",
|
|
14
|
-
{
|
|
15
|
-
"diagnostics": true
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"collectCoverageFrom": [
|
|
20
|
-
"src/**/*.ts",
|
|
21
|
-
"!**/node_modules/**"
|
|
22
|
-
]
|
|
23
|
-
}
|