Skip to content

Commit 46abe0d

Browse files
authored
chore(repo): add format pre-push hook and one version of prettier (#1801)
1 parent da98538 commit 46abe0d

File tree

8 files changed

+30
-52
lines changed

8 files changed

+30
-52
lines changed

.husky/pre-push

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Check code formatting
2+
echo "🔍 Checking code formatting..."
3+
npx nx format:check --verbose
4+
5+
echo "✅ Code formatting check passed"
6+
17
# Check if postgrest-js test database schema was modified
28
if git diff --name-only origin/master...HEAD 2>/dev/null | grep -q "packages/core/postgrest-js/test/db/"; then
39
echo "📝 Detected changes in postgrest-js test database schema..."

package-lock.json

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/auth-js/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
[![Package](https://img.shields.io/npm/v/@supabase/auth-js)](https://www.npmjs.com/package/@supabase/auth-js)
2828
[![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license)
2929
[![pkg.pr.new](https://pkg.pr.new/badge/supabase/auth-js)](https://pkg.pr.new/~/supabase/auth-js)
30+
3031
</div>
3132

3233
## Quick start
@@ -81,8 +82,6 @@ npx nx build:main auth-js # CommonJS build (dist/main/)
8182
npx nx build:module auth-js # ES Modules build (dist/module/)
8283

8384
# Other useful commands
84-
npx nx clean auth-js # Clean build artifacts
85-
npx nx format auth-js # Format code with Prettier
8685
npx nx lint auth-js # Run ESLint
8786
npx nx typecheck auth-js # TypeScript type checking
8887
npx nx docs auth-js # Generate documentation
@@ -155,4 +154,4 @@ The Docker setup includes:
155154

156155
We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started.
157156

158-
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.
157+
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.

packages/core/functions-js/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ npx nx build:module functions-js # ES Modules build (dist/module/)
7777

7878
# Other useful commands
7979
npx nx clean functions-js # Clean build artifacts
80-
npx nx format functions-js # Format code with Prettier
8180
npx nx typecheck functions-js # TypeScript type checking
8281
npx nx docs functions-js # Generate documentation
8382
```

packages/core/functions-js/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"types": "dist/module/index.d.ts",
88
"sideEffects": false,
99
"scripts": {
10-
"format": "prettier --write \"{src,test}/**/*.ts\"",
1110
"build": "npm run build:main && npm run build:module",
1211
"build:main": "tsc -p tsconfig.json",
1312
"build:module": "tsc -p tsconfig.module.json",

packages/core/postgrest-js/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"cpy-cli": "^5.0.0",
6262
"jest": "^28.1.0",
6363
"node-abort-controller": "^3.0.1",
64-
"prettier": "^2.6.2",
6564
"ts-jest": "^28.0.3",
6665
"tstyche": "^4.3.0",
6766
"type-fest": "^4.32.0",

packages/core/realtime-js/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ npx nx build:module realtime-js # ES Modules build (dist/module/)
267267

268268
# Other useful commands
269269
npx nx clean realtime-js # Clean build artifacts
270-
npx nx format realtime-js # Format code with Prettier
271270
npx nx lint realtime-js # Run ESLint
272271
npx nx typecheck realtime-js # TypeScript type checking
273272
```

packages/core/storage-js/README.md

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ If you're already using `@supabase/supabase-js`, access storage through the clie
5858
```js
5959
import { createClient } from '@supabase/supabase-js'
6060

61-
const supabase = createClient(
62-
'https://<project_ref>.supabase.co',
63-
'<your-anon-key>'
64-
)
61+
const supabase = createClient('https://<project_ref>.supabase.co', '<your-anon-key>')
6562

6663
// Access storage
6764
const storage = supabase.storage
@@ -94,6 +91,7 @@ const analyticsBucket = storageClient.analytics // Analytics API
9491
```
9592

9693
> **When to use each approach:**
94+
>
9795
> - Use `supabase.storage` when working with other Supabase features (auth, database, etc.)
9896
> - Use `new StorageClient()` for storage-only applications or when you need fine-grained control
9997
@@ -108,7 +106,7 @@ Standard buckets for storing files, images, videos, and other assets.
108106
```js
109107
// Create regular storage bucket
110108
const { data, error } = await storageClient.createBucket('my-files', {
111-
public: false
109+
public: false,
112110
})
113111

114112
// Upload files
@@ -130,7 +128,7 @@ const bucket = storageClient.vectors.from('embeddings-prod')
130128
await bucket.createIndex({
131129
indexName: 'documents',
132130
dimension: 1536,
133-
distanceMetric: 'cosine'
131+
distanceMetric: 'cosine',
134132
})
135133
```
136134

@@ -290,6 +288,7 @@ Supabase Storage provides specialized analytics buckets using Apache Iceberg tab
290288
### What are Analytics Buckets?
291289

292290
Analytics buckets use the Apache Iceberg open table format, providing:
291+
293292
- **ACID transactions** for data consistency
294293
- **Schema evolution** without data rewrites
295294
- **Time travel** to query historical data
@@ -299,13 +298,15 @@ Analytics buckets use the Apache Iceberg open table format, providing:
299298
### When to Use Analytics Buckets
300299

301300
**Use analytics buckets for:**
301+
302302
- Time-series data (logs, metrics, events)
303303
- Data lake architectures
304304
- Business intelligence and reporting
305305
- Large-scale batch processing
306306
- Analytical workloads requiring ACID guarantees
307307

308308
**Use regular storage buckets for:**
309+
309310
- User file uploads (images, documents, videos)
310311
- Individual file management
311312
- Content delivery
@@ -320,10 +321,7 @@ You can access analytics functionality through the `analytics` property on your
320321
```typescript
321322
import { createClient } from '@supabase/supabase-js'
322323

323-
const supabase = createClient(
324-
'https://your-project.supabase.co',
325-
'your-anon-key'
326-
)
324+
const supabase = createClient('https://your-project.supabase.co', 'your-anon-key')
327325

328326
// Access analytics operations
329327
const analytics = supabase.storage.analytics
@@ -371,6 +369,7 @@ if (error) {
371369
```
372370

373371
**Returns:**
372+
374373
```typescript
375374
{
376375
data: {
@@ -394,25 +393,27 @@ const { data, error } = await analytics.listBuckets({
394393
offset: 0,
395394
sortColumn: 'created_at',
396395
sortOrder: 'desc',
397-
search: 'prod'
396+
search: 'prod',
398397
})
399398

400399
if (data) {
401400
console.log(`Found ${data.length} analytics buckets`)
402-
data.forEach(bucket => {
401+
data.forEach((bucket) => {
403402
console.log(`- ${bucket.id} (created: ${bucket.created_at})`)
404403
})
405404
}
406405
```
407406

408407
**Parameters:**
408+
409409
- `limit?: number` - Maximum number of buckets to return
410410
- `offset?: number` - Number of buckets to skip (for pagination)
411411
- `sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'` - Column to sort by
412412
- `sortOrder?: 'asc' | 'desc'` - Sort direction
413413
- `search?: string` - Search term to filter bucket names
414414

415415
**Returns:**
416+
416417
```typescript
417418
{
418419
data: AnalyticBucket[] | null
@@ -428,15 +429,15 @@ const firstPage = await analytics.listBuckets({
428429
limit: 100,
429430
offset: 0,
430431
sortColumn: 'created_at',
431-
sortOrder: 'desc'
432+
sortOrder: 'desc',
432433
})
433434

434435
// Fetch second page
435436
const secondPage = await analytics.listBuckets({
436437
limit: 100,
437438
offset: 100,
438439
sortColumn: 'created_at',
439-
sortOrder: 'desc'
440+
sortOrder: 'desc',
440441
})
441442
```
442443

@@ -455,6 +456,7 @@ if (error) {
455456
```
456457

457458
**Returns:**
459+
458460
```typescript
459461
{
460462
data: { message: string } | null
@@ -503,11 +505,7 @@ try {
503505
The library exports TypeScript types for analytics buckets:
504506

505507
```typescript
506-
import type {
507-
AnalyticBucket,
508-
BucketType,
509-
StorageError,
510-
} from '@supabase/storage-js'
508+
import type { AnalyticBucket, BucketType, StorageError } from '@supabase/storage-js'
511509

512510
// AnalyticBucket type
513511
interface AnalyticBucket {
@@ -526,15 +524,15 @@ interface AnalyticBucket {
526524
```typescript
527525
async function bucketExists(bucketName: string): Promise<boolean> {
528526
const { data, error } = await analytics.listBuckets({
529-
search: bucketName
527+
search: bucketName,
530528
})
531529

532530
if (error) {
533531
console.error('Error checking bucket:', error.message)
534532
return false
535533
}
536534

537-
return data?.some(bucket => bucket.id === bucketName) ?? false
535+
return data?.some((bucket) => bucket.id === bucketName) ?? false
538536
}
539537
```
540538

@@ -575,7 +573,7 @@ async function getAllAnalyticsBuckets() {
575573
limit,
576574
offset,
577575
sortColumn: 'created_at',
578-
sortOrder: 'desc'
576+
sortOrder: 'desc',
579577
})
580578

581579
if (error) {
@@ -629,10 +627,7 @@ If you're using the full Supabase client:
629627
```typescript
630628
import { createClient } from '@supabase/supabase-js'
631629

632-
const supabase = createClient(
633-
'https://your-project.supabase.co',
634-
'your-anon-key'
635-
)
630+
const supabase = createClient('https://your-project.supabase.co', 'your-anon-key')
636631

637632
// Access vector operations through storage
638633
const vectors = supabase.storage.vectors
@@ -1085,7 +1080,6 @@ The storage-js package uses multiple build scripts to generate different module
10851080
| `build:module` | **ES Modules build** | `dist/module/` - Modern ES6 modules with TypeScript definitions |
10861081
| `build:umd` | **UMD build** | `dist/umd/` - Universal Module Definition for browsers/CDN |
10871082
| `clean` | **Clean build artifacts** | Removes `dist/` and `docs/v2/` directories |
1088-
| `format` | **Format code** | Runs Prettier on all TypeScript files |
10891083
10901084
#### Running Builds
10911085
@@ -1316,4 +1310,4 @@ The test infrastructure (`infra/docker-compose.yml`) includes:
13161310
13171311
We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started.
13181312
1319-
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.
1313+
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.

0 commit comments

Comments
 (0)