diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 48d5239..cdcfb68 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,12 +44,17 @@ jobs: git config --global user.email "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" echo "GIT_USER=${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - run: pnpm release --type ${{ github.event.inputs.release_type || 'patch' }} + - run: | + TAG=`git describe --tags --abbrev=0` + RELEASE_LOG=$(<./releases/$TAG.md) - uses: fregante/release-with-changelog@v3 with: token: ${{ secrets.GITHUB_TOKEN }} commit-template: "- {title} ← {hash}" template: | ### Changelog + $RELEASE_LOG + ### PRs {commits} Full changelog: {range} See [Previous releases](https://github.com/vitalics/Telegraph/tree/main/releases) diff --git a/packages/docs/docs/tutorial/fmt/jsx.mdx b/packages/docs/docs/tutorial/fmt/jsx.mdx index bc7ab05..e70bf4d 100644 --- a/packages/docs/docs/tutorial/fmt/jsx.mdx +++ b/packages/docs/docs/tutorial/fmt/jsx.mdx @@ -72,3 +72,4 @@ Better to wrap high-level component with `Fragment` component from `preact` libr - Each reply context should be call `render` function. As for previous limitation `render` function only for your using context. - `render` function in `default` function should be called with `rest/spread` operator, since `reply` function accepts text modifications(like bold, underline, etc.) - not all components can be combined with children(e.g. `Bold` and `Italic` can be combined) +- do not crate component with many hierarchies. Better to use 1 hierary without depths. diff --git a/packages/fmt/common/command.tsx b/packages/fmt/common/command.tsx index ce431cf..88251c6 100644 --- a/packages/fmt/common/command.tsx +++ b/packages/fmt/common/command.tsx @@ -1,7 +1,7 @@ import { Fragment, h, JSX } from 'preact'; type Props = { - children: string | JSX.Element + name: string; }; /** @@ -16,6 +16,6 @@ type Props = { * @param {(S)} str command name * @return {*} string */ -export default function ({ children }: Props) { - return /{children} +export default function ({ name }: Props) { + return /{name} } diff --git a/packages/fmt/common/hash.tsx b/packages/fmt/common/hash.tsx index f4a4379..405a2e6 100644 --- a/packages/fmt/common/hash.tsx +++ b/packages/fmt/common/hash.tsx @@ -1,9 +1,9 @@ import { Fragment, h, JSX } from 'preact'; type Props = { - children: string | JSX.Element; + hash: string; }; -export default function ({ children }: Props) { - return #{children}; +export default function ({ hash }: Props) { + return #{hash}; } diff --git a/packages/fmt/common/mention.tsx b/packages/fmt/common/mention.tsx index 3bdc545..78d63c9 100644 --- a/packages/fmt/common/mention.tsx +++ b/packages/fmt/common/mention.tsx @@ -1,7 +1,7 @@ import { Fragment, h, JSX } from 'preact'; type Props = { - children: string; + username: string; }; /** @@ -13,6 +13,6 @@ type Props = { * some_user_name * // same as '@some_user_name' */ -export default function ({ children }: Props) { - return @{children}; +export default function ({ username }: Props) { + return @{username}; } diff --git a/packages/fmt/common/phone.tsx b/packages/fmt/common/phone.tsx index 0705ba3..43aa7b1 100644 --- a/packages/fmt/common/phone.tsx +++ b/packages/fmt/common/phone.tsx @@ -3,7 +3,7 @@ import toString from 'preact-render-to-string' import { parsePhoneNumber, type PhoneNumberFormat } from 'awesome-phonenumber'; export type Props = { - children: string | JSX.Element; + number: string | number | `+${number}`; format?: PhoneNumberFormat; /** * Region code for the phone number (only required if phoneNumber is on a national format). Example: 'SE' for Sweden, 'CH' for Switzerland, etc. @@ -25,15 +25,11 @@ export type Props = { * @return {string} Phone number */ export default function (props: Props) { - let phoneNumber: string; - if (typeof props.children === 'object') { - phoneNumber = toString(props.children); - } else { - phoneNumber = props.children.toString(); - } - const parsed = parsePhoneNumber(phoneNumber, props?.regionCode) + const phoneNumber = props.number.toString(); + + const parsed = parsePhoneNumber(phoneNumber, props?.regionCode); if (!parsed.isValid()) { - throw new TypeError(`Phone "${props.children}" number is not valid`) + throw new TypeError(`Phone "${phoneNumber}" number is not valid`) } return {parsed.getNumber(props?.format)}; } diff --git a/upcoming.md b/upcoming.md index 8b13789..700c74f 100644 --- a/upcoming.md +++ b/upcoming.md @@ -1 +1,13 @@ +## core +- add release log for new releases + +## packages + +[@tlgr/docs] + +- Add one more limitation about using JSX + +[@tlgr/fmt] + +- replace children properties from common components to another properties.