Skip to content

Commit 31b1ae3

Browse files
lucacasonatothorwebdev
and
thorwebdev
authored
feat: configure to publish to JSR (#82)
* chore: configure to publish to JSR * chore: exports and permissions. --------- Co-authored-by: thorwebdev <[email protected]>
1 parent 5af445a commit 31b1ae3

File tree

9 files changed

+120
-10
lines changed

9 files changed

+120
-10
lines changed

.github/workflows/release.yml

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717

1818
runs-on: ubuntu-latest
1919

20+
permissions:
21+
contents: read
22+
id-token: write
23+
2024
steps:
2125
- uses: actions/checkout@v4
2226

.releaserc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@semantic-release/commit-analyzer",
2222
"@semantic-release/release-notes-generator",
2323
"@semantic-release/github",
24-
"@semantic-release/npm"
24+
"@semantic-release/npm",
25+
"@sebbo2002/semantic-release-jsr"
2526
]
2627
}

jsr.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@supabase/functions-js",
3+
"version": "0.0.0-automated",
4+
"exports": {
5+
".": "./src/index.ts",
6+
"./edge-runtime.d.ts": "./src/edge-runtime.d.ts"
7+
}
8+
}

package-lock.json

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

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@supabase/node-fetch": "^2.6.14"
4040
},
4141
"devDependencies": {
42+
"@sebbo2002/semantic-release-jsr": "^1.0.0",
4243
"@types/jest": "^28.1.0",
4344
"@types/jsonwebtoken": "^8.5.8",
4445
"@types/node": "^18.7.0",

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export { FunctionsClient } from './FunctionsClient'
22
export {
3-
FunctionInvokeOptions,
3+
type FunctionInvokeOptions,
44
FunctionsError,
55
FunctionsFetchError,
66
FunctionsHttpError,
77
FunctionsRelayError,
88
FunctionRegion,
9-
FunctionsResponse
9+
type FunctionsResponse,
1010
} from './types'

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export type FunctionInvokeOptions = {
7171
/**
7272
* The Region to invoke the function in.
7373
*/
74-
region?: FunctionRegion;
74+
region?: FunctionRegion
7575
/**
7676
* The body of the request.
7777
*/

test/spec/params.spec.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe('params reached to function', () => {
248248
'custom-header': customHeader,
249249
Authorization: `Bearer ${apiKey}`,
250250
},
251-
region: FunctionRegion.Any
251+
region: FunctionRegion.Any,
252252
})
253253

254254
log('assert no error')
@@ -278,23 +278,25 @@ describe('params reached to function', () => {
278278
* @feature headers
279279
*/
280280
log('create FunctionsClient')
281-
const fclient = new FunctionsClient(`http://localhost:${relay.container.getMappedPort(8081)}`,{region: FunctionRegion.ApNortheast1})
281+
const fclient = new FunctionsClient(`http://localhost:${relay.container.getMappedPort(8081)}`, {
282+
region: FunctionRegion.ApNortheast1,
283+
})
282284

283285
log('invoke mirror')
284286
const customHeader = nanoid()
285-
286287

287288
const { data, error } = await fclient.invoke<MirrorResponse>('mirror', {
288289
headers: {
289290
'custom-header': customHeader,
290-
Authorization: `Bearer ${apiKey}`
291+
Authorization: `Bearer ${apiKey}`,
291292
},
292293
})
293294

294295
log('assert no error')
295296
expect(
296-
(data?.headers as [Array<string>]).filter(([k, v]) => k === 'x-region' && v === FunctionRegion.ApNortheast1)
297-
.length > 0
297+
(data?.headers as [Array<string>]).filter(
298+
([k, v]) => k === 'x-region' && v === FunctionRegion.ApNortheast1
299+
).length > 0
298300
).toBe(true)
299301
})
300302

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
"esModuleInterop": true,
1616
"moduleResolution": "Node",
17+
"isolatedModules": true,
1718

1819
"forceConsistentCasingInFileNames": true,
1920
"stripInternal": true,

0 commit comments

Comments
 (0)