diff --git a/apps/api/turbo.json b/apps/api/turbo.json index fe9b1a200..8e5097806 100644 --- a/apps/api/turbo.json +++ b/apps/api/turbo.json @@ -5,12 +5,7 @@ "build": { "dependsOn": ["@buster/database#build"], "outputs": ["target/release/**"], - "inputs": [ - "server/**/*", - "libs/**/*", - "Cargo.toml", - "Cargo.lock" - ] + "inputs": ["server/**/*", "libs/**/*", "Cargo.toml", "Cargo.lock"] }, "start": { "dependsOn": ["@buster/database#start", "build"], diff --git a/apps/momentic/biome.json b/apps/momentic/biome.json index e0ac3c56f..fc17470e0 100644 --- a/apps/momentic/biome.json +++ b/apps/momentic/biome.json @@ -1,7 +1,7 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["../../biome.json"], + "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", + "extends": ["../../biome2.json"], "files": { - "include": ["src/**/*", "scripts/**/*"] + "includes": ["src/**/*", "scripts/**/*"] } } diff --git a/apps/momentic/package.json b/apps/momentic/package.json index 5ad328fc8..ac1a45fb8 100644 --- a/apps/momentic/package.json +++ b/apps/momentic/package.json @@ -26,7 +26,7 @@ "zod": "catalog:" }, "devDependencies": { - "momentic": "^2.16.0", + "momentic": "^2.17.3", "tsx": "catalog:" } -} \ No newline at end of file +} diff --git a/apps/momentic/turbo.json b/apps/momentic/turbo.json new file mode 100644 index 000000000..49ad7f936 --- /dev/null +++ b/apps/momentic/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "momentic": { + "cache": false, + "persistent": true + } + } +} \ No newline at end of file diff --git a/apps/trigger/src/tasks/analyst-agent-task/analyst-agent-task.ts b/apps/trigger/src/tasks/analyst-agent-task/analyst-agent-task.ts index f74bdc6aa..76e821fc7 100644 --- a/apps/trigger/src/tasks/analyst-agent-task/analyst-agent-task.ts +++ b/apps/trigger/src/tasks/analyst-agent-task/analyst-agent-task.ts @@ -357,7 +357,7 @@ export const analystAgentTask: ReturnType< dataSourceId: dataSource.dataSourceId, dataSourceSyntax: dataSource.dataSourceSyntax, datasetsCount: datasets.length, - datasets: datasets.map((d) => ({ + datasets: datasets.map((d: PermissionedDataset) => ({ id: d.id, name: d.name, })), diff --git a/apps/trigger/turbo.json b/apps/trigger/turbo.json index d8feee7c2..ef70b40d6 100644 --- a/apps/trigger/turbo.json +++ b/apps/trigger/turbo.json @@ -9,7 +9,7 @@ "start": { "cache": false, "persistent": true, - "dependsOn": ["^build"], + "dependsOn": ["^build", "@buster-app/supabase#start"], "with": ["@buster-app/supabase#start"] }, "dev": { diff --git a/apps/web/.storybook/main.ts b/apps/web/.storybook/main.ts index 9fd050e9b..9f5753836 100644 --- a/apps/web/.storybook/main.ts +++ b/apps/web/.storybook/main.ts @@ -1,28 +1,25 @@ import type { StorybookConfig } from '@storybook/react-vite'; -import { join, dirname } from "path" +import { dirname, join } from 'path'; /** -* This function is used to resolve the absolute path of a package. -* It is needed in projects that use Yarn PnP or are set up within a monorepo. -*/ + * This function is used to resolve the absolute path of a package. + * It is needed in projects that use Yarn PnP or are set up within a monorepo. + */ function getAbsolutePath(value: string): any { - return dirname(require.resolve(join(value, 'package.json'))) + return dirname(require.resolve(join(value, 'package.json'))); } const config: StorybookConfig = { - "stories": [ - "../src/**/*.mdx", - "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)" - ], - "addons": [ + stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], + addons: [ getAbsolutePath('@chromatic-com/storybook'), getAbsolutePath('@storybook/addon-docs'), - getAbsolutePath("@storybook/addon-a11y"), - getAbsolutePath("@storybook/addon-vitest") + getAbsolutePath('@storybook/addon-a11y'), + getAbsolutePath('@storybook/addon-vitest'), ], - "framework": { - "name": getAbsolutePath('@storybook/react-vite'), - "options": {} - } + framework: { + name: getAbsolutePath('@storybook/react-vite'), + options: {}, + }, }; -export default config; \ No newline at end of file +export default config; diff --git a/apps/web/.storybook/preview.tsx b/apps/web/.storybook/preview.tsx index cb9454e47..934b34fa4 100644 --- a/apps/web/.storybook/preview.tsx +++ b/apps/web/.storybook/preview.tsx @@ -1,6 +1,6 @@ -import type { Preview } from "@storybook/react-vite"; -import "../src/styles/styles.css"; -import { BusterStyleProvider } from "../src/context/BusterStyles"; +import type { Preview } from '@storybook/react-vite'; +import '../src/styles/styles.css'; +import { BusterStyleProvider } from '../src/context/BusterStyles'; const preview: Preview = { parameters: { diff --git a/apps/web/.storybook/vitest.setup.ts b/apps/web/.storybook/vitest.setup.ts index 44922d55e..ea170b046 100644 --- a/apps/web/.storybook/vitest.setup.ts +++ b/apps/web/.storybook/vitest.setup.ts @@ -1,7 +1,7 @@ -import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview"; +import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview'; import { setProjectAnnotations } from '@storybook/react-vite'; import * as projectAnnotations from './preview'; // This is an important step to apply the right configuration when testing your stories. // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations -setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]); \ No newline at end of file +setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]); diff --git a/apps/web/BROWSER_CACHING_FIX.md b/apps/web/BROWSER_CACHING_FIX.md deleted file mode 100644 index ec03e5c31..000000000 --- a/apps/web/BROWSER_CACHING_FIX.md +++ /dev/null @@ -1,118 +0,0 @@ -# Browser Redirect Caching Issue - Fix Documentation - -## โœ… The Real Problem: Browser Caching - -Your issue wasn't with Cloudflare Workers or SSR - it was **browser caching of redirects**! - -### Evidence: -- โœ… **Incognito mode works perfectly** (no cache) -- โŒ **Regular browser fails** (has cached redirects) -- โŒ **After deployment, old cached redirects persist** - -## ๐Ÿ” Root Cause - -1. **301 (Permanent) redirects are cached aggressively** by browsers -2. Browsers remember these redirects **even after deployments** -3. The cached redirects were causing the loading issues - -## โœ… Solutions Applied - -### 1. Changed All Status Codes from 301 to 307 -**Why 307?** -- **301**: Permanent redirect (heavily cached) -- **302**: Temporary redirect (sometimes cached) -- **307**: Temporary redirect (NEVER cached) - -**Files Updated:** -- `/src/routes/app/index.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app.tsx` - Changed 302 โ†’ 307 -- `/src/routes/auth.logout.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_settings/settings.index.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_app/datasets.$datasetId.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_app/datasets.$datasetId.permissions.index.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_settings/_permissions/settings.dataset-groups.$datasetGroupId.index.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_settings/_restricted_layout/_admin_only.tsx` - Changed 301 โ†’ 307 -- `/src/routes/app/_settings/_permissions.tsx` - Changed 301 โ†’ 307 - -### 2. Added Cache Control Headers -Modified `/src/middleware/global-security.ts` to add no-cache headers for redirect routes: -```typescript -if (isRedirectRoute) { - headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'; - headers['Pragma'] = 'no-cache'; - headers['Expires'] = '0'; -} -``` - -### 3. Meta Refresh with Cache Prevention -Updated `/src/routes/index.tsx` with cache prevention meta tags: -```typescript -meta: [ - { 'http-equiv': 'refresh', content: '0; url=/app/home' }, - { 'http-equiv': 'Cache-Control', content: 'no-cache, no-store, must-revalidate' }, - { 'http-equiv': 'Pragma', content: 'no-cache' }, - { 'http-equiv': 'Expires', content: '0' }, -] -``` - -## ๐Ÿงน Clear Your Browser Cache - -**For existing users who might have cached 301 redirects:** - -### Chrome/Edge: -1. Open DevTools (F12) -2. Right-click the refresh button -3. Select "Empty Cache and Hard Reload" - -### Or Clear Specific Site Data: -1. Open DevTools โ†’ Application tab -2. Storage โ†’ Clear storage -3. Click "Clear site data" - -### Firefox: -1. Ctrl+Shift+Delete -2. Select "Cache" only -3. Clear for "Last hour" - -## ๐Ÿ“Š Status Code Reference - -| Code | Type | Cached? | Use Case | -|------|------|---------|----------| -| 301 | Permanent | โœ… Aggressively | Never for app redirects! | -| 302 | Temporary | โš ๏ธ Sometimes | Legacy, avoid | -| 303 | See Other | โŒ No | POST โ†’ GET redirect | -| 307 | Temporary | โŒ No | โœ… Best for app redirects | -| 308 | Permanent | โœ… Yes | Like 301 but preserves method | - -## ๐Ÿš€ Testing - -1. **Clear browser cache first** (important!) -2. **Build and deploy:** - ```bash - npm run build - npx wrangler deploy --env staging - ``` - -3. **Test scenarios:** - - Visit `/` โ†’ Should redirect to `/app/home` - - Visit `/app/` โ†’ Should redirect to `/app/home` - - Log out โ†’ Should redirect to `/auth/login` - - All should work on first visit (cold start) - -## ๐ŸŽฏ Key Takeaways - -1. **Never use 301 for application redirects** - they're meant for permanent URL changes -2. **Use 307 for temporary redirects** that shouldn't be cached -3. **Browser caching can persist across deployments** and cause mysterious issues -4. **Incognito mode is your friend** for testing caching issues - -## ๐Ÿ”ฎ Future Recommendations - -1. **Consider server-side redirects** in Cloudflare configuration for static redirects -2. **Monitor with Chrome DevTools Network tab** - check "Disable cache" when debugging -3. **Use `wrangler tail` to see if requests are even hitting your worker** - -## Related Issues -- [MDN: HTTP redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages) -- [Chrome: Clear cache for specific site](https://support.google.com/chrome/answer/2392709) -- [Cloudflare: Page Rules for redirects](https://developers.cloudflare.com/rules/page-rules/) diff --git a/apps/web/biome.json b/apps/web/biome.json index 917952d26..68ce8edcb 100644 --- a/apps/web/biome.json +++ b/apps/web/biome.json @@ -1,21 +1,8 @@ { "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", + "extends": ["../../biome2.json"], "files": { - "ignoreUnknown": false, - "includes": [ - "src/**/*", - ".vscode/**/*", - "index.html", - "vite.config.ts", - "vitest.config.ts", - "vitest.setup.ts", - "!src/routeTree.gen.ts", - "!**/node_modules", - "!**/dist", - "!**/build", - "!**/coverage", - "!**/.next" - ] + "includes": ["!**/routeTree.gen.ts", "!.vercel", "!.nitro", "!.storybook"] }, "linter": { "enabled": true, @@ -63,56 +50,11 @@ } }, "overrides": [ - { - "includes": ["**/*.test.ts", "**/*.test.tsx", "**/*.stories.tsx"], - "linter": { - "rules": { - "suspicious": { - "noExplicitAny": "off" - }, - "style": { - "noNonNullAssertion": "off" - }, - "correctness": { - "noUnusedFunctionParameters": "off", - "noUnusedVariables": "off" - } - } - } - }, { "includes": ["**/*.stories.tsx"], "linter": { "enabled": false } - }, - { - "includes": ["**/*.css"], - "linter": { - "enabled": false - } } - ], - "formatter": { - "enabled": true, - "formatWithErrors": false, - "indentStyle": "space", - "indentWidth": 2, - "lineWidth": 100, - "lineEnding": "lf" - }, - "javascript": { - "formatter": { - "quoteStyle": "single", - "jsxQuoteStyle": "double", - "trailingCommas": "es5", - "semicolons": "always", - "arrowParentheses": "always" - } - }, - "css": { - "parser": { - "cssModules": true - } - } + ] } diff --git a/apps/web/nitro.config.js b/apps/web/nitro.config.js index 3380a41f8..ff428fb01 100644 --- a/apps/web/nitro.config.js +++ b/apps/web/nitro.config.js @@ -1,30 +1,24 @@ // Configuration for warning suppressions - easily extensible const WARNING_SUPPRESSIONS = { MODULE_LEVEL_DIRECTIVE: { - patterns: ["node_modules/"], + patterns: ['node_modules/'], reason: "Suppress 'use client' directive warnings from dependencies", }, THIS_IS_UNDEFINED: { - patterns: ["node_modules/"], + patterns: ['node_modules/'], reason: "Suppress 'this' keyword warnings in ES modules from dependencies", }, CIRCULAR_DEPENDENCY: { - patterns: [ - "nitropack/dist/runtime/internal/", - "@tanstack/store/dist", - "juice/lib/", - ], - reason: "Suppress known third-party circular dependency warnings", + patterns: ['nitropack/dist/runtime/internal/', '@tanstack/store/dist', 'juice/lib/'], + reason: 'Suppress known third-party circular dependency warnings', }, }; // Additional message-based suppressions -const MESSAGE_SUPPRESSIONS = [ - "The 'this' keyword is equivalent to 'undefined'", -]; +const MESSAGE_SUPPRESSIONS = ["The 'this' keyword is equivalent to 'undefined'"]; function shouldSuppressWarning(warning) { - const message = warning.message || ""; + const message = warning.message || ''; // Check code-based suppressions const suppression = WARNING_SUPPRESSIONS[warning.code]; @@ -33,9 +27,7 @@ function shouldSuppressWarning(warning) { } // Check message-based suppressions - return MESSAGE_SUPPRESSIONS.some((suppressionMessage) => - message.includes(suppressionMessage) - ); + return MESSAGE_SUPPRESSIONS.some((suppressionMessage) => message.includes(suppressionMessage)); } export default { diff --git a/apps/web/scripts/validate-env.ts b/apps/web/scripts/validate-env.ts index 11fc06a43..1815bba26 100644 --- a/apps/web/scripts/validate-env.ts +++ b/apps/web/scripts/validate-env.ts @@ -14,7 +14,12 @@ const requiredEnv = { }; // Validate environment variables -const { hasErrors } = validateEnv(requiredEnv, { skipInProduction: false, skipInCI: false, skipInDocker: false, logPublicVars: true }); +const { hasErrors } = validateEnv(requiredEnv, { + skipInProduction: false, + skipInCI: false, + skipInDocker: false, + logPublicVars: true, +}); if (hasErrors) { process.exit(1); diff --git a/apps/web/src/components/features/auth/useAuthMutations.ts b/apps/web/src/components/features/auth/useAuthMutations.ts index 7a545dc31..1ae4b73aa 100644 --- a/apps/web/src/components/features/auth/useAuthMutations.ts +++ b/apps/web/src/components/features/auth/useAuthMutations.ts @@ -19,14 +19,23 @@ export const useOAuthMutation = ( setLastUsedMethod: (method: SignInTypes) => void ) => { return useMutation({ - mutationFn, + mutationFn: async () => { + const result = await mutationFn(); + if (!result.success) { + throw new Error(result.error || `${type} authentication failed`); + } + return result; + }, onSuccess: (data) => { if (data.success && data.url) { setLastUsedMethod(type); window.location.href = data.url; } }, - throwOnError: true, + retry: false, + onError: (error) => { + console.error(error); + }, }); }; @@ -85,34 +94,43 @@ export const useAuthMutations = (redirectTo?: string | null, onSignUpSuccess?: ( // Email/Password Mutations const emailSignInMutation = useMutation({ - mutationFn: ({ email, password }: { email: string; password: string }) => - signInWithEmailAndPassword({ data: { email, password, redirectUrl: redirectTo } }), - onSuccess: async (data) => { - if (!data.error) { - setLastUsedMethod('email'); - await navigate({ to: redirectTo || '/app/home' }); - } - if (data.error) { - throw new Error(data.message); + mutationFn: async ({ email, password }: { email: string; password: string }) => { + const result = await signInWithEmailAndPassword({ + data: { email, password, redirectUrl: redirectTo }, + }); + if (result.error) { + throw new Error(result.message); } + return result; + }, + onSuccess: async () => { + setLastUsedMethod('email'); + await navigate({ to: redirectTo || '/app/home' }); + }, + retry: false, + onError: (error) => { + console.error(error); }, - throwOnError: true, }); const emailSignUpMutation = useMutation({ - mutationFn: ({ email, password }: { email: string; password: string }) => - signUpWithEmailAndPassword({ data: { email, password, redirectTo } }), - onSuccess: (data) => { - if (data.error) { - throw new Error(data.error); + mutationFn: async ({ email, password }: { email: string; password: string }) => { + const result = await signUpWithEmailAndPassword({ data: { email, password, redirectTo } }); + if (!result.success) { + throw new Error(result.error || 'Sign up failed'); } - if (data.success) { - setLastUsedMethod('email'); - if (onSignUpSuccess) { - onSignUpSuccess(); - } + return result; + }, + onSuccess: () => { + setLastUsedMethod('email'); + if (onSignUpSuccess) { + onSignUpSuccess(); } }, + retry: false, + onError: (error) => { + console.error(error); + }, }); // Combined state diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 07a06e7cc..3653f4f7c 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -25,8 +25,5 @@ "@/*": ["./src/*"] } }, - "references": [ - { "path": "../../packages/server-shared" }, - { "path": "./tsconfig.node.json" } - ] + "references": [{ "path": "../../packages/server-shared" }, { "path": "./tsconfig.node.json" }] } diff --git a/apps/web/tsconfig.node.json b/apps/web/tsconfig.node.json index e0f97a9e4..f3e54736d 100644 --- a/apps/web/tsconfig.node.json +++ b/apps/web/tsconfig.node.json @@ -7,11 +7,5 @@ "types": ["node", "vite/client"], "skipLibCheck": true }, - "include": [ - "vite.config.ts", - "vitest.config.ts", - "vitest.setup.ts" - ] + "include": ["vite.config.ts", "vitest.config.ts", "vitest.setup.ts"] } - - diff --git a/apps/web/turbo.json b/apps/web/turbo.json index f0e2222b2..74d73043c 100644 --- a/apps/web/turbo.json +++ b/apps/web/turbo.json @@ -1,114 +1,79 @@ { - "$schema": "https://turbo.build/schema.json", - "extends": ["//"], - "tasks": { - "build": { - "dependsOn": ["^build", "@buster/server-shared#build"], - "inputs": [ - "src/**/*", - "!src/**/*.test.{ts,tsx,js,jsx}", - "!src/**/*.spec.{ts,tsx,js,jsx}", - "public/**/*", - "next.config.mjs", - "tailwind.config.ts", - "tsconfig.json", - "package.json" - ], - "outputs": [ - ".output/server/index.mjs", - ".output/server/chunks/**", - ".output/public/assets/**/*.js", - ".output/public/assets/**/*.css", - ".output/public/favicon.ico", - ".output/public/manifest.json", - ".vercel/**", - "!.output/**/*.map", - "!.output/**/*.map.js", - "!.output/server/node_modules/**", - "!.output/public/assets/**/*.png", - "!.output/public/assets/**/*.jpg", - "!.output/public/assets/**/*.jpeg", - "!.output/public/assets/**/*.gif", - "!.output/public/assets/**/*.svg", - "!.output/**/*.test.*", - "!.output/**/*.spec.*" - ] - }, - "build:vercel": { - "dependsOn": ["^build:vercel", "@buster/server-shared#build"], - "inputs": [ - "src/**/*", - "!src/**/*.test.{ts,tsx,js,jsx}", - "!src/**/*.spec.{ts,tsx,js,jsx}", - "public/**/*", - "next.config.mjs", - "tailwind.config.ts", - "tsconfig.json", - "package.json" - ], - "outputs": [ - ".output/server/index.mjs", - ".output/server/chunks/**", - ".output/public/assets/**/*.js", - ".output/public/assets/**/*.css", - ".output/public/favicon.ico", - ".output/public/manifest.json", - ".vercel/**", - "!.output/**/*.map", - "!.output/**/*.map.js", - "!.output/server/node_modules/**", - "!.output/public/assets/**/*.png", - "!.output/public/assets/**/*.jpg", - "!.output/public/assets/**/*.jpeg", - "!.output/public/assets/**/*.gif", - "!.output/public/assets/**/*.svg", - "!.output/**/*.test.*", - "!.output/**/*.spec.*" - ] - }, - "start": { - "dependsOn": ["build"], - "cache": true, - "persistent": true - }, - "test": { - "inputs": [ - "src/**/*", - "**/*.test.{ts,tsx,js,jsx}", - "**/*.spec.{ts,tsx,js,jsx}", - "playwright-tests/**/*", - "vitest.config.ts", - "package.json" - ] - }, - "dev": { - "dependsOn": ["@buster/server-shared#build"], - "cache": false, - "persistent": true, - "inputs": [ - "src/**/*", - "!src/**/*.test.{ts,tsx,js,jsx}", - "!src/**/*.spec.{ts,tsx,js,jsx}", - "next.config.mjs", - "tailwind.config.ts", - "tsconfig.json", - "package.json" - ] - }, - "dev:fast": { - "dependsOn": ["@buster/server-shared#build"], - "cache": false, - "persistent": true, - "inputs": [ - "src/**/*", - "!src/**/*.test.{ts,tsx,js,jsx}", - "!src/**/*.spec.{ts,tsx,js,jsx}", - "next.config.mjs", - "tailwind.config.ts", - "tsconfig.json", - "package.json" - ] - } + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build", "@buster/server-shared#build"], + "inputs": [ + "src/**/*", + "public/**/*", + "tsconfig.json", + "package.json", + "vite.config.ts", + "nitro.config.ts", + "!src/**/*.test.{ts,tsx,js,jsx}", + "!src/**/*.spec.{ts,tsx,js,jsx}", + "!src/**/*.stories.{ts,tsx,js,jsx}" + ], + "outputs": [".output/**", ".vercel/**"] + }, + "build:vercel": { + "dependsOn": ["^build:vercel", "@buster/server-shared#build"], + "inputs": [ + "src/**/*", + "!src/**/*.test.{ts,tsx,js,jsx}", + "!src/**/*.spec.{ts,tsx,js,jsx}", + "public/**/*", + "next.config.mjs", + "tailwind.config.ts", + "tsconfig.json", + "package.json" + ], + "outputs": [".output/**", ".vercel/**"] + }, + "start": { + "dependsOn": ["build", "@buster-app/supabase#start"], + "cache": true, + "persistent": true, + "with": ["@buster-app/server#start", "@buster-app/api-legacy#start"] + }, + "test": { + "inputs": [ + "src/**/*", + "**/*.test.{ts,tsx,js,jsx}", + "**/*.spec.{ts,tsx,js,jsx}", + "playwright-tests/**/*", + "vitest.config.ts", + "package.json" + ] + }, + "dev": { + "dependsOn": ["@buster/server-shared#build"], + "cache": false, + "persistent": true, + "inputs": [ + "src/**/*", + "!src/**/*.test.{ts,tsx,js,jsx}", + "!src/**/*.spec.{ts,tsx,js,jsx}", + "next.config.mjs", + "tailwind.config.ts", + "tsconfig.json", + "package.json" + ] + }, + "dev:fast": { + "dependsOn": ["@buster/server-shared#build"], + "cache": false, + "persistent": true, + "inputs": [ + "src/**/*", + "!src/**/*.test.{ts,tsx,js,jsx}", + "!src/**/*.spec.{ts,tsx,js,jsx}", + "next.config.mjs", + "tailwind.config.ts", + "tsconfig.json", + "package.json" + ] } } - \ No newline at end of file +} diff --git a/biome.json b/biome.json index a66cc27e3..253f60d41 100644 --- a/biome.json +++ b/biome.json @@ -93,7 +93,8 @@ "vitest.config.ts", "biome.json", "./package.json", - "./turbo.json" + "./turbo.json", + "./biome2.json" ], "ignore": [ "**/node_modules/**", diff --git a/biome2.json b/biome2.json new file mode 100644 index 000000000..b1444f57e --- /dev/null +++ b/biome2.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", + "files": { + "ignoreUnknown": false, + "includes": [ + ".vscode/**/*", + "**/.html", + "**/*.json", + "**/*.ts", + "**/*.tsx", + "**/*.js", + "**/*.jsx", + "**/*.css", + "**/*.mjs", + "**/*.cjs", + "!**/node_modules", + "!**/dist", + "!**/build", + "!**/coverage", + "!**/.output", + "!apps/api", + "!apps/supabase" + ] + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "correctness": { + "noUnusedVariables": "error", + "noUnusedImports": "off", + "useExhaustiveDependencies": "off" + }, + "style": { + "noNonNullAssertion": "error", + "useImportType": "warn", + "useNodejsImportProtocol": "error", + "useConsistentArrayType": "error", + "noUnusedTemplateLiteral": "off" + }, + "suspicious": { + "noExplicitAny": "error", + "noConsole": "warn", + "noTemplateCurlyInString": "off" + }, + "complexity": { + "noExcessiveCognitiveComplexity": "off", + "noForEach": "off" + }, + "nursery": { + "useSortedClasses": "off" + }, + "performance": { + "noDelete": "error" + } + } + }, + "overrides": [ + { + "includes": [ + "**/*.test.ts", + "**/*.test.tsx", + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.stories.tsx", + "**/*.setup.*", + "**/*.js" + ], + "linter": { + "rules": { + "suspicious": { + "noExplicitAny": "off", + "noConsole": "off" + }, + "style": { + "noNonNullAssertion": "off" + }, + "correctness": { + "noUnusedFunctionParameters": "off", + "noUnusedVariables": "off" + } + } + } + }, + { + "includes": ["**/*.css"], + "linter": { + "enabled": false + } + } + ], + "formatter": { + "enabled": true, + "formatWithErrors": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 100, + "lineEnding": "lf" + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "jsxQuoteStyle": "double", + "trailingCommas": "es5", + "semicolons": "always", + "arrowParentheses": "always" + } + }, + "json": { + "formatter": { + "enabled": true + } + }, + "css": { + "parser": { + "cssModules": true + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 100 + } + } +} diff --git a/package.json b/package.json index 1e87ef9e9..70f8d9934 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,10 @@ "packageManager": "pnpm@10.17.1", "pnpm": { "peerDependencyRules": { - "ignoreMissing": [ - "shiki" - ], + "ignoreMissing": ["shiki"], "allowedVersions": { "shiki": "3" } } } -} \ No newline at end of file +} diff --git a/packages/access-controls/package.json b/packages/access-controls/package.json index 2cf1bc9ad..232bc84f4 100644 --- a/packages/access-controls/package.json +++ b/packages/access-controls/package.json @@ -16,8 +16,6 @@ "prebuild": "[ \"$SKIP_ENV_CHECK\" = \"true\" ] || tsx scripts/validate-env.ts", "build": "tsc", "build:dry-run": "tsc", - "build:commonjs": "tsc --module commonjs --moduleResolution node", - "build:commonjs:watch": "npm run build:commonjs && tsc --module commonjs --moduleResolution node --watch", "dev": "tsc --watch", "dev:fast": "tsc --watch", "lint": "biome check --write", diff --git a/packages/access-controls/turbo.json b/packages/access-controls/turbo.json index 698cd89aa..ac546cd8f 100644 --- a/packages/access-controls/turbo.json +++ b/packages/access-controls/turbo.json @@ -2,17 +2,10 @@ "$schema": "https://turborepo.com/schema.json", "extends": ["//"], "tasks": { - "build:commonjs": { - "cache": false, - "persistent": false, - "dependsOn": ["@buster/database#build:commonjs"], + "build": { + "dependsOn": ["^build"], "outputs": ["dist/**"] }, - "build:commonjs:watch": { - "cache": false, - "persistent": true, - "dependsOn": ["build:commonjs"] - }, "dev": { "cache": false, "persistent": true, diff --git a/packages/ai/turbo.json b/packages/ai/turbo.json index 27a9a15e4..02e0e142e 100644 --- a/packages/ai/turbo.json +++ b/packages/ai/turbo.json @@ -2,21 +2,9 @@ "$schema": "https://turbo.build/schema.json", "extends": ["//"], "tasks": { - "dev:mastra": { - "cache": false, - "persistent": true, - "dependsOn": [ - "@buster/database#build:commonjs", - "@buster/access-controls#build:commonjs", - "@buster/data-source#build:commonjs", - "@buster/search#build:commonjs" - ], - "with": [ - "@buster/database#build:commonjs:watch", - "@buster/access-controls#build:commonjs:watch", - "@buster/data-source#build:commonjs:watch", - "@buster/search#build:commonjs:watch" - ] + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] }, "dev": { "cache": false, diff --git a/packages/data-source/package.json b/packages/data-source/package.json index 46de8951b..c84b8f6ac 100644 --- a/packages/data-source/package.json +++ b/packages/data-source/package.json @@ -16,8 +16,6 @@ "prebuild": "[ \"$SKIP_ENV_CHECK\" = \"true\" ] || tsx scripts/validate-env.ts", "build": "tsc", "build:dry-run": "tsc", - "build:commonjs": "tsc --module commonjs --moduleResolution node", - "build:commonjs:watch": "npm run build:commonjs && tsc --module commonjs --moduleResolution node --watch", "lint": "biome check --write", "lint:fix": "biome check --write", "test": "vitest run", diff --git a/packages/data-source/turbo.json b/packages/data-source/turbo.json index 290ae3804..2df76fd40 100644 --- a/packages/data-source/turbo.json +++ b/packages/data-source/turbo.json @@ -2,15 +2,9 @@ "$schema": "https://turborepo.com/schema.json", "extends": ["//"], "tasks": { - "build:commonjs": { - "cache": false, - "persistent": false, + "build": { + "dependsOn": ["^build"], "outputs": ["dist/**"] - }, - "build:commonjs:watch": { - "cache": false, - "persistent": true, - "dependsOn": ["build:commonjs"] } } } diff --git a/packages/env-utils/src/index.ts b/packages/env-utils/src/index.ts index f242675ac..6a0807c22 100644 --- a/packages/env-utils/src/index.ts +++ b/packages/env-utils/src/index.ts @@ -7,16 +7,19 @@ import { config } from 'dotenv'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -// Find the root of the monorepo (where turbo.json is) +// Find the root of the monorepo (where turbo.json and pnpm-workspace.yaml are) function findMonorepoRoot(): string { let currentDir = __dirname; while (currentDir !== '/') { - if (existsSync(path.join(currentDir, 'turbo.json'))) { + const turboPath = path.join(currentDir, 'turbo.json'); + const pnpmWorkspacePath = path.join(currentDir, 'pnpm-workspace.yaml'); + // Look for both turbo.json AND pnpm-workspace.yaml to ensure we find the actual root + if (existsSync(turboPath) && existsSync(pnpmWorkspacePath)) { return currentDir; } currentDir = path.dirname(currentDir); } - throw new Error('Could not find monorepo root (turbo.json)'); + throw new Error('Could not find monorepo root (turbo.json + pnpm-workspace.yaml)'); } // Load environment variables from root .env file diff --git a/packages/env-utils/turbo.json b/packages/env-utils/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/env-utils/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/github/turbo.json b/packages/github/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/github/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/sandbox/turbo.json b/packages/sandbox/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/sandbox/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/sdk/turbo.json b/packages/sdk/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/sdk/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/search/turbo.json b/packages/search/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/search/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/slack/turbo.json b/packages/slack/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/slack/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/test-utils/turbo.json b/packages/test-utils/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/test-utils/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/packages/web-tools/turbo.json b/packages/web-tools/turbo.json new file mode 100644 index 000000000..291722822 --- /dev/null +++ b/packages/web-tools/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + } + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 739e9b16f..b7c39e462 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,8 +232,8 @@ importers: version: 3.25.76 devDependencies: momentic: - specifier: ^2.16.0 - version: 2.16.0(@types/node@24.3.1) + specifier: ^2.17.3 + version: 2.17.3(@types/node@24.3.1) tsx: specifier: 'catalog:' version: 4.20.5 @@ -9969,8 +9969,8 @@ packages: moment@2.30.1: resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} - momentic@2.16.0: - resolution: {integrity: sha512-HxaPDj5B7c5+BTE/gbun5SqCGjnPfAjcjbvrzi3LQP9qCnEntI/IKddN38D613+aPe8Rif1ZAq5pjtMRNWrGcQ==} + momentic@2.17.3: + resolution: {integrity: sha512-PiAcdojIpywPU0gOR9MApgRsqxY3VgmLMpimJubkVNslFI+re9DBFI/9avdAIKdezZBCRgtx1dgVGDmKmSBx+g==} engines: {node: '>=20'} hasBin: true @@ -23554,7 +23554,7 @@ snapshots: moment@2.30.1: {} - momentic@2.16.0(@types/node@24.3.1): + momentic@2.17.3(@types/node@24.3.1): dependencies: '@actions/exec': 1.1.1 '@actions/io': 1.1.3 diff --git a/turbo.json b/turbo.json index 286f38afd..113e0ac5f 100644 --- a/turbo.json +++ b/turbo.json @@ -4,104 +4,34 @@ "concurrency": "20", "tasks": { "build": { - "dependsOn": [ - "^build" - ], - "outputs": [ - "dist/**/*.js", - "dist/**/*.mjs", - "dist/**/*.cjs", - "dist/**/*.d.ts", - "dist/**/*.d.mts", - "dist/**/*.d.cts", - "dist/**/*.json", - "dist/**/*.txt", - ".next/**", - "!dist/**/*.map", - "!dist/**/*.js.map", - "!dist/**/*.mjs.map", - "!dist/**/*.cjs.map", - "!dist/**/*.d.ts.map", - "!.next/**/*.map", - "!dist/**/*.test.*", - "!dist/**/*.spec.*", - "!dist/**/*.stories.*", - "!dist/**/test/**", - "!dist/**/__tests__/**", - "!dist/**/__mocks__/**", - "!dist/**/*.md", - "!dist/**/node_modules/**" - ] + "dependsOn": ["^build"] }, "build:dry-run": { - "dependsOn": [ - "^build:dry-run" - ], - "outputs": [ - "dist/**/*.js", - "dist/**/*.mjs", - "dist/**/*.cjs", - "dist/**/*.d.ts", - "dist/**/*.d.mts", - "dist/**/*.d.cts", - "dist/**/*.json", - "dist/**/*.txt", - ".next/**", - "!dist/**/*.map", - "!dist/**/*.js.map", - "!dist/**/*.mjs.map", - "!dist/**/*.cjs.map", - "!dist/**/*.d.ts.map", - "!.next/**/*.map", - "!dist/**/*.test.*", - "!dist/**/*.spec.*", - "!dist/**/*.stories.*", - "!dist/**/test/**", - "!dist/**/__tests__/**", - "!dist/**/__mocks__/**", - "!dist/**/*.md", - "!dist/**/node_modules/**" - ], - "env": [ - "SKIP_ENV_CHECK" - ] + "dependsOn": ["^build:dry-run"], + "env": ["SKIP_ENV_CHECK"] }, "dev": { "cache": false, "persistent": true }, - "momentic": { - "cache": false, - "persistent": true - }, "dev:fast": { "cache": false, "persistent": true }, "lint": { - "dependsOn": [ - "^lint" - ] + "dependsOn": ["^lint"] }, "typecheck": { - "dependsOn": [ - "^build" - ] + "dependsOn": ["^build"] }, "test": { - "dependsOn": [ - "^build" - ] + "dependsOn": ["^build"] }, "test:unit": { - "dependsOn": [ - "^test:unit" - ] + "dependsOn": ["^test:unit"] }, "test:integration": { - "dependsOn": [ - "^build" - ] + "dependsOn": ["^build"] }, "test:watch": { "cache": false, @@ -116,62 +46,13 @@ "persistent": true }, "test:coverage": { - "dependsOn": [ - "^build" - ], - "outputs": [ - "coverage/**" - ] - }, - "build:commonjs": { - "cache": false, - "persistent": false, - "outputs": [ - "dist/**/*.js", - "dist/**/*.cjs", - "dist/**/*.d.ts", - "dist/**/*.d.cts", - "dist/**/*.json", - "dist/**/*.txt", - "!dist/**/*.map", - "!dist/**/*.js.map", - "!dist/**/*.cjs.map", - "!dist/**/*.d.ts.map" - ] - }, - "build:commonjs:watch": { - "cache": false, - "persistent": true, - "dependsOn": [ - "build:commonjs" - ] - }, - "db:migrate": { - "cache": false, - "env": [ - "NODE_TLS_REJECT_UNAUTHORIZED" - ] - }, - "db:seed": { - "cache": false, - "env": [ - "DATABASE_URL", - "ENVIRONMENT", - "NODE_ENV" - ] - }, - "db:init": { - "cache": false, - "dependsOn": ["db:migrate"], - "env": [ - "DATABASE_URL", - "ENVIRONMENT", - "NODE_ENV" - ] + "dependsOn": ["^build"], + "outputs": ["coverage/**"] } }, "globalEnv": [ "NODE_ENV", + "NODE_TLS_REJECT_UNAUTHORIZED", "CI", "VERCEL", "VERCEL_ENV", @@ -232,4 +113,4 @@ "NODE_TLS_REJECT_UNAUTHORIZED" ], "envMode": "strict" -} \ No newline at end of file +}