Skip to content

Commit b2c976b

Browse files
committed
Merge branch 'master' into chore/upgrade-postgrest-js-deps
2 parents 532121e + 6fbcfca commit b2c976b

Some content is hidden

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

75 files changed

+34832
-447
lines changed

.github/workflows/ci.yml

Lines changed: 258 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,277 @@ on:
1717
- '**/*.md'
1818
- '.prettierrc'
1919
- '**/*ignore'
20+
workflow_call:
21+
22+
env:
23+
NODE_VERSION: '20'
2024

2125
jobs:
26+
build-package:
27+
name: Build supabase-js package
28+
runs-on: ubuntu-latest
29+
outputs:
30+
tgz-name: ${{ steps.pack.outputs.filename }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ env.NODE_VERSION }}
38+
39+
- name: Install dependencies and build
40+
run: |
41+
npm ci
42+
npm run build
43+
npm run build:umd
44+
45+
- name: Pack npm module
46+
id: pack
47+
run: |
48+
PKG=$(npm pack)
49+
echo "filename=$PKG" >> "$GITHUB_OUTPUT"
50+
51+
- name: Upload .tgz package
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: supabase-tgz
55+
path: ${{ steps.pack.outputs.filename }}
56+
57+
- name: Upload UMD build
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: supabase-umd
61+
path: dist/umd/supabase.js
62+
2263
test:
23-
name: Test / OS ${{ matrix.os }} / Node ${{ matrix.node }}
64+
name: Unit + Type Check / Node.js ${{ matrix.node }} / OS ${{ matrix.os }}
65+
runs-on: ${{ matrix.os }}
2466
strategy:
2567
matrix:
26-
os: [ubuntu-latest]
27-
node: ['20']
28-
29-
runs-on: ${{ matrix.os }}
30-
68+
node: [20]
69+
os: [ubuntu-latest, macos-latest, windows-latest]
70+
fail-fast: false
3171
steps:
32-
- uses: actions/checkout@v4
72+
- name: Checkout code
73+
uses: actions/checkout@v4
3374

34-
- name: Set up Node
75+
- name: Setup Node.js
3576
uses: actions/setup-node@v4
3677
with:
3778
node-version: ${{ matrix.node }}
79+
cache: 'npm'
3880

39-
- name: Run tests
40-
run: |
41-
npm clean-install
42-
npm run test:coverage
81+
- name: Install dependencies
82+
run: npm ci
83+
84+
- name: Type Check
85+
run: npm run test:types
86+
87+
- name: Run Unit Tests + Coverage
88+
run: npm run test:coverage
4389

