Skip to content

Commit

Permalink
chore: major refactor
Browse files Browse the repository at this point in the history
- update turbo setup config
- move api-client hooks to barrel file and fix exports
- refactor everyone using the hooks
- make dev tasks non persistent except for the main app dev task
  • Loading branch information
matyson committed Jan 21, 2025
1 parent 4b77308 commit 7ab169f
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/env-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useStatus } from "@sophys-web/api-client/hooks/use-status";
import { useStatus } from "@sophys-web/api-client/hooks";
import { cn } from "@sophys-web/ui";
import { buttonVariants } from "@sophys-web/ui/button";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/history.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { RotateCcwIcon } from "lucide-react";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { api } from "@sophys-web/api-client/react";
import { cn } from "@sophys-web/ui";
import { Button } from "@sophys-web/ui/button";
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/on-demand/cleaning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { DropletIcon } from "lucide-react";
import { useForm } from "react-hook-form";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { Button } from "@sophys-web/ui/button";
import {
Dialog,
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/on-demand/queue-stop.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SquareIcon } from "lucide-react";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { Button } from "@sophys-web/ui/button";

export function QueueStop({ className }: { className?: string }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { CameraIcon } from "lucide-react";
import { useForm } from "react-hook-form";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { cn } from "@sophys-web/ui";
import { Button } from "@sophys-web/ui/button";
import { Checkbox } from "@sophys-web/ui/checkbox";
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/queue/item-edit-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { z } from "zod";
import { useCallback, useState } from "react";
import { PencilIcon } from "lucide-react";
import type { AnySchema } from "@sophys-web/widgets/lib/create-schema";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { api } from "@sophys-web/api-client/react";
import { Button } from "@sophys-web/ui/button";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/queue/queue-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { GripVerticalIcon, XIcon } from "lucide-react";
import { z } from "zod";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { cn } from "@sophys-web/ui";
import { Badge } from "@sophys-web/ui/badge";
import { Button } from "@sophys-web/ui/button";
Expand Down
3 changes: 1 addition & 2 deletions apps/spu-ui/src/app/_components/queue/queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
import { PlayIcon, SquareIcon, Trash2Icon } from "lucide-react";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useStatus } from "@sophys-web/api-client/hooks/use-status";
import { useQueue, useStatus } from "@sophys-web/api-client/hooks";
import { api } from "@sophys-web/api-client/react";
import { Button } from "@sophys-web/ui/button";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/queue/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CheckIcon, MoveRightIcon, UploadIcon } from "lucide-react";
import { useForm } from "react-hook-form";
import { z } from "zod";
import type { Session } from "@sophys-web/auth";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { api } from "@sophys-web/api-client/react";
import { cn } from "@sophys-web/ui";
import { Button } from "@sophys-web/ui/button";
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/run-engine-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Play,
Square,
} from "lucide-react";
import { useStatus } from "@sophys-web/api-client/hooks/use-status";
import { useStatus } from "@sophys-web/api-client/hooks";
import { api } from "@sophys-web/api-client/react";
import { Button } from "@sophys-web/ui/button";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/spu-ui/src/app/_components/sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useQueue } from "@sophys-web/api-client/hooks/use-queue";
import { useQueue } from "@sophys-web/api-client/hooks";
import { cn } from "@sophys-web/ui";
import { Button } from "@sophys-web/ui/button";
import {
Expand Down
13 changes: 13 additions & 0 deletions apps/spu-ui/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"]
},
"dev": {
"persistent": true
}
}
}
8 changes: 4 additions & 4 deletions packages/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"types": "./dist/src/env.d.ts",
"default": "./src/env.ts"
},
"./hooks/*": {
"types": "./dist/src/hooks/*.d.ts",
"default": "./src/hooks/*.ts"
"./hooks": {
"types": "./dist/src/hooks/index.d.ts",
"default": "./src/hooks/index.ts"
}
},
"license": "MIT",
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"dev": "tsc",
"clean": "rm -rf dist .turbo .cache node_modules",
"lint": "eslint src/",
"type-check": "tsc --noEmit --emitDeclarationOnly false"
Expand Down
2 changes: 2 additions & 0 deletions packages/api-client/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { useStatus } from "./use-status";
export { useQueue } from "./use-queue";
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"dev": "tsc",
"clean": "rm -rf .turbo .cache dist node_modules",
"lint": "eslint",
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build": "tailwindcss -i ./src/styles.css -o ./dist/index.css",
"clean": "rm -rf dist .turbo .cache node_modules",
"lint": "eslint src/",
"dev": "tailwindcss -i ./src/styles.css -o ./dist/index.css --watch",
"dev": "tailwindcss -i ./src/styles.css -o ./dist/index.css",
"type-check": "tsc --noEmit"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"clean": "rm -rf .next .turbo .cache node_modules",
"build": "tsc",
"dev": "tsc --watch",
"dev": "tsc",
"lint": "eslint src/",
"type-check": "tsc --noEmit"
},
Expand Down
8 changes: 1 addition & 7 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
},
"build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**",
".next/**",
"!.next/cache/**",
".cache/tsbuildinfo.json",
"dist/**"
]
"outputs": ["dist/**", ".cache/tsbuildinfo.json", "dist/**"]
},
"lint": {
"dependsOn": ["^topo", "^build"],
Expand Down

0 comments on commit 7ab169f

Please sign in to comment.