diff --git a/.gitignore b/.gitignore index 644f0800..bd675bcc 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ tmp/ qa-output .worktrees/ +.turbo diff --git a/app/test/setup.ts b/app/test/setup.ts index 85ec2b11..bdf10fd6 100644 --- a/app/test/setup.ts +++ b/app/test/setup.ts @@ -4,14 +4,19 @@ import path from "node:path"; import { cwd } from "node:process"; import { db } from "~/server/db/db"; -void mock.module("~/server/utils/logger", () => ({ - logger: { - debug: () => {}, - info: () => {}, - warn: () => {}, - error: () => {}, - }, -})); +import * as utils from "@zerobyte/core/utils"; + +void mock.module("@zerobyte/core/utils", () => { + return { + ...utils, + logger: { + debug: () => {}, + info: () => {}, + warn: () => {}, + error: () => {}, + }, + }; +}); void mock.module("~/server/utils/crypto", () => ({ cryptoUtils: { diff --git a/bun.lock b/bun.lock index e44f45b1..3668dc2d 100644 --- a/bun.lock +++ b/bun.lock @@ -100,6 +100,7 @@ "oxlint-tsgolint": "^0.16.0", "tailwindcss": "^4.2.1", "tinyglobby": "^0.2.15", + "turbo": "^2.8.16", "tw-animate-css": "^1.4.0", "typescript": "^5.9.3", "vite": "^7.3.1", @@ -1808,6 +1809,20 @@ "tsx": ["tsx@4.21.0", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="], + "turbo": ["turbo@2.8.16", "", { "optionalDependencies": { "turbo-darwin-64": "2.8.16", "turbo-darwin-arm64": "2.8.16", "turbo-linux-64": "2.8.16", "turbo-linux-arm64": "2.8.16", "turbo-windows-64": "2.8.16", "turbo-windows-arm64": "2.8.16" }, "bin": { "turbo": "bin/turbo" } }, "sha512-u6e9e3cTTpE2adQ1DYm3A3r8y3LAONEx1jYvJx6eIgSY4bMLxIxs0riWzI0Z/IK903ikiUzRPZ2c1Ph5lVLkhA=="], + + "turbo-darwin-64": ["turbo-darwin-64@2.8.16", "", { "os": "darwin", "cpu": "x64" }, "sha512-KWa4hUMWrpADC6Q/wIHRkBLw6X6MV9nx6X7hSXbTrrMz0KdaKhmfudUZ3sS76bJFmgArBU25cSc0AUyyrswYxg=="], + + "turbo-darwin-arm64": ["turbo-darwin-arm64@2.8.16", "", { "os": "darwin", "cpu": "arm64" }, "sha512-NBgaqBDLQSZlJR4D5XCkQq6noaO0RvIgwm5eYFJYL3bH5dNu8o0UBpq7C5DYnQI8+ybyoHFjT5/icN4LeUYLow=="], + + "turbo-linux-64": ["turbo-linux-64@2.8.16", "", { "os": "linux", "cpu": "x64" }, "sha512-VYPdcCRevI9kR/hr1H1xwXy7QQt/jNKiim1e1mjANBXD2E9VZWMkIL74J1Huad5MbU3/jw7voHOqDPLJPC2p6w=="], + + "turbo-linux-arm64": ["turbo-linux-arm64@2.8.16", "", { "os": "linux", "cpu": "arm64" }, "sha512-beq8tgUVI3uwkQkXJMiOr/hfxQRw54M3elpBwqgYFfemiK5LhCjjcwO0DkE8GZZfElBIlk+saMAQOZy3885wNQ=="], + + "turbo-windows-64": ["turbo-windows-64@2.8.16", "", { "os": "win32", "cpu": "x64" }, "sha512-Ig7b46iUgiOIkea/D3Z7H+zNzvzSnIJcLYFpZLA0RxbUTrbLhv9qIPwv3pT9p/abmu0LXVKHxaOo+p26SuDhzw=="], + + "turbo-windows-arm64": ["turbo-windows-arm64@2.8.16", "", { "os": "win32", "cpu": "arm64" }, "sha512-fOWjbEA2PiE2HEnFQrwNZKYEdjewyPc2no9GmrXklZnTCuMsxeCN39aVlKpKpim03Zq/ykIuvApGwq8ZbfS2Yw=="], + "tw-animate-css": ["tw-animate-css@1.4.0", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="], "type-fest": ["type-fest@5.4.4", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-JnTrzGu+zPV3aXIUhnyWJj4z/wigMsdYajGLIYakqyOW1nPllzXEJee0QQbHj+CTIQtXGlAjuK0UY+2xTyjVAw=="], diff --git a/package.json b/package.json index 864960dc..38d9b1ba 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "preview": "bunx --bun vite preview", "cli:dev": "bun run app/server/cli/main.ts", "cli": "ZEROBYTE_CLI=1 bun .output/server/_ssr/index.mjs", - "tsc": "tsc --noEmit", + "tsc": "tsc --noEmit && turbo run tsc", "start:dev": "docker compose down && docker compose up --build zerobyte-dev", "start:prod": "docker compose down && docker compose up --build zerobyte-prod", "start:e2e": "docker compose down && rm -rf playwright/data/* playwright/.auth/user.json playwright/restic.pass && mkdir -p playwright/temp && rm -rf playwright/temp/* && docker compose up --build zerobyte-e2e", @@ -24,7 +24,7 @@ "studio": "drizzle-kit studio", "test:server": "dotenv -e .env.test -- bun test app/server --preload ./app/test/setup.ts", "test:client": "dotenv -e .env.test -- bun test app/client --preload ./app/test/setup-client.ts", - "test": "bun run test:server && bun run test:client", + "test": "bun run test:server && bun run test:client && turbo run test", "test:e2e": "NODE_ENV=test dotenv -e .env.local -- playwright test", "test:e2e:ui": "NODE_ENV=test dotenv -e .env.local -- playwright test --ui", "test:codegen": "playwright codegen localhost:4096" @@ -126,6 +126,7 @@ "oxlint-tsgolint": "^0.16.0", "tailwindcss": "^4.2.1", "tinyglobby": "^0.2.15", + "turbo": "^2.8.16", "tw-animate-css": "^1.4.0", "typescript": "^5.9.3", "vite": "^7.3.1", diff --git a/packages/core/index.ts b/packages/core/index.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/core/package.json b/packages/core/package.json index c3498201..f92fbbc0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,8 +2,6 @@ "name": "@zerobyte/core", "private": true, "type": "module", - "main": "index.ts", - "module": "index.ts", "exports": { "./restic": { "types": "./src/restic/index.ts", @@ -16,6 +14,10 @@ "default": "./src/utils/index.ts" } }, + "scripts": { + "tsc": "tsc --noEmit", + "test": "bun test --preload ./test/setup.ts" + }, "devDependencies": { "@types/bun": "latest" }, diff --git a/packages/core/test/setup.ts b/packages/core/test/setup.ts new file mode 100644 index 00000000..99dd0829 --- /dev/null +++ b/packages/core/test/setup.ts @@ -0,0 +1,10 @@ +import { mock } from "bun:test"; + +void mock.module("../src/utils/logger.ts", () => ({ + logger: { + debug: () => {}, + info: () => {}, + warn: () => {}, + error: () => {}, + }, +})); diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..40b588dc --- /dev/null +++ b/turbo.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://turborepo.dev/schema.json", + "tasks": { + "build": { + "outputs": ["dist/**"] + }, + "tsc": { + "dependsOn": ["^tsc"] + }, + "test": { + "dependsOn": ["^test"] + }, + "dev": { + "persistent": true, + "cache": false + } + } +}