From bae1bccbd8029db4bacbd8ecc9f668e7119016c8 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Thu, 8 Feb 2024 17:22:31 +0000 Subject: Migrating away from bun to yarn --- .eslintrc.js | 33 + .eslintrc.json | 25 - .github/workflows/main.yml | 16 +- .gitignore | 1 + Makefile | 12 +- bun.lockb | Bin 271784 -> 0 bytes package.json | 5 +- .../dashboard/bookmarks/components/LinkCard.tsx | 6 +- packages/web/app/dashboard/components/Sidebar.tsx | 2 +- packages/web/bun.lockb | Bin 158558 -> 0 bytes packages/web/components/ui/form.tsx | 101 +- packages/web/components/ui/label.tsx | 20 +- packages/workers/index.ts | 9 +- packages/workers/package.json | 11 +- yarn.lock | 5012 ++++++++++++++++++++ 15 files changed, 5148 insertions(+), 105 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.json delete mode 100755 bun.lockb delete mode 100755 packages/web/bun.lockb create mode 100644 yarn.lock diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..dd6342ad --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,33 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "next/core-web-vitals", + "eslint:recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:@next/next/recommended", + "next", + "prettier" + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "ignorePatterns": ["postcss.config.js"], + "rules": { + "no-redeclare": "off", + "@next/next/no-html-link-for-pages": "off", + "no-undef": "off", + "react/jsx-no-undef": "off", + "no-unused-vars": [ + "error", + { + "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_" + } + ] + } +} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 38293435..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": [ - "next/core-web-vitals", - "eslint:recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:@next/next/recommended", - "next", - "prettier" - ], - "ignorePatterns": ["postcss.config.js"], - "rules": { - "no-redeclare": "off", - "@next/next/no-html-link-for-pages": "off", - "no-undef": "off", - "react/jsx-no-undef": "off", - "no-unused-vars": [ - "error", - { - "varsIgnorePattern": "^_", - "argsIgnorePattern": "^_" - } - ] - } -} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2abb4cff..0bd6d077 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,16 +9,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v1 + - uses: actions/setup-node@v4 + with: + node-version: 21 + cache: 'yarn' + cache-dependency-path: 'yarn.lock' - name: Install deps - run: bun install --frozen-lockfile + run: yarn install --frozen-lockfile - name: Lint - run: bunx eslint . + run: yarn eslint . - name: Format - run: bunx prettier . --check + run: yarn prettier . --check - name: Prisma working-directory: packages/db - run: bunx prisma generate + run: yarn prisma generate - name: Build web app working-directory: packages/web - run: bun run build + run: yarn run build diff --git a/.gitignore b/.gitignore index bd3396c4..9e0d5bae 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel diff --git a/Makefile b/Makefile index 4d8bace2..78c0da13 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ MAKEFLAGS += --always-make format: - bunx prettier . --write && bunx eslint . + yarn prettier . --write && yarn exec 'eslint .' prisma: cd packages/db; \ - bunx prisma migrate dev; \ - bunx prisma generate + yarn prisma migrate dev; \ + yarn prisma generate workers: cd packages/workers; \ - bun --watch index.ts + yarn start web: cd packages/web; \ - bun run dev + yarn run dev studio: cd packages/db; \ - bunx prisma studio + yarn prisma studio diff --git a/bun.lockb b/bun.lockb deleted file mode 100755 index 68c63f80..00000000 Binary files a/bun.lockb and /dev/null differ diff --git a/package.json b/package.json index 17d9febd..db808996 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,10 @@ "eslint-plugin-react-hooks": "^4.6.0" }, "devDependencies": { - "typescript": "^5", "@types/node": "^20", "eslint": "^8.56.0", - "eslint-config-next": "14.1.0" + "eslint-config-next": "14.1.0", + "prettier": "3.2.5", + "typescript": "^5" } } diff --git a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx index da59d9da..b5a051e8 100644 --- a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx +++ b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx @@ -76,7 +76,11 @@ export default function LinkCard({ link }: { link: ZBookmarkedLink }) { {link.tags.map((t) => ( - + #{t.name} ))} diff --git a/packages/web/app/dashboard/components/Sidebar.tsx b/packages/web/app/dashboard/components/Sidebar.tsx index 0ed87daf..f2ead71a 100644 --- a/packages/web/app/dashboard/components/Sidebar.tsx +++ b/packages/web/app/dashboard/components/Sidebar.tsx @@ -1,6 +1,6 @@ import { Button } from "@/components/ui/button"; import { authOptions } from "@/lib/auth"; -import { Archive, MoreHorizontal, Star, Tag, Home, Brain} from "lucide-react"; +import { Archive, MoreHorizontal, Star, Tag, Home, Brain } from "lucide-react"; import { getServerSession } from "next-auth"; import Link from "next/link"; import { redirect } from "next/navigation"; diff --git a/packages/web/bun.lockb b/packages/web/bun.lockb deleted file mode 100755 index 7925e942..00000000 Binary files a/packages/web/bun.lockb and /dev/null differ diff --git a/packages/web/components/ui/form.tsx b/packages/web/components/ui/form.tsx index 4603f8b3..497718a9 100644 --- a/packages/web/components/ui/form.tsx +++ b/packages/web/components/ui/form.tsx @@ -1,6 +1,6 @@ -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { Slot } from "@radix-ui/react-slot" +import * as React from "react"; +import * as LabelPrimitive from "@radix-ui/react-label"; +import { Slot } from "@radix-ui/react-slot"; import { Controller, ControllerProps, @@ -8,27 +8,27 @@ import { FieldValues, FormProvider, useFormContext, -} from "react-hook-form" +} from "react-hook-form"; -import { cn } from "@/lib/utils" -import { Label } from "@/components/ui/label" +import { cn } from "@/lib/utils"; +import { Label } from "@/components/ui/label"; -const Form = FormProvider +const Form = FormProvider; type FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath + TName extends FieldPath = FieldPath, > = { - name: TName -} + name: TName; +}; const FormFieldContext = React.createContext( - {} as FormFieldContextValue -) + {} as FormFieldContextValue, +); const FormField = < TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath + TName extends FieldPath = FieldPath, >({ ...props }: ControllerProps) => { @@ -36,21 +36,21 @@ const FormField = < - ) -} + ); +}; const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() + const fieldContext = React.useContext(FormFieldContext); + const itemContext = React.useContext(FormItemContext); + const { getFieldState, formState } = useFormContext(); - const fieldState = getFieldState(fieldContext.name, formState) + const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { - throw new Error("useFormField should be used within ") + throw new Error("useFormField should be used within "); } - const { id } = itemContext + const { id } = itemContext; return { id, @@ -59,36 +59,36 @@ const useFormField = () => { formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, - } -} + }; +}; type FormItemContextValue = { - id: string -} + id: string; +}; const FormItemContext = React.createContext( - {} as FormItemContextValue -) + {} as FormItemContextValue, +); const FormItem = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => { - const id = React.useId() + const id = React.useId(); return (
- ) -}) -FormItem.displayName = "FormItem" + ); +}); +FormItem.displayName = "FormItem"; const FormLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField() + const { error, formItemId } = useFormField(); return (