Skip to content

Commit 92ea276

Browse files
committed
feat: add publisher to JSR
1 parent b3b489f commit 92ea276

5 files changed

Lines changed: 51 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: workflow_dispatch
44

55
permissions:
66
contents: write
7+
id-token: write
78

89
jobs:
910
publish_package:
@@ -25,6 +26,15 @@ jobs:
2526
- name: Install modules
2627
run: bun install
2728

29+
- name: Prepare to JSR publish
30+
run: bun jsr
31+
32+
- name: Type-check
33+
run: tsc --noEmit
34+
35+
- name: Publish package to JSR
36+
run: bunx jsr publish --allow-dirty
37+
2838
- name: Install Node
2939
uses: actions/setup-node@v4
3040
with:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @gramio/callback-data
22

3+
Library for easily manage callback-data.
4+
5+
[![npm](https://img.shields.io/npm/v/@gramio/callback-data?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/@gramio/callback-data)
6+
[![JSR](https://jsr.io/badges/@gramio/callback-data)](https://jsr.io/@gramio/callback-data)
7+
[![JSR Score](https://jsr.io/badges/@gramio/callback-data/score)](https://jsr.io/@gramio/callback-data)
8+
39
WIP. JSON.stringify is temporarily used under the hood.
410

511
Use is not recommended at this stage!

deno.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@gramio/callback-data",
3+
"version": "0.0.2",
4+
"exports": "./src/index.ts",
5+
"publish": {
6+
"include": ["deno.json", "src", "README.md", "tsconfig.json"]
7+
}
8+
}

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77
"gramio": "^0.0.20",
88
"typescript": "^5.3.3"
99
},
10-
"description": "WIP",
10+
"description": "Library for easily manage callback-data",
1111
"files": [
1212
"dist"
1313
],
1414
"homepage": "https://github.com/gramiojs/",
1515
"keywords": [
16-
"gramio"
16+
"gramio",
17+
"callback-data",
18+
"telegram",
19+
"telegram-bot-api"
1720
],
1821
"readme": "https://gramio.netlify.app/",
1922
"scripts": {
20-
"prepublishOnly": "tsc && bunx tsc-alias"
23+
"prepublishOnly": "tsc && bunx tsc-alias",
24+
"jsr": "bun scripts/release-jsr.ts"
25+
},
26+
"repository": {
27+
"type": "git",
28+
"url": "git+https://github.com/gramiojs/callback-data"
2129
},
2230
"type": "commonjs"
2331
}

scripts/release-jsr.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { execSync } from "node:child_process";
2+
import fs from "node:fs";
3+
4+
const version = execSync("npm pkg get version")
5+
.toString()
6+
.replace(/"|\n/gi, "");
7+
8+
const jsrConfig = JSON.parse(String(fs.readFileSync("deno.json")));
9+
10+
jsrConfig.version = version;
11+
12+
fs.writeFileSync("deno.json", JSON.stringify(jsrConfig, null, 4));
13+
14+
execSync("bun x @teidesu/slow-types-compiler fix --entry deno.json");
15+
16+
console.log("Prepared to release on JSR!");

0 commit comments

Comments
 (0)