Skip to content

Commit 8928169

Browse files
committed
chore: copy over root files
1 parent e110752 commit 8928169

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+39166
-12549
lines changed

.cursorrules

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Cursor Rules for Supabase JS Libraries Monorepo
2+
3+
You are working in a unified Nx monorepo that consolidates all Supabase JavaScript client libraries. This migration from 6 separate repositories addresses maintenance overhead, dependency duplication, and release coordination challenges.
4+
5+
## Repository Context
6+
7+
This monorepo contains 6 JavaScript/TypeScript libraries previously maintained as separate repositories:
8+
- `packages/core/supabase-js` - Main isomorphic client combining all libraries (@supabase/supabase-js)
9+
- `packages/core/auth-js` - Authentication client (@supabase/auth-js)
10+
- `packages/core/functions-js` - Edge Functions client (@supabase/functions-js)
11+
- `packages/core/postgrest-js` - PostgREST database client (@supabase/postgrest-js)
12+
- `packages/core/realtime-js` - Real-time subscriptions client (@supabase/realtime-js)
13+
- `packages/core/storage-js` - File storage client (@supabase/storage-js)
14+
15+
## Key Principles
16+
17+
1. **Zero Breaking Changes**: All migrations and changes must maintain full backward compatibility for consumers
18+
2. **Fixed Version Mode**: All packages share the same version number and are released together
19+
3. **Workspace Dependencies**: Internal dependencies use `*` which Nx replaces with actual versions during release
20+
4. **Affected Testing**: Always use `nx affected` commands to test only what changed
21+
5. **Conventional Commits**: Use conventional commit format for automated versioning and changelogs
22+
23+
## Common Commands
24+
25+
### Building
26+
- Build all: `nx run-many --target=build --all`
27+
- Build specific: `nx build auth-js`
28+
- Build affected: `nx affected --target=build`
29+
- Watch mode: `nx build auth-js --watch`
30+
31+
### Testing
32+
- Test all: `nx run-many --target=test --all`
33+
- Test specific: `nx test auth-js`
34+
- Test affected: `nx affected --target=test`
35+
- Integration tests: `nx run-many --target=test:integration --all`
36+
37+
### Code Quality
38+
- Lint all: `nx run-many --target=lint --all`
39+
- Format: `nx format`
40+
- Check format: `nx format:check`
41+
42+
### Analysis
43+
- Dependency graph: `nx graph`
44+
- Show projects: `nx show projects`
45+
- Affected graph: `nx affected --graph`
46+
47+
## Development Patterns
48+
49+
### Cross-Library Changes
50+
When making changes that affect multiple libraries:
51+
1. Make all changes in a single PR
52+
2. Update tests in both source library and integration tests in supabase-js
53+
3. Use `nx affected --target=test` to verify all impacts
54+
4. Commit with clear scope: `fix(realtime-js): resolve connection issue`
55+
56+
### Adding New Features
57+
1. Implement in the specific library under `packages/core/[library-name]`
58+
2. Add comprehensive unit tests in the library's `test/` directory
59+
3. If it affects supabase-js, add integration tests there
60+
4. Run `nx affected --target=test` before committing
61+
62+
### Quick Fixes
63+
Even for single-library fixes:
64+
1. Use conventional commit: `fix(storage-js): correct upload timeout`
65+
2. All packages will be versioned together (fixed mode)
66+
3. Run `nx affected --target=test`
67+
4. Changes ship together in next release
68+
69+
## TypeScript Configuration
70+
71+
The workspace uses strict TypeScript settings:
72+
- Target: ES2022
73+
- Module: NodeNext
74+
- Strict mode enabled
75+
- Isolated modules for performance
76+
- Composite projects for incremental builds
77+
78+
## Testing Infrastructure
79+
80+
### Unit Tests
81+
- Located in each library's `test/` directory
82+
- Use Jest as test runner
83+
- Mock external dependencies
84+
85+
### Integration Tests
86+
- Libraries with external services (auth-js, storage-js) use Docker
87+
- Docker Compose configs in `infra/` directories
88+
- Run with: `npm run test:infra` from library directory
89+
90+
### Cross-Platform Tests
91+
The main supabase-js tests against:
92+
- Node.js
93+
- Next.js
94+
- Expo (React Native)
95+
- Bun runtime
96+
- Deno runtime
97+
- Browser environment
98+
99+
## File Structure Conventions
100+
101+
```
102+
packages/core/[library-name]/
103+
├── src/ # Source code
104+
├── test/ # Test files
105+
├── dist/ # Build output (gitignored)
106+
├── package.json # Package configuration
107+
└── tsconfig.json # TypeScript config
108+
```
109+
110+
## Important Notes
111+
112+
- **Different Default Branches**: Original repos used either `master` or `main` - be aware when referencing history
113+
- **Package Names**: All packages maintain original npm names (@supabase/[package-name])
114+
- **Shared Code**: Extract common patterns (HTTP client, error handling) to shared packages when identified
115+
- **Docker Required**: Integration tests for auth-js and storage-js require Docker to be running
116+
117+
## Release Process
118+
119+
### Fixed Version Release
120+
All packages released with same version:
121+
```bash
122+
nx release # Interactive release
123+
nx release --dry-run # Preview changes
124+
nx release --yes # CI automation
125+
```
126+
127+
### Internal Dependencies
128+
```json
129+
// packages/core/supabase-js/package.json
130+
"dependencies": {
131+
"@supabase/auth-js": "*",
132+
"@supabase/realtime-js": "*",
133+
"@supabase/functions-js": "*",
134+
"@supabase/storage-js": "*",
135+
"@supabase/postgrest-js": "*"
136+
}
137+
```
138+
The `*` is replaced with actual version during release.
139+
140+
## Code Style
141+
142+
- Use Prettier for formatting (config in .prettierrc)
143+
- Follow existing patterns in each library
144+
- Maintain consistency across the monorepo
145+
- Document public APIs with JSDoc comments
146+
147+
## Common Pitfalls to Avoid
148+
149+
1. Don't hardcode version numbers for internal dependencies
150+
2. Don't make breaking changes to public APIs
151+
3. Don't forget to run affected tests before committing
152+
4. Don't mix unrelated changes in a single commit
153+
5. Don't bypass the Nx build system by running npm scripts directly for cross-library work
154+
155+
## When Making Suggestions
156+
157+
1. Always consider the monorepo structure - changes might affect multiple packages
158+
2. Use Nx commands rather than npm/yarn directly for workspace operations
159+
3. Suggest running affected tests, not all tests, for better performance
160+
4. Remember that all packages version together in fixed mode
161+
5. Consider Docker requirements for integration tests
162+
6. Maintain backward compatibility at all costs

