Skip to content

Commit

Permalink
Merge pull request #639 from FleetAdmiralJakob/overhaul-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
FleetAdmiralJakob authored Nov 3, 2024
2 parents ff3f3ff + 09a2d42 commit dec3965
Show file tree
Hide file tree
Showing 58 changed files with 4,414 additions and 2,335 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
pull_request:
branches: ["*"]
push:
branches: ["main"]
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Copy env
shell: bash
run: cp .env.example .env

- name: Lint
run: pnpm lint

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Format
run: pnpm format
2 changes: 1 addition & 1 deletion .github/workflows/update-convex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
run: pnpm convex:deploy
env:
CONVEX_URL: ${{ secrets.CONVEX_PROD_URL }}
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_PROD_DEPLOY_KEY }}
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_PROD_DEPLOY_KEY }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
convex/_generated
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "~/components",
"utils": "~/lib/utils"
}
}
}
4 changes: 2 additions & 2 deletions convex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ A query function that takes two arguments looks like:

```ts
// functions.js
import { query } from "./_generated/server";
import { v } from "convex/values";
import { query } from "./_generated/server";

export const myQueryFunction = query({
// Validators for arguments.
Expand Down Expand Up @@ -46,8 +46,8 @@ A mutation function looks like:

```ts
// functions.js
import { mutation } from "./_generated/server";
import { v } from "convex/values";
import { mutation } from "./_generated/server";

