Skip to content

Commit 17e4d43

Browse files
committed
wip: update dependency version and imports
1 parent 8421fe6 commit 17e4d43

16 files changed

Lines changed: 30 additions & 38 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ If you prefer package-style specifiers, add optional aliases for the surfaces yo
3434
"imports": {
3535
"@grammyjs/format/core": "https://denopkg.com/roziscoding/@grammyjs/format/src/core.ts",
3636
"@grammyjs/format/components": "https://denopkg.com/roziscoding/@grammyjs/format/src/components.ts",
37-
"@grammyjs/format/chaining": "https://denopkg.com/roziscoding/@grammyjs/format/src/chaining.ts",
38-
},
37+
"@grammyjs/format/chaining": "https://denopkg.com/roziscoding/@grammyjs/format/src/chaining.ts"
38+
}
3939
}
4040
```
4141

@@ -50,7 +50,7 @@ The examples below use these package-style specifiers; on Deno, either add the m
5050
This library only builds the message object. grammY already exposes the Bot API's `ctx.replyWithRichMessage`, so composing and sending stay separate — compose with any of the [APIs below](#the-three-apis), then hand the result to grammY:
5151

5252
```tsx
53-
import { Bot } from "grammy";
53+
import { Bot } from "@grammyjs/grammy";
5454
import { Bold, Paragraph, richMessage } from "@grammyjs/format/components";
5555

5656
const bot = new Bot(process.env.TELEGRAM_TOKEN!);
@@ -62,8 +62,7 @@ bot.command("start", (ctx) =>
6262
Hello, <Bold>{ctx.from?.first_name ?? "there"}!</Bold>
6363
</Paragraph>,
6464
),
65-
),
66-
);
65+
));
6766

6867
bot.start();
6968
```
@@ -139,14 +138,12 @@ const message = new RichMessage({ skipEntityDetection: true })
139138
.row((row) =>
140139
row
141140
.cell("Model", { header: true })
142-
.cell("Score", { header: true, align: "right" }),
141+
.cell("Score", { header: true, align: "right" })
143142
)
144143
.rows(results, (row, result) =>
145144
row
146145
.cell(result.model)
147-
.cell(bold(result.score), { align: "right" }),
148-
),
149-
);
146+
.cell(bold(result.score), { align: "right" })));
150147
```
151148

152149
A `RichMessage` instance `implements InputRichMessage`, so it goes straight to grammY (or any Bot API client) and serializes to the canonical value via `toJSON()`. Every functional block builder has a matching method, including media (`photo`, `video`, …) and containers (`blockQuote`, `collage`, `details`, …). Use `.add(block)` to append any pre-built block, and read the `blocks` getter for a snapshot that later mutations don't change.
@@ -169,8 +166,8 @@ For Deno, add the JSX runtime import alias so the compiler can resolve `jsxImpor
169166
```jsonc
170167
{
171168
"imports": {
172-
"@grammyjs/format/jsx/jsx-runtime": "https://denopkg.com/roziscoding/@grammyjs/format/src/components/jsx-runtime.ts",
173-
},
169+
"@grammyjs/format/jsx/jsx-runtime": "https://denopkg.com/roziscoding/@grammyjs/format/src/components/jsx-runtime.ts"
170+
}
174171
}
175172
```
176173

‎deno.jsonc‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"imports": {
1717
"@grammyjs/format/jsx/jsx-runtime": "./src/components/jsx-runtime.ts",
1818
"@grammyjs/format/jsx/jsx-dev-runtime": "./src/components/jsx-runtime.ts",
19+
"@grammyjs/grammy": "jsr:@grammyjs/grammy@2.0.0-beta.8",
1920
"@std/expect": "jsr:@std/expect@^1",
20-
"@std/testing": "jsr:@std/testing@^1",
21-
"grammy": "npm:grammy@^1.45.1"
21+
"@std/testing": "jsr:@std/testing@^1"
2222
},
2323
"tasks": {
2424
"check": "deno check --allow-import src/core.ts src/components.ts src/chaining.ts test/ examples/",
@@ -36,5 +36,7 @@
3636
"rules": {
3737
"exclude": ["explicit-function-return-type"]
3838
}
39-
}
39+
},
40+
// TODO: Remove this (?)
41+
"minimumDependencyAge": { "age": 0 }
4042
}

‎examples/bot.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Bot } from "grammy";
1+
import { Bot } from "@grammyjs/grammy";
22
import {
33
Bold,
44
Divider,

‎examples/core/slideshow.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Bot } from "grammy";
1+
import { Bot } from "@grammyjs/grammy";
22
import { divider, photo, richMessage, slideshow } from "../../src/core.ts";
33

44
const bot = new Bot(process.env.BOT_TOKEN!);

‎src/chaining/message.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
cloneValue,
4242
type RichMessageValue,
4343
} from "../core/values.ts";
44-
import type { InputRichMessage } from "grammy/types";
44+
import type { InputRichMessage } from "@grammyjs/grammy/types";
4545
import { TableBuilder, type TableConfigurator } from "./table.ts";
4646

4747
/**

‎src/chaining/table.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
type TableCellValue,
1313
type TableRowValue,
1414
} from "../core/values.ts";
15-
import type { InputRichBlockTable } from "grammy/types";
15+
import type { InputRichBlockTable } from "@grammyjs/grammy/types";
1616

1717
/**
1818
* Callback that populates a {@link TableRowBuilder}. Receives the row builder

‎src/components/blocks.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
InputMediaVoiceNote,
88
InputRichBlock,
99
Location,
10-
} from "grammy/types";
10+
} from "@grammyjs/grammy/types";
1111
import * as Blocks from "../core/blocks.ts";
1212
import type { RichTextInput } from "../core/text.ts";
1313
import type {

‎src/components/text.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Child } from "./jsx-runtime.ts";
22
import * as Text from "../core/text.ts";
33
import type { ChildrenProps, NoChildrenProps } from "./shared.ts";
44
import type { RichTextValue } from "../core/values.ts";
5-
import type * as grammY from "grammy/types";
5+
import type * as grammY from "@grammyjs/grammy/types";
66

77
function richChildren(children: Child): Text.RichTextInput[] {
88
return children === undefined ? [] : [children as Text.RichTextInput];

‎src/core/blocks.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
InputRichBlockListItem,
99
Location,
1010
RichBlockTableCell,
11-
} from "grammy/types";
11+
} from "@grammyjs/grammy/types";
1212
import {
1313
brand,
1414
type BlockValueOf,
@@ -115,7 +115,7 @@ export interface HeadingOptions {
115115
export function heading(
116116
options: HeadingOptions,
117117
...children: readonly RichTextInput[]
118-
): ReturnType<typeof block> {
118+
): BrandedValue<InputRichBlock, "block"> {
119119
return block({
120120
type: "heading",
121121
text: richText(children, "heading()"),

‎src/core/message.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { InputRichMessage } from "grammy/types";
1+
import type { InputRichMessage } from "@grammyjs/grammy/types";
22
import { brand, type RichMessageValue } from "../core/values.ts";
33
import { type BlockInput, blocks, splitOptions } from "./shared.ts";
44

0 commit comments

Comments
 (0)