.gitignore

Lines changed: 42 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,49 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.DS_Store
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# TypeScript v1 declaration files
46-
typings/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
50-
51-
# Optional npm cache directory
52-
.npm
53-
54-
# Optional eslint cache
55-
.eslintcache
56-
57-
# Microbundle cache
58-
.rpt2_cache/
59-
.rts2_cache_cjs/
60-
.rts2_cache_es/
61-
.rts2_cache_umd/
62-
63-
# Optional REPL history
64-
.node_repl_history
65-
66-
# Output of 'npm pack'
67-
*.tgz
1+
# See https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
682

69-
# Yarn Integrity file
70-
.yarn-integrity
71-
72-
# dotenv environment variables file
73-
.env
74-
.env.test
75-
76-
# parcel-bundler cache (https://parceljs.org/)
77-
.cache
78-
79-
# Next.js build output
80-
.next
81-
82-
# Nuxt.js build / generate output
83-
.nuxt
3+
# compiled output
844
dist
5+
tmp
6+
out-tsc
7+
8+
# dependencies
9+
node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
yarn-error.log
34+
testem.log
35+
/typings
36+
.env
8537

86-
# Gatsby files
87-
.cache/
88-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
89-
# https://nextjs.org/blog/next-9-1#public-directory-support
90-
# public
91-
92-
# vuepress build output
93-
.vuepress/dist
94-
95-
# Serverless directories
96-
.serverless/
97-
98-
# FuseBox cache
99-
.fusebox/
100-
101-
# DynamoDB Local files
102-
.dynamodb/
103-
104-
# TernJS port file
105-
.tern-port
106-
107-
docs/v2
108-
109-
# Test package-lock files (use local tarball, checksums change with builds)
110-
test/*/package-lock.json
111-
test/integration/*/package-lock.json
112-
113-
.cursor/
114-
115-
deno.lock
116-
38+
# System Files
39+
.DS_Store
40+
Thumbs.db
41+
.tmp
11742

11843
.nx/cache
11944
.nx/workspace-data
12045
.cursor/rules/nx-rules.mdc
121-
.github/instructions/nx.instructions.md
46+
.github/instructions/nx.instructions.md
47+
48+
vite.config.*.timestamp*
49+
vitest.config.*.timestamp*

.npmignore

Lines changed: 0 additions & 27 deletions
This file was deleted.

.nxignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Ignore example directories that have their own node_modules
2+
packages/core/*/example
3+
packages/core/*/examples
4+
5+
# Ignore node_modules in any example directories
6+
**/example/node_modules
7+
**/examples/node_modules
8+
**/example/*/node_modules
9+
**/examples/*/node_modules
10+
11+
# Ignore test directories that have their own package.json
12+
# These are test fixtures, not actual projects
13+
packages/core/auth-js/test
14+
packages/core/supabase-js/test/integration/next
15+
packages/core/supabase-js/test/integration/expo
16+
packages/core/supabase-js/test/deno

.prettierignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.expo
2-
.next
3-
node_modules
4-
package-lock.json
5-
docker*
1+
# Add files here to ignore them from prettier formatting
2+
/dist
3+
/coverage
4+
/.nx/cache
5+
/.nx/workspace-data

0 commit comments

Comments
 (0)