@koalarx/nest-cli 1.2.24 → 2.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.
@@ -1,8 +1,6 @@
1
1
  DATABASE_URL="postgres://postgres:root@localhost:5432/[projectName]"
2
- DIRECT_URL="postgres://postgres:root@localhost:5432/[projectName]"
3
2
 
4
3
  NODE_ENV="develop"
5
- ENVIRONMENT_TYPE="develop"
6
4
 
7
5
  PRISMA_QUERY_LOG="false"
8
6
 
@@ -3,18 +3,20 @@ module.exports = {
3
3
  NodeJS: true,
4
4
  },
5
5
  extends: [
6
- '@rocketseat/eslint-config/node',
7
- 'plugin:vitest-globals/recommended',
6
+ "@rocketseat/eslint-config/node",
7
+ "plugin:vitest-globals/recommended",
8
8
  ],
9
9
  env: {
10
- 'vitest-globals/env': true,
10
+ "vitest-globals/env": true,
11
11
  },
12
- ignorePatterns: ['*.json'],
12
+ ignorePatterns: ["*.json"],
13
13
  rules: {
14
- 'no-unused-vars': 'off',
15
- 'no-useless-constructor': 'off',
16
- 'no-new': 'off',
17
- 'no-use-before-define': 'off',
18
- '@typescript-eslint/no-explicit-any': 'off',
14
+ "no-unused-vars": "off",
15
+ "no-useless-constructor": "off",
16
+ "no-new": "off",
17
+ "no-use-before-define": "off",
18
+ "@typescript-eslint/no-explicit-any": "off",
19
+ "@typescript-eslint/no-unsafe-function-type": "off",
20
+ "@typescript-eslint/ban-ts-comment": "off",
19
21
  },
20
- }
22
+ };
@@ -6,36 +6,21 @@
6
6
  "request": "launch",
7
7
  "name": "Nest Debug (Bun)",
8
8
  "runtimeExecutable": "bun",
9
- "runtimeArgs": ["run", "start:debug"],
9
+ "runtimeArgs": [
10
+ "run",
11
+ "start:debug"
12
+ ],
10
13
  "console": "integratedTerminal",
11
14
  "restart": true,
12
- "protocol": "auto",
13
- "port": 9229,
14
15
  "autoAttachChildProcesses": true
15
16
  },
16
17
  {
17
- "type": "node",
18
+ "type": "bun",
18
19
  "request": "launch",
19
- "name": "Debug Unit Tests (Bun)",
20
- "runtimeExecutable": "bun",
21
- "program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
22
- "args": ["run", "${relativeFile}"],
23
- "autoAttachChildProcesses": true,
24
- "skipFiles": ["<node_internals>/**"],
25
- "smartStep": true,
26
- "console": "integratedTerminal"
20
+ "name": "Debug Bun File",
21
+ "program": "${file}", // This runs the currently active file
22
+ "cwd": "${workspaceFolder}",
23
+ "stopOnEntry": false // Set to true to pause on the first line
27
24
  },
28
- {
29
- "type": "node",
30
- "request": "launch",
31
- "name": "Debug E2E Tests (Bun)",
32
- "runtimeExecutable": "bun",
33
- "program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
34
- "args": ["run", "${relativeFile}", "--config", "./vitest.config.e2e.ts"],
35
- "autoAttachChildProcesses": true,
36
- "skipFiles": ["<node_internals>/**"],
37
- "smartStep": true,
38
- "console": "integratedTerminal"
39
- }
40
25
  ]
41
26
  }
@@ -1,20 +1,41 @@
1
- ARG BUN_VERSION=latest
2
- FROM oven/bun:${BUN_VERSION}
1
+ ARG BUN_VERSION=1.3.5-debian
2
+
3
+ # ====== STAGE 1: BUILDER ======
4
+ FROM oven/bun:${BUN_VERSION} AS builder
3
5
 
4
6
  # Criando diretório de trabalho
5
7
  WORKDIR /home/bun/app
6
8
 
7
9
  # Copiando arquivos de configuração com permissões
8
- COPY --chown=bun:bun package.json bun.lockb ./
10
+ COPY package.json bun.lock ./
9
11
 
10
12
  # Instalando dependências
11
13
  RUN bun install --frozen-lockfile
12
14
 
13
15
  # Copiando o restante do código com permissões
14
- COPY --chown=bun:bun . .
16
+ COPY . .
17
+
18
+ ENV DATABASE_URL=" "
15
19
 
16
20
  # Compilando o app
17
- RUN bun run build
21
+ RUN bun run prisma:generate && bun run build
22
+
23
+ # ====== STAGE 2: RUNTIME ======
24
+ FROM oven/bun:${BUN_VERSION}
25
+
26
+ # Create a non-root user and group
27
+ RUN apt-get update -y && \
28
+ apt-get install -y openssl curl && \
29
+ apt-get clean
30
+
31
+ # Criando diretório de trabalho
32
+ WORKDIR /home/bun/app
33
+
34
+ # Copiando apenas os arquivos necessários do builder
35
+ COPY --from=builder --chown=bun:bun --chmod=555 /home/bun/app/node_modules ./node_modules
36
+ COPY --from=builder --chown=bun:bun --chmod=555 /home/bun/app/prisma ./prisma
37
+ COPY --from=builder --chown=bun:bun --chmod=555 /home/bun/app/dist ./dist
38
+ COPY --from=builder --chown=bun:bun --chmod=555 /home/bun/app/package.json ./package.json
18
39
 
