Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarescu committed Jan 15, 2025
1 parent 30cd5a3 commit 4ee514e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/shortest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
cp .vercel/.env.preview.local .env.local
test -f .env.local || (echo ".env.local not created" && exit 1)
- name: Set up database
- name: Setup database
run: |
pnpm drizzle-kit generate
pnpm db:migrate
Expand Down
2 changes: 1 addition & 1 deletion lib/db/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from "dotenv";
import { sql } from "drizzle-orm";
import { db, client } from "@/lib/db/drizzle";

dotenv.config();
dotenv.config({ path: ".env.local" });

async function cleanup() {
try {
Expand Down
3 changes: 2 additions & 1 deletion lib/db/drizzle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "@/lib/db/schema";

dotenv.config();
// Load .env and .env.local
dotenv.config({ path: ".env.local" });

if (!process.env.POSTGRES_URL) {
throw new Error("POSTGRES_URL environment variable is not set");
Expand Down
2 changes: 1 addition & 1 deletion lib/db/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { migrate } from "drizzle-orm/postgres-js/migrator";

import { client, db } from "@/lib/db/drizzle";

dotenv.config();
dotenv.config({ path: ".env.local" });

async function main() {
await migrate(db, {
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"db:seed": "dotenv -e .env.local -- npx tsx lib/db/seed.ts",
"db:generate": "dotenv -e .env.local -- drizzle-kit generate",
"db:migrate": "dotenv -e .env.local -- npx tsx lib/db/migrate.ts",
"db:studio": "dotenv -e .env.local -- drizzle-kit studio",
"db:cleanup": "dotenv -e .env.local -- tsx lib/db/cleanup.ts",
"db:seed": "npx tsx lib/db/seed.ts",
"db:generate": "drizzle-kit generate",
"db:migrate": "npx tsx lib/db/migrate.ts",
"db:studio": "drizzle-kit studio",
"db:cleanup": "tsx lib/db/cleanup.ts",
"stripe:webhooks": "stripe listen --forward-to http://localhost:3000/api/stripe/webhook",
"setup": "dotenv -e .env.local -- npx tsx lib/setup.ts",
"pkg:build": "dotenv -e .env.local -- cd packages/shortest && pnpm build",
"pkg:dev": "dotenv -e .env.local -- cd packages/shortest && pnpm dev",
"pkg:test": "dotenv -e .env.local -- cd packages/shortest && pnpm shortest",
"pkg:test:src": "dotenv -e .env.local -- npx tsx packages/shortest/src/cli/bin.ts",
"test": "dotenv -e .env.local -- pnpm shortest",
"setup": "npx tsx lib/setup.ts",
"pkg:build": "cd packages/shortest && pnpm build",
"pkg:dev": "cd packages/shortest && pnpm dev",
"pkg:test": "cd packages/shortest && pnpm shortest",
"pkg:test:src": "npx tsx packages/shortest/src/cli/bin.ts",
"test": "pnpm shortest",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"typecheck": "tsc --noEmit --incremental"
Expand Down
1 change: 0 additions & 1 deletion packages/shortest/src/browser/integrations/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class GitHubTool {

constructor(secret?: string) {
dotenv.config({ path: ".env.local" });
dotenv.config({ path: ".env" });

this.totpSecret = secret || process.env.GITHUB_TOTP_SECRET || "";

Expand Down
2 changes: 0 additions & 2 deletions packages/shortest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ if (!global.__shortest__) {
// Attach to global scope
global.expect = global.__shortest__.expect;

dotenv.config({ path: join(process.cwd(), ".env") });
dotenv.config({ path: join(process.cwd(), ".env.local") });
}

Expand All @@ -65,7 +64,6 @@ function validateConfig(config: Partial<ShortestConfig>) {
export async function initialize() {
if (globalConfig) return globalConfig;

dotenv.config({ path: join(process.cwd(), ".env") });
dotenv.config({ path: join(process.cwd(), ".env.local") });

const configFiles = [
Expand Down
20 changes: 0 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ee514e

Please sign in to comment.