From c57066568a76dc243ea641573a16351f3e2d01c9 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Fri, 24 Oct 2025 13:54:26 +0300 Subject: [PATCH 1/2] chore(repo): add format pre-commit hook and one version of prettier --- .husky/pre-push | 18 +++++++++ package-lock.json | 17 --------- packages/core/auth-js/README.md | 5 +-- packages/core/functions-js/README.md | 1 - packages/core/functions-js/package.json | 1 - packages/core/postgrest-js/package.json | 1 - packages/core/realtime-js/README.md | 1 - packages/core/storage-js/README.md | 50 +++++++++++-------------- 8 files changed, 42 insertions(+), 52 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 334634ef4..0c9325160 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,3 +1,21 @@ +# Check code formatting +echo "🔍 Checking code formatting..." +npx nx format:check + +if [ $? -ne 0 ]; then + echo "" + echo "❌ Push blocked: Code is not properly formatted" + echo "" + echo "To fix this:" + echo " 1. Run: npx nx format" + echo " 2. Commit the formatted files" + echo " 3. Push again" + echo "" + exit 1 +fi + +echo "✅ Code formatting check passed" + # Check if postgrest-js test database schema was modified if git diff --name-only origin/master...HEAD 2>/dev/null | grep -q "packages/core/postgrest-js/test/db/"; then echo "📝 Detected changes in postgrest-js test database schema..." diff --git a/package-lock.json b/package-lock.json index d007b8cb6..04597999f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35108,7 +35108,6 @@ "cpy-cli": "^5.0.0", "jest": "^28.1.0", "node-abort-controller": "^3.0.1", - "prettier": "^2.6.2", "ts-jest": "^28.0.3", "tstyche": "^4.3.0", "type-fest": "^4.32.0", @@ -36225,22 +36224,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "packages/core/postgrest-js/node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "packages/core/postgrest-js/node_modules/pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", diff --git a/packages/core/auth-js/README.md b/packages/core/auth-js/README.md index 90c45de70..157e309ae 100644 --- a/packages/core/auth-js/README.md +++ b/packages/core/auth-js/README.md @@ -27,6 +27,7 @@ [![Package](https://img.shields.io/npm/v/@supabase/auth-js)](https://www.npmjs.com/package/@supabase/auth-js) [![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license) [![pkg.pr.new](https://pkg.pr.new/badge/supabase/auth-js)](https://pkg.pr.new/~/supabase/auth-js) + ## Quick start @@ -81,8 +82,6 @@ npx nx build:main auth-js # CommonJS build (dist/main/) npx nx build:module auth-js # ES Modules build (dist/module/) # Other useful commands -npx nx clean auth-js # Clean build artifacts -npx nx format auth-js # Format code with Prettier npx nx lint auth-js # Run ESLint npx nx typecheck auth-js # TypeScript type checking npx nx docs auth-js # Generate documentation @@ -155,4 +154,4 @@ The Docker setup includes: We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started. -For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. \ No newline at end of file +For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. diff --git a/packages/core/functions-js/README.md b/packages/core/functions-js/README.md index dc893338e..df2b5235a 100644 --- a/packages/core/functions-js/README.md +++ b/packages/core/functions-js/README.md @@ -77,7 +77,6 @@ npx nx build:module functions-js # ES Modules build (dist/module/) # Other useful commands npx nx clean functions-js # Clean build artifacts -npx nx format functions-js # Format code with Prettier npx nx typecheck functions-js # TypeScript type checking npx nx docs functions-js # Generate documentation ``` diff --git a/packages/core/functions-js/package.json b/packages/core/functions-js/package.json index c6072f063..d0d3867ea 100644 --- a/packages/core/functions-js/package.json +++ b/packages/core/functions-js/package.json @@ -7,7 +7,6 @@ "types": "dist/module/index.d.ts", "sideEffects": false, "scripts": { - "format": "prettier --write \"{src,test}/**/*.ts\"", "build": "npm run build:main && npm run build:module", "build:main": "tsc -p tsconfig.json", "build:module": "tsc -p tsconfig.module.json", diff --git a/packages/core/postgrest-js/package.json b/packages/core/postgrest-js/package.json index 8e402f91b..5017ba874 100644 --- a/packages/core/postgrest-js/package.json +++ b/packages/core/postgrest-js/package.json @@ -61,7 +61,6 @@ "cpy-cli": "^5.0.0", "jest": "^28.1.0", "node-abort-controller": "^3.0.1", - "prettier": "^2.6.2", "ts-jest": "^28.0.3", "tstyche": "^4.3.0", "type-fest": "^4.32.0", diff --git a/packages/core/realtime-js/README.md b/packages/core/realtime-js/README.md index 6a315d1b9..386264a58 100755 --- a/packages/core/realtime-js/README.md +++ b/packages/core/realtime-js/README.md @@ -267,7 +267,6 @@ npx nx build:module realtime-js # ES Modules build (dist/module/) # Other useful commands npx nx clean realtime-js # Clean build artifacts -npx nx format realtime-js # Format code with Prettier npx nx lint realtime-js # Run ESLint npx nx typecheck realtime-js # TypeScript type checking ``` diff --git a/packages/core/storage-js/README.md b/packages/core/storage-js/README.md index 46a23bc80..b0207c304 100644 --- a/packages/core/storage-js/README.md +++ b/packages/core/storage-js/README.md @@ -58,10 +58,7 @@ If you're already using `@supabase/supabase-js`, access storage through the clie ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient( - 'https://.supabase.co', - '' -) +const supabase = createClient('https://.supabase.co', '') // Access storage const storage = supabase.storage @@ -94,6 +91,7 @@ const analyticsBucket = storageClient.analytics // Analytics API ``` > **When to use each approach:** +> > - Use `supabase.storage` when working with other Supabase features (auth, database, etc.) > - Use `new StorageClient()` for storage-only applications or when you need fine-grained control @@ -108,7 +106,7 @@ Standard buckets for storing files, images, videos, and other assets. ```js // Create regular storage bucket const { data, error } = await storageClient.createBucket('my-files', { - public: false + public: false, }) // Upload files @@ -130,7 +128,7 @@ const bucket = storageClient.vectors.from('embeddings-prod') await bucket.createIndex({ indexName: 'documents', dimension: 1536, - distanceMetric: 'cosine' + distanceMetric: 'cosine', }) ``` @@ -290,6 +288,7 @@ Supabase Storage provides specialized analytics buckets using Apache Iceberg tab ### What are Analytics Buckets? Analytics buckets use the Apache Iceberg open table format, providing: + - **ACID transactions** for data consistency - **Schema evolution** without data rewrites - **Time travel** to query historical data @@ -299,6 +298,7 @@ Analytics buckets use the Apache Iceberg open table format, providing: ### When to Use Analytics Buckets **Use analytics buckets for:** + - Time-series data (logs, metrics, events) - Data lake architectures - Business intelligence and reporting @@ -306,6 +306,7 @@ Analytics buckets use the Apache Iceberg open table format, providing: - Analytical workloads requiring ACID guarantees **Use regular storage buckets for:** + - User file uploads (images, documents, videos) - Individual file management - Content delivery @@ -320,10 +321,7 @@ You can access analytics functionality through the `analytics` property on your ```typescript import { createClient } from '@supabase/supabase-js' -const supabase = createClient( - 'https://your-project.supabase.co', - 'your-anon-key' -) +const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') // Access analytics operations const analytics = supabase.storage.analytics @@ -371,6 +369,7 @@ if (error) { ``` **Returns:** + ```typescript { data: { @@ -394,18 +393,19 @@ const { data, error } = await analytics.listBuckets({ offset: 0, sortColumn: 'created_at', sortOrder: 'desc', - search: 'prod' + search: 'prod', }) if (data) { console.log(`Found ${data.length} analytics buckets`) - data.forEach(bucket => { + data.forEach((bucket) => { console.log(`- ${bucket.id} (created: ${bucket.created_at})`) }) } ``` **Parameters:** + - `limit?: number` - Maximum number of buckets to return - `offset?: number` - Number of buckets to skip (for pagination) - `sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'` - Column to sort by @@ -413,6 +413,7 @@ if (data) { - `search?: string` - Search term to filter bucket names **Returns:** + ```typescript { data: AnalyticBucket[] | null @@ -428,7 +429,7 @@ const firstPage = await analytics.listBuckets({ limit: 100, offset: 0, sortColumn: 'created_at', - sortOrder: 'desc' + sortOrder: 'desc', }) // Fetch second page @@ -436,7 +437,7 @@ const secondPage = await analytics.listBuckets({ limit: 100, offset: 100, sortColumn: 'created_at', - sortOrder: 'desc' + sortOrder: 'desc', }) ``` @@ -455,6 +456,7 @@ if (error) { ``` **Returns:** + ```typescript { data: { message: string } | null @@ -503,11 +505,7 @@ try { The library exports TypeScript types for analytics buckets: ```typescript -import type { - AnalyticBucket, - BucketType, - StorageError, -} from '@supabase/storage-js' +import type { AnalyticBucket, BucketType, StorageError } from '@supabase/storage-js' // AnalyticBucket type interface AnalyticBucket { @@ -526,7 +524,7 @@ interface AnalyticBucket { ```typescript async function bucketExists(bucketName: string): Promise { const { data, error } = await analytics.listBuckets({ - search: bucketName + search: bucketName, }) if (error) { @@ -534,7 +532,7 @@ async function bucketExists(bucketName: string): Promise { return false } - return data?.some(bucket => bucket.id === bucketName) ?? false + return data?.some((bucket) => bucket.id === bucketName) ?? false } ``` @@ -575,7 +573,7 @@ async function getAllAnalyticsBuckets() { limit, offset, sortColumn: 'created_at', - sortOrder: 'desc' + sortOrder: 'desc', }) if (error) { @@ -629,10 +627,7 @@ If you're using the full Supabase client: ```typescript import { createClient } from '@supabase/supabase-js' -const supabase = createClient( - 'https://your-project.supabase.co', - 'your-anon-key' -) +const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') // Access vector operations through storage const vectors = supabase.storage.vectors @@ -1085,7 +1080,6 @@ The storage-js package uses multiple build scripts to generate different module | `build:module` | **ES Modules build** | `dist/module/` - Modern ES6 modules with TypeScript definitions | | `build:umd` | **UMD build** | `dist/umd/` - Universal Module Definition for browsers/CDN | | `clean` | **Clean build artifacts** | Removes `dist/` and `docs/v2/` directories | -| `format` | **Format code** | Runs Prettier on all TypeScript files | #### Running Builds @@ -1316,4 +1310,4 @@ The test infrastructure (`infra/docker-compose.yml`) includes: We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started. -For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. \ No newline at end of file +For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. From 786e0c6c41e962a2b34890350ccc70747b2d9a2f Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Fri, 24 Oct 2025 14:07:08 +0300 Subject: [PATCH 2/2] chore(repo): wrong --- .husky/pre-push | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 0c9325160..b3d19d9e5 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,18 +1,6 @@ # Check code formatting echo "🔍 Checking code formatting..." -npx nx format:check - -if [ $? -ne 0 ]; then - echo "" - echo "❌ Push blocked: Code is not properly formatted" - echo "" - echo "To fix this:" - echo " 1. Run: npx nx format" - echo " 2. Commit the formatted files" - echo " 3. Push again" - echo "" - exit 1 -fi +npx nx format:check --verbose echo "✅ Code formatting check passed"