Skip to content

Commit

Permalink
feat(build): add jsr.io distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Sep 10, 2024
1 parent 337f23e commit dc6157f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,21 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

jsr:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: npx jsr publish

cleanup:
needs:
- npm
- jsr
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -46,6 +58,7 @@ jobs:
github:
needs:
- npm
- jsr
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .postbump.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { version } = require('./package.json')
const updates = [
['./src/index.ts', /const VERSION = 'v\d+\.\d+\.\d+'/gm, `const VERSION = 'v${version}'`],
['./build/index.js', /const VERSION = 'v\d+\.\d+\.\d+'/gm, `const VERSION = 'v${version}'`, false],
['./README.md', /oauth4webapi@v\d+\.\d+\.\d+/gm, `oauth4webapi@v${version}`],
['./jsr.json', /"version": "\d+\.\d+\.\d+"/gm, `"version": "${version}"`],
]

for (const [path, regex, replace, gitAdd = true] of updates) {
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Support from the community to continue maintaining and improving this module is

## [API Reference](docs/README.md)

`oauth4webapi` is distributed via [npmjs.com](https://www.npmjs.com/package/oauth4webapi), [deno.land/x](https://deno.land/x/oauth4webapi), [cdnjs.com](https://cdnjs.com/libraries/oauth4webapi), [jsdelivr.com](https://www.jsdelivr.com/package/npm/oauth4webapi), and [github.com](https://github.com/panva/oauth4webapi).
`oauth4webapi` is distributed via [npmjs.com](https://www.npmjs.com/package/oauth4webapi), [jsr.io](https://jsr.io/@panva/oauth4webapi), [deno.land/x](https://deno.land/x/oauth4webapi), [cdnjs.com](https://cdnjs.com/libraries/oauth4webapi), [jsdelivr.com](https://www.jsdelivr.com/package/npm/oauth4webapi), and [github.com](https://github.com/panva/oauth4webapi).

## [Examples](examples/README.md)

Expand All @@ -43,12 +43,6 @@ Support from the community to continue maintaining and improving this module is
import * as oauth from 'oauth4webapi'
```

**`example`** Deno import

```js
import * as oauth from 'https://deno.land/x/oauth4webapi@v2.12.2/mod.ts'
```

- Authorization Code Flow (OAuth 2.0) - [source](examples/oauth.ts)
- Authorization Code Flow (OpenID Connect) - [source](examples/oidc.ts) | [diff](examples/oidc.diff)
- Extensions
Expand Down
13 changes: 13 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@panva/oauth4webapi",
"version": "2.12.2",
"exports": "./src/index.ts",
"publish": {
"include": [
"LICENSE.md",
"README.md",
"src/**/*.ts"
]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
],
"scripts": {
"_format": "find src test tap examples conformance -type f -name '*.ts' -o -name '*.mjs' -o -name '*.cjs' | xargs prettier",
"build": "rm -rf build && tsc && tsc --declaration true --emitDeclarationOnly true --removeComments false && tsc -p test && tsc -p examples && tsc -p conformance && tsc -p tap",
"build": "rm -rf build && tsc && tsc --declaration true --emitDeclarationOnly true --removeComments false && tsc -p test && tsc -p examples && tsc -p conformance && tsc -p tap && npx jsr publish --dry-run --allow-dirty",
"conformance": "bash -c 'source .node_flags.sh && ava --config conformance/ava.config.ts'",
"docs": "patch-package && typedoc",
"format": "npm run _format -- --write",
Expand Down

0 comments on commit dc6157f

Please sign in to comment.