Skip to content

Commit 9f13e7e

Browse files
authored
rename: gotrue to auth (#820)
Renames GoTrue to Auth. `GoTrueClient` and `GoTrueAdminApi` still remain the main classes, but they're re-exported as `AuthClient` and `AuthAdminApi`.
1 parent 016ee66 commit 9f13e7e

13 files changed

+58
-34
lines changed

.github/workflows/release.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,20 @@ jobs:
2929
npm ci
3030
npm run build
3131
32-
- name: Create a release
32+
- name: Create a release for @supabase/auth-js
3333
run: npx semantic-release
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3636
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
- name: Create a release for @supabase/gotrue-js
39+
run: |
40+
for f in package.json package-lock.json
41+
do
42+
sed -i '' 's|\(["/]\)auth-js|\1gotrue-js|g' "$f"
43+
done
44+
45+
npx semantic-release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# `gotrue-js`
1+
# `auth-js`
22

3-
An isomorphic JavaScript client library for the [GoTrue](https://github.com/supabase/gotrue) API.
3+
An isomorphic JavaScript client library for the [Supabase Auth](https://github.com/supabase/auth) API.
44

55
## Docs
66

7-
- Using `gotrue-js`: https://supabase.com/docs/reference/javascript/auth-signup
8-
- TypeDoc: https://supabase.github.io/gotrue-js/v2
7+
- Using `auth-js`: https://supabase.com/docs/reference/javascript/auth-signup
8+
- TypeDoc: https://supabase.github.io/auth-js/v2
99

1010
## Quick start
1111

1212
Install
1313

1414
```bash
15-
npm install --save @supabase/gotrue-js
15+
npm install --save @supabase/auth-js
1616
```
1717

1818
Usage
1919

2020
```js
21-
import { GoTrueClient } from '@supabase/gotrue-js'
21+
import { AuthClient } from '@supabase/auth-js'
2222

2323
const GOTRUE_URL = 'http://localhost:9999'
2424

25-
const auth = new GoTrueClient({ url: GOTRUE_URL })
25+
const auth = new AuthClient({ url: GOTRUE_URL })
2626
```
2727

2828
- `signUp()`: https://supabase.io/docs/reference/javascript/auth-signup
@@ -31,14 +31,14 @@ const auth = new GoTrueClient({ url: GOTRUE_URL })
3131

3232
### Custom `fetch` implementation
3333

34-
`gotrue-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:
34+
`auth-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:
3535

3636
```js
37-
import { GoTrueClient } from '@supabase/gotrue-js'
37+
import { AuthClient } from '@supabase/auth-js'
3838

39-
const GOTRUE_URL = 'http://localhost:9999'
39+
const AUTH_URL = 'http://localhost:9999'
4040

41-
const auth = new GoTrueClient({ url: GOTRUE_URL, fetch: fetch })
41+
const auth = new AuthClient({ url: AUTH_URL, fetch: fetch })
4242
```
4343

4444
## Sponsors

example/react/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@supabase/gotrue-js": "file:../..",
6+
"@supabase/auth-js": "file:../..",
77
"@testing-library/jest-dom": "^4.2.4",
88
"@testing-library/react": "^9.5.0",
99
"@testing-library/user-event": "^7.2.1",

example/react/src/App.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { useEffect, useRef, useState } from 'react'
2-
import { GoTrueClient } from '@supabase/gotrue-js'
2+
import { AuthClient } from '@supabase/auth-js'
33
import './tailwind.output.css'
44

55
const supabaseURL = process.env.REACT_APP_SUPABASE_URL
66
const supabaseAnon = process.env.REACT_APP_SUPABASE_ANON_KEY
77

8-
const auth = new GoTrueClient({
8+
const auth = new AuthClient({
99
url: `${supabaseURL}/auth/v1`,
1010
headers: {
1111
accept: 'json',

infra/docker-compose.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: '3'
33
services:
44
gotrue: # Signup enabled, autoconfirm off
5-
image: supabase/gotrue:latest
5+
image: supabase/auth:v2.129.0
66
ports:
77
- '9999:9999'
88
environment:
@@ -42,7 +42,7 @@ services:
4242
- db
4343
restart: on-failure
4444
autoconfirm: # Signup enabled, autoconfirm on
45-
image: supabase/gotrue:latest
45+
image: supabase/auth:v2.129.0
4646
ports:
4747
- '9998:9998'
4848
environment:
@@ -71,7 +71,7 @@ services:
7171
- db
7272
restart: on-failure
7373
disabled: # Signup disabled
74-
image: supabase/gotrue:latest
74+
image: supabase/auth:v2.129.0
7575
ports:
7676
- '9997:9997'
7777
environment:

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "@supabase/gotrue-js",
2+
"name": "@supabase/auth-js",
33
"version": "0.0.0",
4-
"description": "Isomorphic GoTrue client",
4+
"description": "Official client library for Supabase Auth",
55
"keywords": [
6-
"gotrue",
6+
"auth",
77
"supabase",
88
"auth",
99
"authentication"
1010
],
11-
"homepage": "https://github.com/supabase/gotrue-js",
12-
"bugs": "https://github.com/supabase/gotrue-js/issues",
11+
"homepage": "https://github.com/supabase/auth-js",
12+
"bugs": "https://github.com/supabase/auth-js/issues",
1313
"license": "MIT",
1414
"author": "Supabase",
1515
"files": [
@@ -19,7 +19,7 @@
1919
"main": "dist/main/index.js",
2020
"module": "dist/module/index.js",
2121
"types": "dist/module/index.d.ts",
22-
"repository": "supabase/gotrue-js",
22+
"repository": "supabase/auth-js",
2323
"scripts": {
2424
"clean": "rimraf dist docs",
2525
"coverage": "echo \"run npm test\"",

src/AuthAdminApi.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import GoTrueAdminApi from './GoTrueAdminApi'
2+
3+
const AuthAdminApi = GoTrueAdminApi
4+
5+
export default AuthAdminApi

src/AuthClient.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import GoTrueClient from './GoTrueClient'
2+
3+
const AuthClient = GoTrueClient
4+
5+
export default AuthClient

src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import GoTrueAdminApi from './GoTrueAdminApi'
22
import GoTrueClient from './GoTrueClient'
3-
export { GoTrueAdminApi, GoTrueClient }
3+
import AuthAdminApi from './AuthAdminApi'
4+
import AuthClient from './AuthClient'
5+
export { GoTrueAdminApi, GoTrueClient, AuthAdminApi, AuthClient }
46
export * from './lib/types'
57
export * from './lib/errors'
68
export {

test/GoTrueApi.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ describe('GoTrueAdminApi', () => {
384384
test('signOut() with an invalid access token', async () => {
385385
const { error } = await serviceRoleApiClient.signOut('this-is-a-bad-token')
386386

387-
expect(error?.message).toMatch(/^Invalid token/)
387+
expect(error?.message).toMatch(/^invalid JWT/)
388388
})
389389
})
390390
})
@@ -420,7 +420,7 @@ describe('GoTrueAdminApi', () => {
420420
})
421421

422422
expect(user).toBeNull()
423-
expect(error?.message).toEqual('Invalid phone number format')
423+
expect(error?.message).toEqual('Invalid phone number format (E.164 required)')
424424
})
425425
})
426426
})

test/GoTrueClient.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ describe('GoTrueClient', () => {
360360
expect(data.session).toBeNull()
361361
expect(data.user).toBeNull()
362362

363-
expect(error?.message).toEqual('Error sending confirmation sms: Missing Twilio account SID')
363+
expect(error?.message).toEqual('Error sending confirmation sms: missing Twilio account SID')
364364
})
365365

366366
test('signUp() with phone', async () => {

0 commit comments

Comments
 (0)