Skip to content

Commit

Permalink
Refactor yarn configuration and add environment configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
IhsenBouallegue authored and IhsenBouallegue committed Sep 20, 2024
1 parent 31d9aee commit 04fbcf8
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 9,001 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/static_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ jobs:
- name: Checkout git repo
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
node-version: 18
cache: "yarn"
bun-version: latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Run lint check
run: yarn lint
run: bun lint

formatting:
name: Formatting Check
Expand All @@ -30,16 +29,15 @@ jobs:
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
uses: oven-sh/setup-bun@v2
with:
node-version: 18
cache: "yarn"
bun-version: latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Run formatting check
run: yarn format:check
run: bun format:check

typecheck:
name: Type Check
Expand All @@ -49,13 +47,12 @@ jobs:
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
uses: oven-sh/setup-bun@v2
with:
node-version: 18
cache: "yarn"
bun-version: latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Run TypeCheck
run: yarn typecheck
run: bun typecheck
2 changes: 0 additions & 2 deletions .yarnrc.yml

This file was deleted.

15 changes: 0 additions & 15 deletions auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ export const {
await createPersonalOrganization(user);
},
},
cookies: {
sessionToken: {
name: `${useSecureCookies ? "__Secure-" : ""}next-auth.session-token`,
options: {
hostOnly: false,
httpOnly: true,
sameSite: "lax",
path: "/",
...(useSecureCookies
? { domain: ".huboneapp.com" }
: { domain: ".localtest.me" }),
secure: useSecureCookies,
},
},
},
callbacks: {
async session({ session, user }) {
return {
Expand Down
Binary file added bun.lockb
Binary file not shown.
7 changes: 2 additions & 5 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import * as dotenv from "dotenv";
import type { Config } from "drizzle-kit";

dotenv.config();

export default {
schema: "./src/lib/schema/*",
out: "./drizzle",
driver: "mysql2",
dialect: "postgresql",
verbose: true,
dbCredentials: {
uri: `${process.env.DATABASE_URL}`,
url: `${process.env.POSTGRES_URL}`,
},
} satisfies Config;
4 changes: 4 additions & 0 deletions drizzle/envConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { loadEnvConfig } from "@next/env";

const projectDir = process.cwd();
loadEnvConfig(projectDir);
20 changes: 0 additions & 20 deletions lefthook.yml

This file was deleted.

2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
204 changes: 100 additions & 104 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,100 @@
{
"name": "hubone",
"version": "2.3.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"analyze": "ANALYZE=true next build",
"typecheck": "tsc --noEmit",
"lint": "biome check --apply-unsafe ./src ./app",
"lint:check": "biome check ./src ./app",
"format": "biome format --write ./src ./app",
"format:check": "biome format ./src ./app",
"generate": "drizzle-kit generate:mysql2",
"stripe:listen": "stripe listen --forward-to localhost:3000/api/stripe/webhook"
},
"dependencies": {
"@auth/core": "^0.18.0",
"@auth/drizzle-adapter": "^0.3.3",
"@hookform/resolvers": "^3.3.1",
"@paralleldrive/cuid2": "2.2.2",
"@planetscale/database": "^1.11.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-toggle": "^1.0.3",
"@stripe/stripe-js": "2.1.10",
"@tabler/icons-react": "^2.17.0",
"@tanstack/react-query": "^4.12.0",
"@tanstack/react-query-devtools": "^4.12.0",
"@vercel/analytics": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
"drizzle-orm": "^0.29.0",
"drizzle-zod": "0.5.1",
"framer-motion": "^10.0.0",
"lucide-react": "^0.290.0",
"mysql2": "3.6.3",
"next": "14.0.0",
"next-auth": "beta",
"postgres": "^3.3.5",
"react": "18.2.0",
"react-day-picker": "^8.8.2",
"react-dom": "18.2.0",
"react-hook-form": "^7.47.0",
"recharts": "^2.8.0",
"sharp": "^0.32.6",
"stripe": "13.11.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4",
"zod-validation-error": "2.0.0",
"zustand": "4.4.4"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@biomejs/biome": "1.3.1",
"@evilmartians/lefthook": "^1.5.0",
"@next/eslint-plugin-next": "^14.0.0",
"@types/node": "20.8.9",
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14",
"@types/react-scroll": "^1.8.3",
"@typescript-eslint/eslint-plugin": "6.9.0",
"@typescript-eslint/parser": "6.9.0",
"autoprefixer": "latest",
"drizzle-kit": "0.20.2",
"eslint": "8.52.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-mantine": "^3.0.0",
"eslint-config-next": "14.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"postcss": "latest",
"postcss-preset-mantine": "^1.7.0",
"postcss-simple-vars": "^7.0.1",
"tailwindcss": "latest",
"ts-node": "^10.9.1",
"typescript": "5.2.2"
},
"packageManager": "[email protected]",
"yarn": {
"overrides": {
"@auth/core": "0.13.0"
}
}
}
{
"name": "hubone",
"version": "2.3.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"analyze": "ANALYZE=true next build",
"typecheck": "tsc --noEmit",
"lint": "biome check --apply-unsafe ./src ./app",
"lint:check": "biome check ./src ./app",
"format": "biome format --write ./src ./app",
"format:check": "biome format ./src ./app",
"generate": "drizzle-kit generate:mysql2",
"stripe:listen": "stripe listen --forward-to localhost:3000/api/stripe/webhook"
},
"dependencies": {
"@auth/core": "^0.18.0",
"@auth/drizzle-adapter": "^0.3.3",
"@hookform/resolvers": "^3.3.1",
"@next/env": "^14.2.13",
"@paralleldrive/cuid2": "2.2.2",
"@planetscale/database": "^1.11.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-toggle": "^1.0.3",
"@stripe/stripe-js": "2.1.10",
"@tabler/icons-react": "^2.17.0",
"@tanstack/react-query": "^4.12.0",
"@tanstack/react-query-devtools": "^4.12.0",
"@vercel/analytics": "^1.0.2",
"@vercel/postgres": "^0.10.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
"drizzle-orm": "^0.33.0",
"drizzle-zod": "0.5.1",
"framer-motion": "^10.0.0",
"lucide-react": "^0.290.0",
"mysql2": "3.6.3",
"next": "14.2.13",
"next-auth": "^5.0.0-beta.21",
"postgres": "^3.4.4",
"react": "18.2.0",
"react-day-picker": "^8.8.2",
"react-dom": "18.2.0",
"react-hook-form": "^7.47.0",
"recharts": "^2.8.0",
"sharp": "^0.32.6",
"stripe": "13.11.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4",
"zod-validation-error": "2.0.0",
"zustand": "4.4.4"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@biomejs/biome": "1.3.1",
"@evilmartians/lefthook": "^1.5.0",
"@next/eslint-plugin-next": "^14.0.0",
"@types/node": "20.8.9",
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14",
"@types/react-scroll": "^1.8.3",
"@typescript-eslint/eslint-plugin": "6.9.0",
"@typescript-eslint/parser": "6.9.0",
"autoprefixer": "latest",
"drizzle-kit": "^0.24.2",
"eslint": "8.52.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-mantine": "^3.0.0",
"eslint-config-next": "14.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"postcss": "latest",
"postcss-preset-mantine": "^1.7.0",
"postcss-simple-vars": "^7.0.1",
"tailwindcss": "latest",
"ts-node": "^10.9.1",
"typescript": "5.2.2"
}
}
10 changes: 3 additions & 7 deletions src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { connect } from "@planetscale/database";
import { drizzle } from "drizzle-orm/planetscale-serverless";
import { sql } from "@vercel/postgres";
import { drizzle } from "drizzle-orm/vercel-postgres";
import * as app from "./schema/app";
import * as auth from "./schema/auth";
import * as organizations from "./schema/orgaizations";
Expand All @@ -12,11 +12,7 @@ export async function getHubSpacesPaths() {
}));
}

const connection = connect({
url: process.env.DATABASE_URL,
});

const db = drizzle(connection, {
const db = drizzle(sql, {
schema: { ...auth, ...app, ...organizations },
});

Expand Down
Loading

0 comments on commit 04fbcf8

Please sign in to comment.