export const myMutationFunction = mutation({
// Validators for arguments.
Expand Down
3 changes: 2 additions & 1 deletion convex/chats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mutation, query } from "./lib/functions";
import { ConvexError, v } from "convex/values";
import { mutation, query } from "./lib/functions";

export const createChat = mutation({
args: { friendsUsername: v.string(), friendsUsernameId: v.string() },
Expand Down Expand Up @@ -79,6 +79,7 @@ export const initialConvexSetup = mutation({
username: identity.nickname,
clerkId: identity.tokenIdentifier,
firstName: identity.givenName,
// This is safe to do and doesn't need to be hashed/encrypted because Convex already encrypts the data.
email: identity.email,
lastName: identity.familyName,
})
Expand Down
2 changes: 1 addition & 1 deletion convex/clearRequests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { internalMutation, mutation } from "./lib/functions";
import { ConvexError, v } from "convex/values";
import { internalMutation, mutation } from "./lib/functions";

export const createClearRequest = mutation({
args: { chatId: v.string() },
Expand Down
8 changes: 4 additions & 4 deletions convex/lib/functions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { entsTableFactory } from "convex-ents";
import {
customCtx,
customMutation,
customQuery,
} from "convex-helpers/server/customFunctions";
import {
query as baseQuery,
mutation as baseMutation,
internalQuery as baseInternalQuery,
internalMutation as baseInternalMutation,
internalQuery as baseInternalQuery,
mutation as baseMutation,
query as baseQuery,
} from "../_generated/server";
import { entsTableFactory } from "convex-ents";
import { entDefinitions } from "../schema";

export const query = customQuery(
Expand Down
10 changes: 5 additions & 5 deletions convex/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CustomCtx } from "convex-helpers/server/customFunctions";
import { GenericEnt, GenericEntWriter } from "convex-ents";
import { TableNames } from "../_generated/dataModel";
import { mutation, query } from "./functions";
import { entDefinitions } from "../schema";
import { type GenericEnt, type GenericEntWriter } from "convex-ents";
import { type CustomCtx } from "convex-helpers/server/customFunctions";
import { type TableNames } from "../_generated/dataModel";
import { type entDefinitions } from "../schema";
import { type mutation, type query } from "./functions";

export type QueryCtx = CustomCtx<typeof query>;
export type MutationCtx = CustomCtx<typeof mutation>;
Expand Down
2 changes: 1 addition & 1 deletion convex/messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mutation, query } from "./lib/functions";
import { ConvexError, v } from "convex/values";
import { mutation, query } from "./lib/functions";

export const getMessages = query({
args: { chatId: v.string() },
Expand Down
3 changes: 2 additions & 1 deletion convex/users.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mutation, query } from "./lib/functions";
import { v } from "convex/values";
import { mutation, query } from "./lib/functions";

export const getUserData = query({
handler: async (ctx) => {
Expand Down Expand Up @@ -34,6 +34,7 @@ export const updateUserData = mutation({

if (args.data.email) {
await user.patch({
// This is safe to do and doesn't need to be hashed/encrypted because Convex already encrypts the data.
email: args.data.email,
});
}
Expand Down
16 changes: 13 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// <reference types="./eslint-types.d.ts" />

import { fixupConfigRules } from "@eslint/compat";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { fixupConfigRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -17,6 +17,9 @@ const compat = new FlatCompat({
});

export default [
{
ignores: [".next/**", "convex/_generated/**", "public/sw.js"],
},
...fixupConfigRules(
compat.extends(
"next/core-web-vitals",
Expand Down Expand Up @@ -82,4 +85,11 @@ export default [
],
},
},
{
files: ["convex/**", "src/env.ts"],
rules: {
"no-restricted-properties": "off",
"no-restricted-imports": "off",
},
},
];
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import createJiti from "jiti";
import { fileURLToPath } from "node:url";
import withSerwistInit from "@serwist/next";
import createJiti from "jiti";

const withSerwist = withSerwistInit({
swSrc: "src/sw.ts",
Expand All @@ -18,6 +18,9 @@ jiti("./src/env.ts");
/** @type {import("next").NextConfig} */
const config = withSerwist({
transpilePackages: ["geist"],
experimental: {
reactCompiler: true,
},
});

export default config;
45 changes: 24 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@
"dev": "npm-run-all --parallel next:dev convex:dev ",
"convex:dev": "convex dev --tail-logs",
"next:dev": "next dev --turbo",
"format": "prettier --check . --ignore-path .gitignore --ignore-path .prettierignore",
"lint": "next lint",
"start": "next start",
"preinstall": "npx only-allow pnpm",
"convex:deploy": "convex deploy"
},
"dependencies": {
"@clerk/nextjs": "^6.0.2",
"@clerk/shared": "^2.10.1",
"@floating-ui/react": "^0.26.25",
"@hookform/resolvers": "^3.9.0",
"@legendapp/state": "3.0.0-beta.15",
"@clerk/nextjs": "^6.1.3",
"@clerk/shared": "^2.11.3",
"@floating-ui/react": "^0.26.27",
"@hookform/resolvers": "^3.9.1",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@legendapp/state": "^3.0.0-beta.16",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-icons": "^1.3.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-progress": "^1.1.0",
Expand All @@ -31,48 +33,49 @@
"@radix-ui/react-tooltip": "^1.1.3",
"@serwist/next": "9.0.9",
"@t3-oss/env-nextjs": "^0.11.1",
"babel-plugin-react-compiler": "19.0.0-beta-6fc168f-20241025",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",
"cmdk": "^1.0.3",
"convex": "^1.17.0",
"convex-ents": "^0.12.0",
"convex-helpers": "^0.1.63",
"dayjs": "^1.11.13",
"framer-motion": "^11.11.10",
"framer-motion": "^11.11.11",
"geist": "^1.3.1",
"jiti": "^2.3.3",
"jiti": "^2.4.0",
"lucide-react": "^0.454.0",
"next": "^15.0.1",
"next": "^15.0.2",
"next-themes": "^0.3.0",
"npm-run-all2": "^7.0.1",
"providers": "link:providers",
"react": "19.0.0-rc-69d4b800-20241021",
"react-dom": "19.0.0-rc-69d4b800-20241021",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"react-hook-form": "^7.53.1",
"react-icons": "^5.3.0",
"react-intersection-observer": "^9.13.1",
"react-resizable-panels": "^2.1.5",
"react-resizable-panels": "^2.1.6",
"react-responsive": "^10.0.0",
"sonner": "^1.5.0",
"sonner": "^1.6.1",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@eslint/compat": "^1.2.1",
"@eslint/compat": "^1.2.2",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@eslint/js": "^9.14.0",
"@total-typescript/ts-reset": "^0.6.1",
"@types/eslint": "^9.6.1",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.8.1",
"@types/node": "^22.8.7",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"autoprefixer": "^10.4.20",
"eslint": "^9.13.0",
"eslint-config-next": "^15.0.1",
"eslint": "^9.14.0",
"eslint-config-next": "^15.0.2",
"eslint-plugin-react-hooks": "^5.0.0",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
Expand Down
Loading

0 comments on commit dec3965

Please sign in to comment.