Skip to content

Commit 868c4a0

Browse files
authored
Merge branch 'master' into fix/trailing-slash
2 parents 5b4fcce + f9ef9f3 commit 868c4a0

22 files changed

+17885
-2923
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ jobs:
2424
run: |
2525
npm ci
2626
npm t
27+
28+
- name: Test & publish code coverage
29+
uses: paambaati/[email protected]
30+
env:
31+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
32+
with:
33+
coverageCommand: yarn run coverage
34+
coverageLocations: |
35+
${{github.workspace}}/test/coverage/lcov.info:lcov

README.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# `supabase-js`
22

3-
An isomorphic Javascript client for Supabase.
3+
An isomorphic JavaScript client for Supabase.
44

5-
- Documentation: https://supabase.io/docs/client/supabase-client
5+
**Documentation:** https://supabase.io/docs/client/supabase-client
66

77
## Usage
88

9+
First of all, you need to install the library:
10+
911
```sh
1012
npm install @supabase/supabase-js
1113
```
1214

15+
Then you're able to import the library and establish the connection with the database:
16+
1317
```js
1418
import { createClient } from '@supabase/supabase-js'
1519

@@ -19,22 +23,43 @@ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key
1923

2024
### UMD
2125

22-
You can now use plain `<script>`s to import supabase-js from CDNs, like
26+
You can now use plain `<script>`s to import supabase-js from CDNs, like:
27+
28+
```html
29+
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
30+
```
31+
32+
or even:
2333

24-
`<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>`
25-
or
26-
`<script src="https://unpkg.com/@supabase/supabase-js"></script>`.
34+
```html
35+
<script src="https://unpkg.com/@supabase/supabase-js"></script>
36+
```
2737

2838
Then you can use it from a global `supabase` variable:
2939

3040
```html
3141
<script>
32-
const { createClient } = supabase
33-
supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
34-
...
42+
const { createClient } = supabase
43+
const _supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
44+
45+
console.log('Supabase Instance: ', _supabase)
46+
// ...
3547
</script>
3648
```
3749

50+
### Custom `fetch` implementation
51+
52+
`supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:
53+
54+
```js
55+
import { createClient } from '@supabase/supabase-js'
56+
57+
// Provide a custom `fetch` implementation as an option
58+
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {
59+
fetch: (...args) => fetch(...args),
60+
})
61+
```
62+
3863
## Sponsors
3964

4065
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.

0 commit comments

Comments
 (0)