19
40
  # Alterando o usuário para "bun" por segurança
20
41
  USER bun
@@ -13,11 +13,11 @@
13
13
  "start:debug": "nest start app --debug --watch",
14
14
  "start:prod": "bun dist/host/main.js",
15
15
  "lint": "prettier --end-of-line lf --write . && bunx eslint --fix src/**/* && bunx eslint --fix .eslintrc.js",
16
- "test": "vitest run",
17
- "test:watch": "vitest",
18
- "test:cov": "vitest run --coverage",
19
- "test:debug": "vitest --inspect-brk --inspect --logHeapUsage --threads=false",
20
- "test:e2e": "vitest run --config ./vitest.config.e2e.mts",
16
+ "test": "bun test src/**/*.spec.ts",
17
+ "test:watch": "bun test --watch src/**/*.spec.ts",
18
+ "test:cov": "bun test --coverage src/**/*.spec.ts",
19
+ "test:debug": "bun test --inspect-brk src/**/*.spec.ts",
20
+ "test:e2e": "bun test --preload ./src/test/setup-e2e.ts src/**/*.e2e-spec.ts",
21
21
  "test:all": "bun run test && bun run test:e2e"
22
22
  },
23
23
  "dependencies": {
@@ -61,7 +61,6 @@
61
61
  "@types/supertest": "^6.0.2",
62
62
  "@typescript-eslint/eslint-plugin": "^8.27.0",
63
63
  "@typescript-eslint/parser": "^8.27.0",
64
- "@vitest/coverage-v8": "^3.0.9",
65
64
  "eslint": "^8.57.0",
66
65
  "eslint-config-prettier": "^8.3.0",
67
66
  "eslint-plugin-prettier": "^4.0.0",
@@ -71,10 +70,7 @@
71
70
  "prisma": "^7.2.0",
72
71
  "source-map-support": "^0.5.20",
73
72
  "supertest": "^7.1.0",
74
- "tsconfig-paths": "^4.2.0",
75
73
  "typescript": "^5.1.3",
76
- "unplugin-swc": "^1.5.1",
77
- "vite-tsconfig-paths": "^5.1.4",
78
- "vitest": "^3.0.9"
74
+ "unplugin-swc": "^1.5.1"
79
75
  }
80
76
  }
@@ -25,4 +25,7 @@ function fix(p) {
25
25
  }
26
26
  }
27
27
 
28
- try { fix(dir); } catch (e) {}
28
+ try { fix(dir); } catch (e) {
29
+ console.error('Error fixing extensions:', e);
30
+ process.exit(1);
31
+ }
@@ -3,5 +3,10 @@ import { dropE2EDatabase } from '@koalarx/nest/test/utils/drop-e2e-database'
3
3
 
4
4
  let schemaId: string
5
5
 
6
- beforeAll(() => (schemaId = createE2EDatabase()), 40000)
7
- afterAll(async () => dropE2EDatabase(schemaId))
6
+ beforeAll(async () => {
7
+ schemaId = await createE2EDatabase('bun')
8
+ }, 60000)
9
+
10
+ afterAll(async () => {
11
+ await dropE2EDatabase(schemaId)
12
+ })
@@ -22,7 +22,6 @@
22
22
  "strictBindCallApply": false,
23
23
  "forceConsistentCasingInFileNames": false,
24
24
  "noFallthroughCasesInSwitch": false,
25
- "resolveJsonModule": true,
26
- "types": ["vitest/globals"]
25
+ "resolveJsonModule": true
27
26
  }
28
27
  }
package/index.js CHANGED
@@ -30635,7 +30635,7 @@ var import_chalk2 = __toESM(require_chalk(), 1);
30635
30635
  // package.json
30636
30636
  var package_default = {
30637
30637
  name: "@koalarx/nest-cli",
30638
- version: "1.2.24",
30638
+ version: "2.0.0",
30639
30639
  description: "Biblioteca de CLI para criação de projetos utilizando Koala Nest",
30640
30640
  scripts: {
30641
30641
  test: "vitest run",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest-cli",
3
- "version": "1.2.24",
3
+ "version": "2.0.0",
4
4
  "description": "Biblioteca de CLI para criação de projetos utilizando Koala Nest",
5
5
  "scripts": {
6
6
  "test": "vitest run",
@@ -1,19 +0,0 @@
1
- import swc from "unplugin-swc";
2
- import tsConfigPatchs from "vite-tsconfig-paths";
3
- import { defineConfig } from "vitest/config";
4
-
5
- export default defineConfig({
6
- test: {
7
- globals: true,
8
- root: "./",
9
- environment: "node",
10
- include: ["**/*.e2e-spec.ts"],
11
- setupFiles: ["./src/test/setup-e2e.ts"],
12
- },
13
- plugins: [
14
- tsConfigPatchs(),
15
- swc.vite({
16
- module: { type: "es6" },
17
- }),
18
- ],
19
- });
@@ -1,18 +0,0 @@
1
- import swc from "unplugin-swc";
2
- import tsConfigPatchs from "vite-tsconfig-paths";
3
- import { defineConfig } from "vitest/config";
4
-
5
- export default defineConfig({
6
- test: {
7
- globals: true,
8
- root: "./",
9
- environment: "node",
10
- },
11
- plugins: [
12
- tsConfigPatchs(),
13
- swc.vite({
14
- module: { type: "es6" },
15
- sourceMaps: true,
16
- }),
17
- ],
18
- });