Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,39 @@ jobs:
- name: Install modules
run: bun install


- name: Prepare to JSR publish
run: bun scripts/prepare-jsr.ts


- name: Type-check
run: tsc --noEmit
run: cd packages/jsx && tsc --noEmit



# - name: Run tests
# run: bun test
# env:
# TOKEN: ${{ secrets.BOT_TOKEN }}

- name: Build package
run: bun prepublishOnly
run: bun --cwd packages/jsx prepublishOnly

- name: Example Type-check
run: cd examples/example-bot && tsc --noEmit

- name: Run publint
run: bunx publint
working-directory: packages/jsx


# - name: Setup Deno
# uses: denoland/setup-deno@v1

# - name: Publish package to JSR
# if: ${{ github.event.inputs.publish_to_jsr }}
# run: deno publish --allow-dirty --unstable-sloppy-imports
# working-directory: packages/jsx

- name: Install Node
uses: actions/setup-node@v4
Expand All @@ -71,6 +81,7 @@ jobs:
- name: Publish package to NPM
if: ${{ github.event.inputs.publish_to_npm }}
run: npm publish --access public
working-directory: packages/jsx
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
Expand Down
128 changes: 73 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,67 +26,85 @@ Then in your **tsconfig.json**:
## Usage
```jsx
await context.reply(
(
<>
{/* Basic formatting */}
<b>Bold text</b>
<br />
<i>Italic text</i>
<br />
<u>Underlined text</u>
<br />
<s>Strikethrough</s>
<br />
<>
{/* Basic formatting */}
<b>Bold text</b>
<br />
<i>Italic text</i>
<br />
<u>Underlined text</u>
<br />
<s>Strikethrough</s>
<br />

{/* Spoiler with nested bold */}
<spoiler>
<b>Bold spoiler</b>
</spoiler>
<br />
{/* Spoiler with nested bold */}
<spoiler>
<b>Bold spoiler</b>
</spoiler>
<br />

{/* Links and mentions */}
<a href="https://example.com">example.com</a>
<br />
<mention id={context.from.id}>
Your ID: {context.from.id}
</mention>
<br />
{/* Links and mentions */}
<a href="https://example.com">example.com</a>
<br />
<mention id={context.from.id}>Your ID: {context.from.id}</mention>
<br />

{/* Code blocks */}
<code>print("Hello")</code>
<br />
<pre>
{`function greet() {
console.log("Hello, world!");
{/* Code blocks */}
<code>print("Hello")</code>
<br />
<pre>
{`function greet() {
console.log("Hello, world!");
}`}
</pre>
<br />
</pre>
<br />

{/* Blockquotes */}
<blockquote>Simple blockquote</blockquote>
<br />
<blockquote-expandable>
Expandable
<br />
blockquote
</blockquote-expandable>
<br />
{/* Blockquotes */}
<blockquote>Simple blockquote</blockquote>
<br />
<blockquote expandable>
Expandable
<br />
blockquote
<br />
Expandable
<br />
blockquote
<br />
Expandable
<br />
blockquote
</blockquote>
<br />

{/* Custom emoji */}
<custom-emoji emojiId="5222106016283378623">👍</custom-emoji>
</>
),
{
reply_markup: (
<keyboard>
<row>
<button callbackData="meow">Callback button</button>
<button url="https://example.com">Open link</button>
</row>
</keyboard>
),
}
);
{/* Custom emoji */}
<custom-emoji emojiId="5222106016283378623">👍</custom-emoji>
</>,
{
reply_markup: (
<keyboard inline>
<row>
<button callbackData="test">Normal</button>
<button url="https://example.com">Link</button>
</row>
<row>
<button
webApp={{ url: "https://example.com/" }}
>
WebApp
</button>
<button loginUrl={{ url: "https://example.com/login" }}>
Login
</button>
</row>
<row>
<button switchToChat="test">Switch</button>
<button switchToCurrentChat="test">Switch current</button>
</row>
</keyboard>
),
},
);
```

# Notes
Expand Down
15 changes: 15 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "jsx",
},
"examples/example-bot": {
"name": "example-jsx-bot",
"version": "0.0.1",
"dependencies": {
"@gramio/jsx": "workspace:*",
},
},
"packages/jsx": {
"name": "@gramio/jsx",
"version": "0.0.1",
"dependencies": {
"@gramio/types": "^9.0.1",
"gramio": "^0.4.11",
Expand Down Expand Up @@ -94,6 +105,8 @@

"@gramio/format": ["@gramio/format@0.3.3", "", { "dependencies": { "@gramio/types": "^9.1.3" }, "peerDependencies": { "marked": "^15.0.11" }, "optionalPeers": ["marked"] }, "sha512-92nqfr0X1jRsXoRdaSu6PS0b8jV5kgMobdj3F+7pHjV/dVn/H76h55+F3lYy44jLhjqQJwpRGwzVSL/+SvSEgA=="],

"@gramio/jsx": ["@gramio/jsx@workspace:packages/jsx"],

"@gramio/keyboards": ["@gramio/keyboards@1.2.1", "", { "dependencies": { "@gramio/types": "^9.0.1" } }, "sha512-HqCJl9HmLTvckA2fMRc+mC258vBr2zKfMqvFEGEgaeauIIP4n8TTT9GU4YCqVFTGTzGA5I6gnfk87dGZuSP6vA=="],

"@gramio/types": ["@gramio/types@9.2.3", "", {}, "sha512-DvqjO4rEoEeyyvZt4lj+fsp4Gchj9lOQB+5Zn8gjABhT+FBURzEMrHkvClatpVYICylhSTwK0PbvJCIeGuq18w=="],
Expand Down Expand Up @@ -192,6 +205,8 @@

"estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],

"example-jsx-bot": ["example-jsx-bot@workspace:examples/example-bot"],

"fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],

"fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="],
Expand Down
16 changes: 0 additions & 16 deletions deno.json

This file was deleted.

Loading