Skip to content

Commit 0fdd2a0

Browse files
committed
chore(repo): some fixes
1 parent 698c306 commit 0fdd2a0

File tree

18 files changed

+1148
-632
lines changed

18 files changed

+1148
-632
lines changed

.cursor/mcp.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
2-
"mcpServers": {
3-
"nx-mcp": {
4-
"command": "npx",
5-
"args": ["-y", "nx-mcp@latest"]
6-
}
7-
}
8-
}
2+
"mcpServers": {}
3+
}

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nx"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"rules": {
9+
"@nx/enforce-module-boundaries": [
10+
"error",
11+
{
12+
"enforceBuildableLibDependency": true,
13+
"allow": [],
14+
"depConstraints": [
15+
{
16+
"sourceTag": "*",
17+
"onlyDependOnLibsWithTags": ["*"]
18+
}
19+
]
20+
}
21+
]
22+
}
23+
},
24+
{
25+
"files": ["*.ts", "*.tsx"],
26+
"extends": ["plugin:@nx/typescript"],
27+
"rules": {}
28+
},
29+
{
30+
"files": ["*.js", "*.jsx"],
31+
"extends": ["plugin:@nx/javascript"],
32+
"rules": {}
33+
},
34+
{
35+
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
36+
"env": {
37+
"jest": true
38+
},
39+
"rules": {}
40+
}
41+
]
42+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ Thumbs.db
4949
.github/instructions/nx.instructions.md
5050

5151
vite.config.*.timestamp*
52-
vitest.config.*.timestamp*
52+
vitest.config.*.timestamp*
53+
test-output

CLAUDE.md

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ nx test supabase-js --coverage # Test with coverage
138138

139139
**Docker Requirements:**
140140

141-
| Package | Docker Required | Infrastructure | Special Commands |
142-
| ------------ | --------------- | ------------------------------- | ---------------- |
143-
| auth-js | ✅ Yes | Auth Server + Postgres | May use `nx test:auth auth-js` |
144-
| functions-js | ✅ Yes | Deno relay (testcontainers) | Standard `nx test functions-js` |
145-
| postgrest-js | ✅ Yes | PostgREST + PostgreSQL | Standard `nx test postgrest-js` |
141+
| Package | Docker Required | Infrastructure | Special Commands |
142+
| ------------ | --------------- | ------------------------------- | ------------------------------------ |
143+
| auth-js | ✅ Yes | Auth Server + Postgres | May use `nx test:auth auth-js` |
144+
| functions-js | ✅ Yes | Deno relay (testcontainers) | Standard `nx test functions-js` |
145+
| postgrest-js | ✅ Yes | PostgREST + PostgreSQL | Standard `nx test postgrest-js` |
146146
| storage-js | ✅ Yes | Storage API + PostgreSQL + Kong | May use `nx test:storage storage-js` |
147-
| realtime-js | ❌ No | Mock WebSockets | Standard `nx test realtime-js` |
148-
| supabase-js | ❌ No | Unit tests only | Standard `nx test supabase-js` |
147+
| realtime-js | ❌ No | Mock WebSockets | Standard `nx test realtime-js` |
148+
| supabase-js | ❌ No | Unit tests only | Standard `nx test supabase-js` |
149149

150150
> **📖 See [TESTING.md](docs/TESTING.md) for complete testing guide and troubleshooting**
151151
@@ -216,6 +216,68 @@ nx release --tag=latest --yes # Promotes to stable with same version for ALL pa
216216

217217
Each library has its own `tsconfig.json` extending the base configuration, allowing for library-specific adjustments while maintaining consistency.
218218

219+
### TypeScript Project References Setup
220+
221+
This repository uses TypeScript project references for incremental builds and better type checking across packages.
222+
223+
**What's Configured:**
224+
225+
1. **tsconfig.base.json** - Base configuration inherited by all projects:
226+
- `composite: true` - Enables project references
227+
- `declaration: true` - Required by composite
228+
- `moduleResolution: "bundler"` - Works with workspaces
229+
- `isolatedModules: true` - Inherited but overridden in core packages
230+
- `noImplicitOverride: true` - Inherited but overridden in core packages
231+
- **No `customConditions`** - Removed to avoid conflicts with CommonJS packages
232+
233+
2. **Root tsconfig.json** - References all projects in the monorepo:
234+
235+
```json
236+
{
237+
"extends": "./tsconfig.base.json",
238+
"files": [],
239+
"references": [
240+
{ "path": "./packages/core/auth-js" },
241+
{ "path": "./packages/core/realtime-js" }
242+
// ... all other packages
243+
]
244+
}
245+
```
246+
247+
3. **Core packages** (auth-js, realtime-js, postgrest-js, functions-js, storage-js):
248+
- Keep `module: "CommonJS"` for backward compatibility
249+
- Override `moduleResolution: "Node"` (required for CommonJS)
250+
- Override `isolatedModules: false` (existing code doesn't use `export type`)
251+
- Override `noImplicitOverride: false` (existing code doesn't use `override` keyword)
252+
- Add `references` array pointing to dependencies (managed by `nx sync`)
253+
254+
4. **Utils packages** (utils-fetch):
255+
- Inherit `moduleResolution: "bundler"` from base
256+
- Can optionally add `customConditions: ["@supabase-js/source"]` for source preference
257+
258+
**Key Principles:**
259+
260+
-**No Breaking Changes**: Build output is identical - only type-checking is affected
261+
-**Incremental Builds**: TypeScript only recompiles changed projects
262+
-**Better Performance**: Reduced memory usage during builds
263+
-**Automatic References**: Nx sync automatically maintains project references
264+
- ⚠️ **No `customConditions` in base**: Would conflict with `moduleResolution: "Node"`
265+
266+
**When Adding New Packages:**
267+
268+
1. Ensure `composite: true` and `declaration: true` are set
269+
2. Add `references` array pointing to dependencies
270+
3. If using CommonJS, override `moduleResolution: "Node"` and disable strict options
271+
4. Run `nx sync` to update root tsconfig.json automatically
272+
273+
**Important Notes:**
274+
275+
- TypeScript project references work WITHOUT `customConditions` - it's optional
276+
- `customConditions` only optimizes source file resolution during development
277+
- Core packages use `moduleResolution: "Node"` which is incompatible with `customConditions`
278+
- The `isolatedModules: false` override avoids requiring `export type` for type re-exports
279+
- All build outputs remain identical to pre-project-references setup
280+
219281
## Testing Infrastructure
220282

221283
### Unit Tests (Jest)
@@ -314,10 +376,12 @@ Tests run against multiple environments:
314376
### Branch Information
315377

316378
**Current Repository:**
379+
317380
- **Default branch**: `master` (confirmed current default)
318381
- **Repository URL**: `github.com/supabase/supabase-js`
319382

320383
**Original Repository Branches** (for historical reference):
384+
321385
- **master**: auth-js, postgrest-js, realtime-js, supabase-js
322386
- **main**: functions-js, storage-js
323387

nx.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
"!{projectRoot}/**/*.md",
1616
"!{projectRoot}/docs/**/*",
1717
"!{projectRoot}/coverage/**/*",
18-
"sharedGlobals"
18+
"sharedGlobals",
19+
"!{projectRoot}/.eslintrc.json",
20+
"!{projectRoot}/eslint.config.mjs",
21+
"!{projectRoot}/tsconfig.spec.json",
22+
"!{projectRoot}/src/test-setup.[jt]s",
23+
"!{projectRoot}/test-setup.[jt]s"
1924
],
2025
"testing": [
2126
"production",

0 commit comments

Comments
 (0)