Skip to content

Commit 70a4e84

Browse files
authored
chore(repo): import existing repos into monorepo [skip ci]
- Imports history from @supabase/auth-js, @supabase/functions-js, @supabase/postgrest-js, @supabase/realtime-js, and @supabase/storage-js. - Preserves full commit history via merge commit. - CI skipped to avoid 2,453 commits triggering canary release.
2 parents f2b6733 + 326f610 commit 70a4e84

File tree

424 files changed

+220222
-47667
lines changed

Some content is hidden

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

424 files changed

+220222
-47667
lines changed

.cursor/mcp.json

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

.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
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "\U0001F41E Bug report"
2+
description: Report an issue with a Supabase JS Library
3+
labels: [bug]
4+
type: Bug
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: textarea
11+
id: bug-description
12+
attributes:
13+
label: Describe the bug
14+
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
15+
placeholder: I am doing ... What I expect is ... What actually happening is ...
16+
validations:
17+
required: true
18+
- type: dropdown
19+
id: supabase-library
20+
attributes:
21+
label: Library affected
22+
description: Select the library that you think is affected by the bug
23+
options:
24+
- supabase-js
25+
- auth-js
26+
- postgrest-js
27+
- realtime-js
28+
- storage-js
29+
- functions-js
30+
- unsure/all/other
31+
validations:
32+
required: true
33+
- type: input
34+
id: reproduction
35+
attributes:
36+
label: Reproduction
37+
description: If possible, please provide a link to a repo that can reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is very helpful. ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 7 days, it will be closed.
38+
placeholder: Reproduction URL
39+
validations:
40+
required: false
41+
- type: textarea
42+
id: reproduction-steps
43+
attributes:
44+
label: Steps to reproduce
45+
description: Please provide any reproduction steps that may need to be described.
46+
placeholder: Run `npm install` followed by `npm run dev`
47+
- type: textarea
48+
id: system-info
49+
attributes:
50+
label: System Info
51+
description: Output of `npx envinfo --system --npmPackages '{supabase,@supabase/*}' --binaries --browsers`
52+
render: shell
53+
placeholder: System, Binaries, Browsers
54+
validations:
55+
required: true
56+
- type: dropdown
57+
id: package-manager
58+
attributes:
59+
label: Used Package Manager
60+
description: Select the used package manager
61+
options:
62+
- npm
63+
- yarn
64+
- pnpm
65+
- bun
66+
validations:
67+
required: true
68+
- type: textarea
69+
id: logs
70+
attributes:
71+
label: Logs
72+
description: |
73+
Optional if provided reproduction. It's very helpful to provide the log text instead of a screenshot.
74+
75+
Provide the error log here in the format below.
76+
77+
````
78+
<details>
79+
<summary>Click to expand!</summary>
80+
81+
```shell
82+
// paste the log text here
83+
```
84+
</details>
85+
````
86+
- type: checkboxes
87+
id: checkboxes
88+
attributes:
89+
label: Validations
90+
description: Before submitting the issue, please make sure you do the following
91+
options:
92+
- label: Follow our [Code of Conduct](https://github.com/supabase/.github/blob/main/CODE_OF_CONDUCT.md)
93+
required: true
94+
- label: Read the [Contributing Guidelines](https://github.com/supabase/supabase-js/blob/main/CONTRIBUTING.md).
95+
required: true
96+
- label: Read the [docs](https://supabase.com/docs/reference/javascript/introduction).
97+
required: true
98+
- label: Check that there isn't [already an issue](https://github.com/supabase/supabase-js/issues) that reports the same bug to avoid creating a duplicate.
99+
required: true
100+
- label: Make sure this is a Supabase JS Library issue and not an issue with the Supabase platform. If it's a Supabase platform related bug, it should likely be reported to [supabase/supabase](https://github.com/supabase/supabase) instead.
101+
required: true
102+
- label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/supabase/supabase-js/discussions) or join our [Discord Chat Server](https://discord.supabase.com//).
103+
required: true
104+
- label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
105+
required: true

.github/ISSUE_TEMPLATE/docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "\U0001F4DA Documentation"
2+
description: Suggest an update to the Supabase JS Libraries documentation
3+
labels: [documentation]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this issue!
9+
- type: checkboxes
10+
id: documentation_is
11+
attributes:
12+
label: Documentation is
13+
options:
14+
- label: Missing
15+
- label: Outdated
16+
- label: Confusing
17+
- label: Not sure?
18+
- type: textarea
19+
id: description
20+
attributes:
21+
label: Explain in Detail
22+
description: A clear and concise description of your suggestion. If you intend to submit a PR for this issue, tell us in the description. Thanks!
23+
placeholder: The description of ... is not clear. I thought it meant ... but it wasn't.
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: suggestion
28+
attributes:
29+
label: Your Suggestion for Changes
30+
validations:
31+
required: false
32+
- type: input
33+
id: docs-url
34+
attributes:
35+
label: Documentation URL
36+
description: If you have a URL to the problematic docs, please provide it.
37+
placeholder: Documentation URL
38+
- type: textarea
39+
id: reproduction-steps
40+
attributes:
41+
label: Steps to reproduce
42+
description: Please provide any reproduction steps that may need to be described.
43+
placeholder: Run `npm install` followed by `npm run dev`
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "\U0001F680 New feature proposal"
2+
description: Propose a new feature to be added to the Supabase JS Libraries
3+
labels: ['enhancement']
4+
type: Feature
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for your interest in the project and taking the time to fill out this feature report!
10+
- type: textarea
11+
id: feature-description
12+
attributes:
13+
label: Description
14+
description: 'Clear and concise description of the problem. Please make the reason and usecases as detailed as possible. If you intend to submit a PR for this issue, tell us in the description. Thanks!'
15+
placeholder: As a developer using the Supabase JS Libraries I want [goal / wish] so that [benefit].
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: suggested-solution
20+
attributes:
21+
label: Suggested solution
22+
description: 'In the library [xy] we could provide following implementation...'
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: alternative
27+
attributes:
28+
label: Alternative
29+
description: Clear and concise description of any alternative solutions or features you've considered.
30+
- type: textarea
31+
id: additional-context
32+
attributes:
33+
label: Additional context
34+
description: Any other context or screenshots about the feature request here.
35+
- type: checkboxes
36+
id: checkboxes
37+
attributes:
38+
label: Validations
39+
description: Before submitting the issue, please make sure you do the following
40+
options:
41+
- label: Follow our [Code of Conduct](https://github.com/supabase/.github/blob/main/CODE_OF_CONDUCT.md)
42+
required: true
43+
- label: Read the [Contributing Guidelines](https://github.com/supabase/supabase-js/blob/main/CONTRIBUTING.md).
44+
required: true
45+
- label: Read the [docs](https://supabase.com/docs/reference/javascript/introduction).
46+
required: true
47+
- label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
48+
required: true

0 commit comments

Comments
 (0)