Skip to content

Commit 57bc3cb

Browse files
Add package also to JSR
1 parent 2c98c0d commit 57bc3cb

23 files changed

+5920
-7597
lines changed

.github/workflows/lint.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ jobs:
1212
uses: actions/setup-node@v5
1313
with:
1414
node-version: 22
15-
cache: "npm"
15+
cache: 'npm'
16+
1617
- name: npm lint
1718
run: |
1819
npm ci
1920
npm run lint
21+
npm run lint:types
2022
env:
2123
CI: true
24+
25+
- name: Install Deno
26+
uses: denoland/setup-deno@v1
27+
with:
28+
deno-version: v1.x
29+
30+
- name: Deno lint
31+
run: deno lint
32+
- name: Deno check
33+
run: deno task check

.github/workflows/npm-publish.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@ on:
55
types: [created]
66

77
jobs:
8-
build:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v5
12-
- uses: actions/setup-node@v5
13-
with:
14-
node-version: 22
15-
- run: npm ci
16-
- run: npm test
17-
188
publish-npm:
19-
needs: build
209
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
2113
steps:
2214
- uses: actions/checkout@v5
2315
with:
@@ -27,21 +19,6 @@ jobs:
2719
node-version: 22
2820
registry-url: https://registry.npmjs.org/
2921
- run: npm ci
30-
- name: Get branch for tag
31-
id: get_branch
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
34-
run: |
35-
TAG_NAME="${GITHUB_REF#refs/tags/}"
36-
REPO="${GITHUB_REPOSITORY}"
37-
# Get the commit SHA for the tag
38-
TAG_SHA=$(gh api repos/$REPO/git/refs/tags/$TAG_NAME --jq .object.sha)
39-
# Fetch all branches and tags so we can search
40-
git fetch --all --tags
41-
# Find the first branch containing this commit
42-
BRANCH=$(git branch -r --contains "$TAG_SHA" | grep -v '\->' | head -n 1 | sed 's|origin/||' | xargs)
43-
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
44-
4522
- name: Set version from tag
4623
run: |
4724
git config user.name "github-actions[bot]"
@@ -53,10 +30,13 @@ jobs:
5330
git reset --hard "refs/tags/${TAG}" # Ensure code matches the tag
5431
git pull origin ${{ steps.get_branch.outputs.branch }}
5532
npm version $TAG --no-git-tag-version
56-
git add package.json package-lock.json
33+
jq '.version = "'$TAG'"' jsr.json > jsr.json.tmp && mv jsr.json.tmp jsr.json
34+
jq '.version = "'$TAG'"' deno.json > deno.json.tmp && mv deno.json.tmp deno.json
35+
git add package.json package-lock.json jsr.json deno.json
5736
git commit -m "ci: set version to $TAG [skip ci]" || true
5837
git push origin ${{ steps.get_branch.outputs.branch }}
5938
- run: npm run build --if-present
6039
- run: npm publish --access public
6140
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
41+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
42+
- run: npx jsr publish

deno.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@trojs/openapi-server",
3+
"version": "3.4.1",
4+
"license": "MIT",
5+
"exports": "./src/server.js",
6+
"compilerOptions": {
7+
"lib": [
8+
"esnext"
9+
]
10+
},
11+
"tasks": {
12+
"check": "deno check src/server.js"
13+
}
14+
}

jsconfig.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
{
22
"compilerOptions": {
3+
"allowJs": true,
34
"checkJs": true,
45
"target": "ESNext",
56
"module": "NodeNext",
67
"moduleResolution": "nodenext",
8+
"lib": [
9+
"ESNext"
10+
],
711
"rootDirs": [
8-
"src"
12+
"src",
13+
"types"
14+
],
15+
"baseUrl": ".",
16+
"resolveJsonModule": true,
17+
"types": [
18+
"node"
919
],
10-
"resolveJsonModule": true
20+
"skipLibCheck": true,
21+
"esModuleInterop": true,
22+
"noEmit": true
1123
},
24+
"include": [
25+
"src/**/*",
26+
"types/**/*"
27+
],
1228
"exclude": [
1329
"node_modules",
1430
"**/node_modules/*"

jsr.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@trojs/openapi-server",
3+
"version": "3.4.1",
4+
"license": "MIT",
5+
"exports": "./src/server.js"
6+
}

0 commit comments

Comments
 (0)