4490
- name: Upload coverage results to Coveralls
45-
uses: coverallsapp/github-action@master
91+
uses: coverallsapp/github-action@v2
4692
with:
4793
github-token: ${{ secrets.GITHUB_TOKEN }}
4894
path-to-lcov: ./test/coverage/lcov.info
95+
96+
deno-tests:
97+
name: Deno Tests / ${{ matrix.deno }}
98+
runs-on: ubuntu-latest
99+
strategy:
100+
matrix:
101+
deno: ['1.x', '2.x']
102+
fail-fast: false
103+
steps:
104+
- name: Checkout code
105+
uses: actions/checkout@v4
106+
107+
- name: Setup Deno
108+
uses: denoland/setup-deno@v2
109+
with:
110+
deno-version: ${{ matrix.deno }}
111+
112+
- name: Setup Supabase CLI
113+
uses: supabase/setup-cli@v1
114+
with:
115+
version: latest
116+
117+
- name: Setup Node.js
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: ${{ env.NODE_VERSION }}
121+
cache: 'npm'
122+
123+
- name: Start Supabase
124+
run: supabase start
125+
126+
- name: Install dependencies and build
127+
run: |
128+
npm ci
129+
npm run build
130+
131+
- name: Run Deno Tests
132+
run: |
133+
cd test/deno
134+
npm ci
135+
npm test || npm test
136+
137+
- name: Run integration and browser tests on Deno 2.x only
138+
if: ${{ matrix.deno == '2.x' }}
139+
run: npm run test:integration:browser
140+
141+
- name: Stop Supabase
142+
if: always()
143+
run: supabase stop
144+
145+
node-integration:
146+
name: Node Integration
147+
runs-on: ubuntu-latest
148+
needs: build-package
149+
steps:
150+
- name: Checkout code
151+
uses: actions/checkout@v4
152+
153+
- name: Setup Node.js
154+
uses: actions/setup-node@v4
155+
with:
156+
node-version: ${{ env.NODE_VERSION }}
157+
cache: 'npm'
158+
159+
- name: Setup Supabase CLI
160+
uses: supabase/setup-cli@v1
161+
with:
162+
version: latest
163+
164+
- name: Start Supabase
165+
run: supabase start
166+
167+
- name: Install dependencies and build
168+
run: |
169+
npm ci
170+
npm run build
171+
172+
- name: Run integration tests
173+
run: npm run test:integration || npm run test:integration
174+
175+
- name: Stop Supabase
176+
if: always()
177+
run: supabase stop
178+
179+
next-integration:
180+
name: Next.js Integration
181+
runs-on: ubuntu-latest
182+
needs: build-package
183+
steps:
184+
- name: Checkout code
185+
uses: actions/checkout@v4
186+
187+
- name: Setup Node.js
188+
uses: actions/setup-node@v4
189+
with:
190+
node-version: ${{ env.NODE_VERSION }}
191+
cache: 'npm'
192+
193+
- name: Setup Supabase CLI
194+
uses: supabase/setup-cli@v1
195+
with:
196+
version: latest
197+
198+
- name: Start Supabase
199+
run: supabase start
200+
201+
- name: Install Playwright browsers and dependencies
202+
run: npx playwright install --with-deps
203+
204+
- name: Run integration tests
205+
run: |
206+
cd test/integration/next
207+
npm ci
208+
npx playwright install
209+
npm run test
210+
211+
- name: Stop Supabase
212+
if: always()
213+
run: supabase stop
214+
215+
expo-tests:
216+
name: Expo Tests
217+
runs-on: ubuntu-latest
218+
needs: build-package
219+
steps:
220+
- name: Checkout code
221+
uses: actions/checkout@v4
222+
223+
- name: Setup Node.js
224+
uses: actions/setup-node@v4
225+
with:
226+
node-version: ${{ env.NODE_VERSION }}
227+
cache: 'npm'
228+
229+
- name: Setup Supabase CLI
230+
uses: supabase/setup-cli@v1
231+
with:
232+
version: latest
233+
234+
- name: Download artifact
235+
uses: actions/download-artifact@v4
236+
with:
237+
name: supabase-tgz
238+
path: ./supabase-pkg
239+
240+
- name: Start Supabase
241+
run: supabase start
242+
243+
- name: Install dependencies and run tests
244+
run: |
245+
cd test/integration/expo
246+
cp ../../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
247+
npm install
248+
npm test || npm test
249+
250+
- name: Stop Supabase
251+
if: always()
252+
run: supabase stop
253+
254+
websocket-browser-tests:
255+
name: WebSocket Browser Tests
256+
runs-on: ubuntu-latest
257+
needs: build-package
258+
steps:
259+
- name: Checkout code
260+
uses: actions/checkout@v4
261+
262+
- name: Setup Node.js
263+
uses: actions/setup-node@v4
264+
with:
265+
node-version: ${{ env.NODE_VERSION }}
266+
267+
- name: Download artifact
268+
uses: actions/download-artifact@v4
269+
with:
270+
name: supabase-umd
271+
path: ./dist/umd
272+
273+
- name: Setup Supabase CLI
274+
uses: supabase/setup-cli@v1
275+
with:
276+
version: latest
277+
278+
- name: Install Playwright browsers and dependencies
279+
run: npx playwright install --with-deps
280+
281+
- name: Start Supabase
282+
run: supabase start
283+
284+
- name: Run WebSocket tests
285+
run: |
286+
cd test/integration/node-browser
287+
npm install
288+
cp ../../../dist/umd/supabase.js .
289+
npm run test
290+
291+
- name: Stop Supabase
292+
if: always()
293+
run: supabase stop

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12+
test:
13+
uses: ./.github/workflows/ci.yml
14+
1215
release:
1316
name: Release / Node ${{ matrix.node }}
17+
needs: test
1418
strategy:
1519
matrix:
1620
node: ['20']

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ dist
105105
.tern-port
106106

107107
docs/v2
108+
109+
.cursor/

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
- **Documentation:** https://supabase.com/docs/reference/javascript/start
44
- TypeDoc: https://supabase.github.io/supabase-js/v2/
55

6-
> [!NOTE]
7-
> Do you want to help us shape the future of this library? [We're hiring](https://jobs.ashbyhq.com/supabase/85d07345-47c6-4980-82e2-57782f83ab4e).
8-
96
## Usage
107

118
First of all, you need to install the library:
@@ -86,6 +83,21 @@ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key
8683
})
8784
```
8885

86+
## Testing
87+
88+
### Unit Testing
89+
90+
```bash
91+
pnpm test
92+
```
93+
94+
### Integration Testing
95+
96+
```bash
97+
supabase start
98+
pnpm run test:integration
99+
```
100+
89101
## Badges
90102

91103
[![Coverage Status](https://coveralls.io/repos/github/supabase/supabase-js/badge.svg?branch=master)](https://coveralls.io/github/supabase/supabase-js?branch=master)

jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ const config: Config.InitialOptions = {
1414
'!**/vendor/**',
1515
'!**/vendor/**',
1616
],
17+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/examples/'],
1718
}
1819
export default config

0 commit comments

Comments
 (0)