From 69c40d795dac32dbe2ab0a4ab76970632546e3df Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Wed, 1 May 2024 17:50:31 -0700 Subject: [PATCH 1/4] fix: lockfile --- pnpm-lock.yaml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bac1f69..f76a5c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3135,7 +3135,14 @@ packages: /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - + + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: false + /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} dev: false @@ -3306,6 +3313,11 @@ packages: slash: 3.0.0 dev: true + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: false + /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -6006,15 +6018,15 @@ packages: prosemirror-transform: 1.8.0 dev: false + /proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + dev: false + /punycode.js@2.3.1: resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} engines: {node: '>=6'} dev: false - /proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} From e6fba07ed0beb78a254c6764d74b68d8cd9e3caf Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Wed, 1 May 2024 17:59:42 -0700 Subject: [PATCH 2/4] fix: lint errors pnpm lint was generating errors due to prisma calling some global environment varibles that were not declared, so I have declared them in the turbo.json file. --- turbo.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/turbo.json b/turbo.json index 99e56a9..cd47e44 100644 --- a/turbo.json +++ b/turbo.json @@ -1,5 +1,6 @@ { "$schema": "https://turbo.build/schema.json", + "globalEnv": ["NODE_ENV", "JWT_SECRET"], "globalDependencies": [ "**/.env.*local" ], @@ -30,4 +31,4 @@ "cache": false } } -} \ No newline at end of file +} From 3b917a981e696700847f6e6c3e2eb3c0bd292488 Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Wed, 1 May 2024 17:59:50 -0700 Subject: [PATCH 3/4] feat: add husky Adds pre-commit hooks to automatically lint everything --- .husky/pre-commit | 2 ++ package.json | 6 ++++-- pnpm-lock.yaml | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..d0c1533 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +pnpm lint +pnpm format diff --git a/package.json b/package.json index 13c412b..5fe878a 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,16 @@ "dev": "turbo run dev", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", - "ui:add": "pnpm --filter ui ui:add" + "ui:add": "pnpm --filter ui ui:add", + "prepare": "husky" }, "devDependencies": { "@turbo/gen": "^1.9.7", "eslint": "^7.32.0", "eslint-config-custom": "workspace:*", + "husky": "^9.0.11", "prettier": "^2.5.1", "turbo": "latest" }, "packageManager": "pnpm@8.6.2" -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f76a5c3..9670090 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: eslint-config-custom: specifier: workspace:* version: link:packages/eslint-config-custom + husky: + specifier: ^9.0.11 + version: 9.0.11 prettier: specifier: ^2.5.1 version: 2.8.8 @@ -4454,6 +4457,12 @@ packages: engines: {node: '>=14.18.0'} dev: false + /husky@9.0.11: + resolution: {integrity: sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==} + engines: {node: '>=18'} + hasBin: true + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} From 3eaf8f7ad0219ae3003c2c3de85c5f5b8fb94462 Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Wed, 1 May 2024 18:01:27 -0700 Subject: [PATCH 4/4] chore: lint project First lint so it had to be a separate commit --- README.md | 6 +- packages/ui/components/ui/alert-dialog.tsx | 50 +++---- packages/ui/components/ui/alert.tsx | 22 +-- packages/ui/components/ui/aspect-ratio.tsx | 8 +- packages/ui/components/ui/avatar.tsx | 22 +-- packages/ui/components/ui/badge.tsx | 12 +- packages/ui/components/ui/breadcrumb.tsx | 46 +++---- packages/ui/components/ui/button.tsx | 22 +-- packages/ui/components/ui/calendar.tsx | 20 +-- packages/ui/components/ui/card.tsx | 37 +++-- packages/ui/components/ui/carousel.tsx | 144 ++++++++++---------- packages/ui/components/ui/checkbox.tsx | 16 +-- packages/ui/components/ui/collapsible.tsx | 12 +- packages/ui/components/ui/command.tsx | 54 ++++---- packages/ui/components/ui/context-menu.tsx | 68 ++++----- packages/ui/components/ui/dialog.tsx | 44 +++--- packages/ui/components/ui/drawer.tsx | 44 +++--- packages/ui/components/ui/dropdown-menu.tsx | 68 ++++----- packages/ui/components/ui/form.tsx | 93 ++++++------- packages/ui/components/ui/hover-card.tsx | 18 +-- packages/ui/components/ui/input-otp.tsx | 34 ++--- packages/ui/components/ui/input.tsx | 12 +- packages/ui/components/ui/label.tsx | 18 +-- packages/ui/components/ui/menubar.tsx | 74 +++++----- packages/ui/components/ui/pagination.tsx | 42 +++--- packages/ui/components/ui/popover.tsx | 18 +-- packages/ui/components/ui/progress.tsx | 14 +- packages/ui/components/ui/radio-group.tsx | 24 ++-- packages/ui/components/ui/resizable.tsx | 18 +-- packages/ui/components/ui/scroll-area.tsx | 18 +-- packages/ui/components/ui/select.tsx | 46 +++---- packages/ui/components/ui/separator.tsx | 14 +- packages/ui/components/ui/sheet.tsx | 48 +++---- packages/ui/components/ui/skeleton.tsx | 6 +- packages/ui/components/ui/slider.tsx | 14 +- packages/ui/components/ui/sonner.tsx | 16 +-- packages/ui/components/ui/switch.tsx | 14 +- packages/ui/components/ui/table.tsx | 38 +++--- packages/ui/components/ui/tabs.tsx | 24 ++-- packages/ui/components/ui/textarea.tsx | 12 +- packages/ui/components/ui/toast.tsx | 48 +++---- packages/ui/components/ui/toaster.tsx | 12 +- packages/ui/components/ui/toggle-group.tsx | 28 ++-- packages/ui/components/ui/toggle.tsx | 18 +-- packages/ui/components/ui/tooltip.tsx | 20 +-- packages/ui/components/ui/use-toast.ts | 127 +++++++++-------- packages/ui/lib/utils.ts | 8 +- 47 files changed, 788 insertions(+), 783 deletions(-) diff --git a/README.md b/README.md index a115fd9..265c2bc 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,11 @@ pnpm ui:add ### Docker Both the api (`api.Dockerfile`) and the web app (`web.Dockerfile`) are dockerized and managed by docker-compose (`docker-compose.yml`). You can start everything with: + ```sh docker-compose watch ``` + This will start the api, the web app, and the database. It also enables hot reloading for both the api and the web app. ### Database @@ -72,12 +74,10 @@ Currently, the monorepo contains the following packages and applications: - `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`) - `tsconfig`: `tsconfig.json`s used throughout the monorepo - ## Credits Thank you to [dan5py](https://github.com/dan5py/turborepo-shadcn-ui) for the original template, allowing our club to build on top of it. - ## License -BeavBright is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \ No newline at end of file +BeavBright is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/packages/ui/components/ui/alert-dialog.tsx b/packages/ui/components/ui/alert-dialog.tsx index 1f80bd5..221bde7 100644 --- a/packages/ui/components/ui/alert-dialog.tsx +++ b/packages/ui/components/ui/alert-dialog.tsx @@ -1,16 +1,16 @@ -"use client" +"use client"; -import * as React from "react" -import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" +import * as React from "react"; +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; -import { cn } from "@ui/lib/utils" -import { buttonVariants } from "@ui/components/ui/button" +import { cn } from "@ui/lib/utils"; +import { buttonVariants } from "@ui/components/ui/button"; -const AlertDialog = AlertDialogPrimitive.Root +const AlertDialog = AlertDialogPrimitive.Root; -const AlertDialogTrigger = AlertDialogPrimitive.Trigger +const AlertDialogTrigger = AlertDialogPrimitive.Trigger; -const AlertDialogPortal = AlertDialogPrimitive.Portal +const AlertDialogPortal = AlertDialogPrimitive.Portal; const AlertDialogOverlay = React.forwardRef< React.ElementRef, @@ -24,8 +24,8 @@ const AlertDialogOverlay = React.forwardRef< {...props} ref={ref} /> -)) -AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName +)); +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName; const AlertDialogContent = React.forwardRef< React.ElementRef, @@ -42,8 +42,8 @@ const AlertDialogContent = React.forwardRef< {...props} /> -)) -AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName +)); +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName; const AlertDialogHeader = ({ className, @@ -56,8 +56,8 @@ const AlertDialogHeader = ({ )} {...props} /> -) -AlertDialogHeader.displayName = "AlertDialogHeader" +); +AlertDialogHeader.displayName = "AlertDialogHeader"; const AlertDialogFooter = ({ className, @@ -70,8 +70,8 @@ const AlertDialogFooter = ({ )} {...props} /> -) -AlertDialogFooter.displayName = "AlertDialogFooter" +); +AlertDialogFooter.displayName = "AlertDialogFooter"; const AlertDialogTitle = React.forwardRef< React.ElementRef, @@ -82,8 +82,8 @@ const AlertDialogTitle = React.forwardRef< className={cn("text-lg font-semibold", className)} {...props} /> -)) -AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName +)); +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName; const AlertDialogDescription = React.forwardRef< React.ElementRef, @@ -94,9 +94,9 @@ const AlertDialogDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> -)) +)); AlertDialogDescription.displayName = - AlertDialogPrimitive.Description.displayName + AlertDialogPrimitive.Description.displayName; const AlertDialogAction = React.forwardRef< React.ElementRef, @@ -107,8 +107,8 @@ const AlertDialogAction = React.forwardRef< className={cn(buttonVariants(), className)} {...props} /> -)) -AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName +)); +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; const AlertDialogCancel = React.forwardRef< React.ElementRef, @@ -123,8 +123,8 @@ const AlertDialogCancel = React.forwardRef< )} {...props} /> -)) -AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName +)); +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; export { AlertDialog, @@ -138,4 +138,4 @@ export { AlertDialogDescription, AlertDialogAction, AlertDialogCancel, -} +}; diff --git a/packages/ui/components/ui/alert.tsx b/packages/ui/components/ui/alert.tsx index ceabd25..c43e38f 100644 --- a/packages/ui/components/ui/alert.tsx +++ b/packages/ui/components/ui/alert.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react"; +import { cva, type VariantProps } from "class-variance-authority"; -import { cn } from "@ui/lib/utils" +import { cn } from "@ui/lib/utils"; const alertVariants = cva( "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", @@ -17,7 +17,7 @@ const alertVariants = cva( variant: "default", }, } -) +); const Alert = React.forwardRef< HTMLDivElement, @@ -29,8 +29,8 @@ const Alert = React.forwardRef< className={cn(alertVariants({ variant }), className)} {...props} /> -)) -Alert.displayName = "Alert" +)); +Alert.displayName = "Alert"; const AlertTitle = React.forwardRef< HTMLParagraphElement, @@ -41,8 +41,8 @@ const AlertTitle = React.forwardRef< className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} /> -)) -AlertTitle.displayName = "AlertTitle" +)); +AlertTitle.displayName = "AlertTitle"; const AlertDescription = React.forwardRef< HTMLParagraphElement, @@ -53,7 +53,7 @@ const AlertDescription = React.forwardRef< className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} /> -)) -AlertDescription.displayName = "AlertDescription" +)); +AlertDescription.displayName = "AlertDescription"; -export { Alert, AlertTitle, AlertDescription } +export { Alert, AlertTitle, AlertDescription }; diff --git a/packages/ui/components/ui/aspect-ratio.tsx b/packages/ui/components/ui/aspect-ratio.tsx index d6a5226..359bc94 100644 --- a/packages/ui/components/ui/aspect-ratio.tsx +++ b/packages/ui/components/ui/aspect-ratio.tsx @@ -1,7 +1,7 @@ -"use client" +"use client"; -import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"; -const AspectRatio = AspectRatioPrimitive.Root +const AspectRatio = AspectRatioPrimitive.Root; -export { AspectRatio } +export { AspectRatio }; diff --git a/packages/ui/components/ui/avatar.tsx b/packages/ui/components/ui/avatar.tsx index 3ae00df..adc524d 100644 --- a/packages/ui/components/ui/avatar.tsx +++ b/packages/ui/components/ui/avatar.tsx @@ -1,9 +1,9 @@ -"use client" +"use client"; -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" +import * as React from "react"; +import * as AvatarPrimitive from "@radix-ui/react-avatar"; -import { cn } from "@ui/lib/utils" +import { cn } from "@ui/lib/utils"; const Avatar = React.forwardRef< React.ElementRef, @@ -17,8 +17,8 @@ const Avatar = React.forwardRef< )} {...props} /> -)) -Avatar.displayName = AvatarPrimitive.Root.displayName +)); +Avatar.displayName = AvatarPrimitive.Root.displayName; const AvatarImage = React.forwardRef< React.ElementRef, @@ -29,8 +29,8 @@ const AvatarImage = React.forwardRef< className={cn("aspect-square h-full w-full", className)} {...props} /> -)) -AvatarImage.displayName = AvatarPrimitive.Image.displayName +)); +AvatarImage.displayName = AvatarPrimitive.Image.displayName; const AvatarFallback = React.forwardRef< React.ElementRef, @@ -44,7 +44,7 @@ const AvatarFallback = React.forwardRef< )} {...props} /> -)) -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName +)); +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; -export { Avatar, AvatarImage, AvatarFallback } +export { Avatar, AvatarImage, AvatarFallback }; diff --git a/packages/ui/components/ui/badge.tsx b/packages/ui/components/ui/badge.tsx index 2fe15ae..5e1662a 100644 --- a/packages/ui/components/ui/badge.tsx +++ b/packages/ui/components/ui/badge.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react"; +import { cva, type VariantProps } from "class-variance-authority"; -import { cn } from "@ui/lib/utils" +import { cn } from "@ui/lib/utils"; const badgeVariants = cva( "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", @@ -21,7 +21,7 @@ const badgeVariants = cva( variant: "default", }, } -) +); export interface BadgeProps extends React.HTMLAttributes, @@ -30,7 +30,7 @@ export interface BadgeProps function Badge({ className, variant, ...props }: BadgeProps) { return (
- ) + ); } -export { Badge, badgeVariants } +export { Badge, badgeVariants }; diff --git a/packages/ui/components/ui/breadcrumb.tsx b/packages/ui/components/ui/breadcrumb.tsx index c8b2185..972f377 100644 --- a/packages/ui/components/ui/breadcrumb.tsx +++ b/packages/ui/components/ui/breadcrumb.tsx @@ -1,16 +1,16 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { ChevronRight, MoreHorizontal } from "lucide-react" +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { ChevronRight, MoreHorizontal } from "lucide-react"; -import { cn } from "@ui/lib/utils" +import { cn } from "@ui/lib/utils"; const Breadcrumb = React.forwardRef< HTMLElement, React.ComponentPropsWithoutRef<"nav"> & { - separator?: React.ReactNode + separator?: React.ReactNode; } ->(({ ...props }, ref) =>