From 58892ab11549a6f7c3684810c6d7b5102f90a4c4 Mon Sep 17 00:00:00 2001 From: Dionizio Ferreira Date: Fri, 28 Nov 2025 08:59:19 -0300 Subject: [PATCH] =?UTF-8?q?Configura=C3=A7=C3=A3o=20para=20permitir=20uma?= =?UTF-8?q?=20porta=20diferente=20no=20pnpm=20e=20n=C3=A3o=20a=203000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.ts | 4 ++++ package.json | 7 +++++-- scripts/dev.ts | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 scripts/dev.ts diff --git a/next.config.ts b/next.config.ts index f1b384a..f07d7d6 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,4 +1,8 @@ import type { NextConfig } from "next"; +import dotenv from "dotenv"; + +// Carregar variáveis de ambiente explicitamente +dotenv.config(); const nextConfig: NextConfig = { // Output standalone para Docker (gera build otimizado com apenas deps necessárias) diff --git a/package.json b/package.json index a3c0abc..b7842ba 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev --turbopack", + "dev": "tsx scripts/dev.ts", "build": "next build", "start": "next start", "lint": "eslint .", @@ -12,6 +12,7 @@ "db:generate": "drizzle-kit generate", "db:migrate": "drizzle-kit migrate", "db:push": "drizzle-kit push", + "db:enableExtensions": "tsx scripts/postgres/enable-extensions.ts", "db:studio": "drizzle-kit studio", "docker:up": "docker compose up --build", "docker:up:db": "docker compose up -d db", @@ -79,9 +80,11 @@ "@tailwindcss/postcss": "4.1.17", "@types/d3-array": "^3.2.2", "@types/node": "24.10.1", + "@types/pg": "^8.15.6", "@types/react": "19.2.7", "@types/react-dom": "19.2.3", "depcheck": "^1.4.7", + "dotenv": "^17.2.3", "drizzle-kit": "0.31.7", "eslint": "9.39.1", "eslint-config-next": "16.0.4", @@ -89,4 +92,4 @@ "tsx": "4.20.6", "typescript": "5.9.3" } -} +} \ No newline at end of file diff --git a/scripts/dev.ts b/scripts/dev.ts new file mode 100644 index 0000000..2897570 --- /dev/null +++ b/scripts/dev.ts @@ -0,0 +1,17 @@ +#!/usr/bin/env tsx + +import { execSync } from 'child_process'; +import { config } from 'dotenv'; + +// Carregar variáveis de ambiente +config(); + +const port = process.env.PORT || '3000'; + +console.log(`Starting Next.js development server on port ${port}...`); + +// Executar next dev com a porta especificada +execSync(`npx next dev --turbopack --port ${port}`, { + stdio: 'inherit', + env: { ...process.env, PORT: port } +}); \ No newline at end of file