Skip to content

Commit 0bd1e6d

Browse files
authored
ci: setup jsr publishing (#37)
1 parent 4bfdc3f commit 0bd1e6d

6 files changed

Lines changed: 34 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ jobs:
2727
- run: pnpm typecheck
2828

2929
- run: pnpm lint
30+
31+
- name: Verify JSR packaging
32+
run: pnpm dlx jsr publish --dry-run --allow-dirty

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ jobs:
129129
# TODO(@mandarini): add back --provenance once repo is OSS
130130
npm publish --access public --tag "${{ steps.version.outputs.tag }}"
131131
132+
- name: Publish to JSR
133+
if: ${{ steps.version.outputs.skip != 'true' }}
134+
continue-on-error: true
135+
run: npx jsr publish --allow-dirty
136+
132137
- name: Create GitHub pre-release
133138
if: ${{ steps.version.outputs.tag == 'rc' }}
134139
env:

jsr.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@supabase/server",
3+
"version": "0.1.4",
4+
"exports": {
5+
".": "./src/index.ts",
6+
"./core": "./src/core/index.ts",
7+
"./adapters/hono": "./src/adapters/hono/index.ts"
8+
},
9+
"publish": {
10+
"include": ["src/**/*.ts", "README.md", "LICENSE"],
11+
"exclude": ["src/**/*.test.ts", "src/**/*.spec.ts"]
12+
}
13+
}

release-please-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"release-type": "node",
55
"initial-version": "0.1.0",
66
"bump-minor-pre-major": true,
7-
"bump-patch-for-minor-pre-major": true
7+
"bump-patch-for-minor-pre-major": true,
8+
"extra-files": ["jsr.json"]
89
}
910
},
1011
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"

src/adapters/hono/middleware.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { MiddlewareHandler } from 'hono'
12
import { HTTPException } from 'hono/http-exception'
23
import { createMiddleware } from 'hono/factory'
34

@@ -30,7 +31,9 @@ import type { SupabaseContext, WithSupabaseConfig } from '../../types.js'
3031
* export default { fetch: app.fetch }
3132
* ```
3233
*/
33-
export function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>) {
34+
export function withSupabase(
35+
config?: Omit<WithSupabaseConfig, 'cors'>,
36+
): MiddlewareHandler<{ Variables: { supabaseContext: SupabaseContext } }> {
3437
return createMiddleware<{
3538
Variables: { supabaseContext: SupabaseContext }
3639
}>(async (c, next) => {

src/errors.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,28 @@ export const MissingSecretKeyError = 'MISSING_SECRET_KEY'
5757
export const MissingDefaultSecretKeyError = 'MISSING_DEFAULT_SECRET_KEY'
5858

5959
const EnvErrorMap = {
60-
[MissingSupabaseURLError]: () =>
60+
[MissingSupabaseURLError]: (): EnvError =>
6161
new EnvError(
6262
'SUPABASE_URL is required but not set',
6363
MissingSupabaseURLError,
6464
),
65-
[MissingSecretKeyError]: (name: string) =>
65+
[MissingSecretKeyError]: (name: string): EnvError =>
6666
new EnvError(
6767
`No "${name}" secret key found. Include a "${name}" entry in SUPABASE_SECRET_KEYS.`,
6868
MissingSecretKeyError,
6969
),
70-
[MissingDefaultSecretKeyError]: () =>
70+
[MissingDefaultSecretKeyError]: (): EnvError =>
7171
new EnvError(
7272
'No default secret key found. Set SUPABASE_SECRET_KEY or include a "default" entry in SUPABASE_SECRET_KEYS.',
7373
MissingDefaultSecretKeyError,
7474
),
7575

76-
[MissingPublishableKeyError]: (name: string) =>
76+
[MissingPublishableKeyError]: (name: string): EnvError =>
7777
new EnvError(
7878
`No "${name}" publishable key found. Include a "${name}" entry in SUPABASE_PUBLISHABLE_KEYS.`,
7979
MissingPublishableKeyError,
8080
),
81-
[MissingDefaultPublishableKeyError]: () =>
81+
[MissingDefaultPublishableKeyError]: (): EnvError =>
8282
new EnvError(
8383
'No default publishable key found. Set SUPABASE_PUBLISHABLE_KEY or include a "default" entry in SUPABASE_PUBLISHABLE_KEYS.',
8484
MissingDefaultPublishableKeyError,
@@ -140,9 +140,9 @@ export const InvalidCredentialsError = 'INVALID_CREDENTIALS'
140140
export const CreateSupabaseClientError = 'CREATE_SUPABASE_CLIENT_ERROR'
141141

142142
const AuthErrorMap = {
143-
[InvalidCredentialsError]: () =>
143+
[InvalidCredentialsError]: (): AuthError =>
144144
new AuthError('Invalid credentials', InvalidCredentialsError, 401),
145-
[CreateSupabaseClientError]: () =>
145+
[CreateSupabaseClientError]: (): AuthError =>
146146
new AuthError(
147147
'Failed to create Supabase client',
148148
CreateSupabaseClientError,

0 commit comments

Comments
 (0)