diff --git a/.dumirc.ts b/.dumirc.ts index ceec157..1a1f06f 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -23,16 +23,55 @@ const themeConfig = { match: ['/components'], pkg: name, sourceUrl: false, + type: 'doc', }, description: description, + docStyle: 'pure', footer: 'Made with ๐Ÿคฏ by LobeHub', + footerConfig: { + resources: { + items: [ + { + description: 'Markdown processor ', + openExternal: true, + title: 'Remark', + url: 'https://github.com/remarkjs', + }, + { + description: 'Concise badges', + openExternal: true, + title: 'Shields', + url: 'https://shields.io/', + }, + { + description: 'Icons for popular brands', + openExternal: true, + title: 'Simple Icons', + url: 'https://simpleicons.org', + }, + { + description: 'Dynamically stats for github', + openExternal: true, + title: 'Readme Stats', + url: 'https://github.com/anuraghazra/github-readme-stats', + }, + { + description: 'List of GitHub badges', + openExternal: true, + title: 'Awesome Badges', + url: 'https://github.com/Envoy-VC/awesome-badges', + }, + ], + title: 'Resources', + }, + }, giscus: { - category: 'Q&A', + category: 'Ideas', categoryId: 'DIC_kwDOJloKoM4CXsCu', - repo: 'lobehub/lobe-ui', - repoId: 'R_kgDOJloKoA', + repo: 'lobehub/lobe-readme-wizard', + repoId: 'R_kgDOKTF8TQ', }, - name: 'ReadmeGenerator', + name: 'ReadmeWizard', nav: [ { link: '/components/readme-hero', title: 'Generator' }, { link: 'https://simpleicons.org/', mode: 'override', title: 'Icons' }, @@ -42,7 +81,7 @@ const themeConfig = { discord: 'https://discord.gg/AYFPHvv2jT', github: homepage, }, - title: 'ReadmeGenerator - LobeHub', + title: 'ReadmeWizard - LobeHub', }; export default defineConfig({ @@ -75,5 +114,5 @@ export default defineConfig({ }`, ], themeConfig, - title: 'ReadmeGenerator', + title: 'ReadmeWizard', }); diff --git a/CHANGELOG.md b/CHANGELOG.md index ab079ce..0ab2057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,62 +2,50 @@ # Changelog -### [Version 0.2.1](https://github.com/lobehub/lobe-readme-generator/compare/v0.2.0...v0.2.1) -Released on **2023-09-18** +### [Version 0.2.1](https://github.com/lobehub/lobe-readme-generator/compare/v0.2.0...v0.2.1) +Released on **2023-09-18** #### ๐Ÿ› Bug Fixes - **misc**: Simple icon. -
- -
Improvements and Fixes - - #### What's fixed -* **misc**: Simple icon ([0bb612c](https://github.com/lobehub/lobe-readme-generator/commit/0bb612c)) +- **misc**: Simple icon ([0bb612c](https://github.com/lobehub/lobe-readme-generator/commit/0bb612c))
-
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
-## [Version 0.2.0](https://github.com/lobehub/lobe-readme-generator/compare/v0.1.0...v0.2.0) -Released on **2023-09-17** +## [Version 0.2.0](https://github.com/lobehub/lobe-readme-generator/compare/v0.1.0...v0.2.0) +Released on **2023-09-17** #### โœจ Features - **misc**: Add readme generator. -
- -
Improvements and Fixes - - #### What's improved -* **misc**: Add readme generator ([aad748d](https://github.com/lobehub/lobe-readme-generator/commit/aad748d)) +- **misc**: Add readme generator ([aad748d](https://github.com/lobehub/lobe-readme-generator/commit/aad748d))
-
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) diff --git a/README.md b/README.md index 3ad9f38..79b9cbe 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ - + -

Readme Generator

+

Readme Wizard

-\[WIP] Generate an aesthetically pleasing product README through intelligent methods +Generate lobe style product README _by MAGIC_ \~ ๐Ÿช„ [Changelog](./CHANGELOG.md) ยท [Report Bug][github-issues-link] ยท [Request Feature][github-issues-link] @@ -24,7 +24,7 @@ [![][github-issues-shield]][github-issues-link] [![][github-license-shield]][github-license-link] -![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png) +![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/268598243-0db9877a-ae3c-4250-8615-7d8b4f695169.png)
@@ -33,6 +33,7 @@ #### TOC +- [โœจ Features](#-features) - [โŒจ๏ธ Local Development](#๏ธ-local-development) - [๐Ÿค Contributing](#-contributing) - [๐Ÿ”— More Products](#-more-products) @@ -41,6 +42,33 @@ +## โœจ Features + +- [x] ๐Ÿ“ **Raedme Generator** + - [x] Hero + - [x] Features + - [x] Installation + - [x] Development + - [x] Contributing + - [x] Credits + - [x] License +- [x] ๐Ÿ”– **Shields Generator** + - [x] Custom + - [x] Website + - [x] Github + - [x] NPM + - [x] Vercel + - [x] Discord +- [ ] ๐Ÿ“ฆ Generator by `package.json` +- [ ] ๐Ÿช„ Generator features by openAI +- [ ] โŒจ๏ธ CLI tool support + +
+ +[![][back-to-top]](#readme-top) + +
+ ## โŒจ๏ธ Local Development You can use Github Codespaces for online development: @@ -52,7 +80,7 @@ Or clone it for local development: [![][bun-shield]][bun-link] ```bash -$ git clone https://github.com/lobehub/lobe-readme-generator.git +$ git clone https://github.com/lobehub/lobe-readme-wizard.git $ cd lobe-chat $ bun install $ bun dev @@ -104,30 +132,30 @@ This project is [MIT](./LICENSE) licensed. [back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-black?style=flat-square [bun-link]: https://bun.sh [bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun&style=for-the-badge -[codespaces-link]: https://codespaces.new/lobehub/lobe-readme-generator +[codespaces-link]: https://codespaces.new/lobehub/lobe-readme-wizard [codespaces-shield]: https://github.com/codespaces/badge.svg [discord-link]: https://discord.gg/AYFPHvv2jT [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square -[github-action-release-link]: https://github.com/lobehub/lobe-readme-generator/actions/workflows/release.yml -[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-readme-generator/release.yml?label=release&labelColor=black&logo=githubactions&logoColor=white&style=flat-square -[github-action-test-link]: https://github.com/lobehub/lobe-readme-generator/actions/workflows/test.yml -[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-readme-generator/test.yml?label=test&labelColor=black&logo=githubactions&logoColor=white&style=flat-square -[github-contrib-link]: https://github.com/lobehub/lobe-readme-generator/graphs/contributors -[github-contrib-shield]: https://contrib.rocks/image?repo=lobehub%2Flobe-readme-generator -[github-contributors-link]: https://github.com/lobehub/lobe-readme-generator/graphs/contributors -[github-contributors-shield]: https://img.shields.io/github/contributors/lobehub/lobe-readme-generator?color=c4f042&labelColor=black&style=flat-square -[github-forks-link]: https://github.com/lobehub/lobe-readme-generator/network/members -[github-forks-shield]: https://img.shields.io/github/forks/lobehub/lobe-readme-generator?color=8ae8ff&labelColor=black&style=flat-square -[github-issues-link]: https://github.com/lobehub/lobe-readme-generator/issues -[github-issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-readme-generator?color=ff80eb&labelColor=black&style=flat-square -[github-license-link]: https://github.com/lobehub/lobe-readme-generator/blob/main/LICENSE -[github-license-shield]: https://img.shields.io/github/license/lobehub/lobe-readme-generator?color=white&labelColor=black&style=flat-square -[github-release-link]: https://github.com/lobehub/lobe-readme-generator/releases -[github-release-shield]: https://img.shields.io/github/v/release/lobehub/lobe-readme-generator?logo=github&color=369eff&labelColor=black&style=flat-square -[github-releasedate-link]: https://github.com/lobehub/lobe-readme-generator/releases -[github-releasedate-shield]: https://img.shields.io/github/release-date/lobehub/lobe-readme-generator?labelColor=black&style=flat-square -[github-stars-link]: https://github.com/lobehub/lobe-readme-generator/network/stargazers -[github-stars-shield]: https://img.shields.io/github/stars/lobehub/lobe-readme-generator?color=ffcb47&labelColor=black&style=flat-square +[github-action-release-link]: https://github.com/lobehub/lobe-readme-wizard/actions/workflows/release.yml +[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-readme-wizard/release.yml?label=release&labelColor=black&logo=githubactions&logoColor=white&style=flat-square +[github-action-test-link]: https://github.com/lobehub/lobe-readme-wizard/actions/workflows/test.yml +[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-readme-wizard/test.yml?label=test&labelColor=black&logo=githubactions&logoColor=white&style=flat-square +[github-contrib-link]: https://github.com/lobehub/lobe-readme-wizard/graphs/contributors +[github-contrib-shield]: https://contrib.rocks/image?repo=lobehub%2Flobe-readme-wizard +[github-contributors-link]: https://github.com/lobehub/lobe-readme-wizard/graphs/contributors +[github-contributors-shield]: https://img.shields.io/github/contributors/lobehub/lobe-readme-wizard?color=c4f042&labelColor=black&style=flat-square +[github-forks-link]: https://github.com/lobehub/lobe-readme-wizard/network/members +[github-forks-shield]: https://img.shields.io/github/forks/lobehub/lobe-readme-wizard?color=8ae8ff&labelColor=black&style=flat-square +[github-issues-link]: https://github.com/lobehub/lobe-readme-wizard/issues +[github-issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-readme-wizard?color=ff80eb&labelColor=black&style=flat-square +[github-license-link]: https://github.com/lobehub/lobe-readme-wizard/blob/main/LICENSE +[github-license-shield]: https://img.shields.io/github/license/lobehub/lobe-readme-wizard?color=white&labelColor=black&style=flat-square +[github-release-link]: https://github.com/lobehub/lobe-readme-wizard/releases +[github-release-shield]: https://img.shields.io/github/v/release/lobehub/lobe-readme-wizard?logo=github&color=369eff&labelColor=black&style=flat-square +[github-releasedate-link]: https://github.com/lobehub/lobe-readme-wizard/releases +[github-releasedate-shield]: https://img.shields.io/github/release-date/lobehub/lobe-readme-wizard?labelColor=black&style=flat-square +[github-stars-link]: https://github.com/lobehub/lobe-readme-wizard/network/stargazers +[github-stars-shield]: https://img.shields.io/github/stars/lobehub/lobe-readme-wizard?color=ffcb47&labelColor=black&style=flat-square [lobe-chat]: https://github.com/lobehub/lobe-chat [lobe-commit]: https://github.com/lobehub/lobe-commit/tree/master/packages/lobe-commit [lobe-i18n]: https://github.com/lobehub/lobe-commit/tree/master/packages/lobe-i18n @@ -136,5 +164,5 @@ This project is [MIT](./LICENSE) licensed. [pr-welcome-link]: https://github.com/lobehub/lobe-chat/pulls [pr-welcome-shield]: https://img.shields.io/badge/๐Ÿคฏ_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge [profile-link]: https://github.com/lobehub -[vecel-link]: https://lobe-readme-generator.vercel.app -[vecel-shield]: https://img.shields.io/website?down_message=offline&label=vecel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https%3A%2F%2Flobe-readme-generator.vercel.app +[vecel-link]: https://lobe-readme-wizard.vercel.app +[vecel-shield]: https://img.shields.io/website?down_message=offline&label=vecel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https%3A%2F%2Flobe-readme-wizard.vercel.app diff --git a/docs/index.md b/docs/index.md index 37bca36..a4daf8b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,7 @@ --- hero: - title: Readme Generator - description: Generate an aesthetically pleasing product README through intelligent methods + title: Readme Wizard + description: Generate lobe style product README by MAGIC ~ ๐Ÿช„ --- diff --git a/docs/index.tsx b/docs/index.tsx index 6a604c6..122c378 100644 --- a/docs/index.tsx +++ b/docs/index.tsx @@ -1,5 +1,10 @@ +import { ReadmeHero } from '@lobehub/readme-generator'; import { Center } from 'react-layout-kit'; export default () => { - return
; + return ( +
+ +
+ ); }; diff --git a/package.json b/package.json index b388f15..9da9656 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "@lobehub/readme-generator", + "name": "@lobehub/readme-wizard", "version": "0.2.1", - "description": "Generate an aesthetically pleasing product README through intelligent methods", + "description": "Generate lobe style product README by magic", "homepage": "https://github.com/lobehub/lobe-readme-generator", "bugs": { - "url": "https://github.com/lobehub/lobe-readme-generator/issues/new/choose" + "url": "https://github.com/lobehub/lobe-readme-wizard/issues/new/choose" }, "repository": { "type": "git", - "url": "https://github.com/lobehub/lobe-readme-generator.git" + "url": "https://github.com/lobehub/lobe-readme-wizard.git" }, "license": "MIT", "author": "LobeHub ", diff --git a/src/ReadmeContributing/index.md b/src/ReadmeContributing/index.md index 578076d..3ddd86c 100644 --- a/src/ReadmeContributing/index.md +++ b/src/ReadmeContributing/index.md @@ -5,14 +5,4 @@ title: Contributing order: 6 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeContributing/index.tsx b/src/ReadmeContributing/index.tsx index 98ea842..7ea9d1b 100644 --- a/src/ReadmeContributing/index.tsx +++ b/src/ReadmeContributing/index.tsx @@ -2,7 +2,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; import { defaultControls } from '@/Readme/share'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genMarkdownContributing } from '@/services/genMarkdownContributing'; const controls = { diff --git a/src/ReadmeCredits/index.md b/src/ReadmeCredits/index.md index 361359d..ad078c3 100644 --- a/src/ReadmeCredits/index.md +++ b/src/ReadmeCredits/index.md @@ -5,14 +5,4 @@ title: Credits order: 6 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeCredits/index.tsx b/src/ReadmeCredits/index.tsx index 24e6130..9acc586 100644 --- a/src/ReadmeCredits/index.tsx +++ b/src/ReadmeCredits/index.tsx @@ -1,11 +1,32 @@ -import { memo } from 'react'; +import { useControls, useCreateStore } from '@lobehub/ui'; +import { memo, useMemo, useState } from 'react'; +import MarkdownEditor from '@/components/MarkdownEditor'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { creditsSample } from '@/const/sample'; -import MarkdownEditor from '@/features/MarkdownEditor'; -import { addBackToTop } from '@/utils/addBackTopTop'; +import { genMarkdownCredits } from '@/services/genMarkdownCredits'; + +const controls = { + /* eslint-disable sort-keys-fix/sort-keys-fix */ + title: 'Links', + backToTop: true, + /* eslint-enable */ +}; const Credits = memo(() => { - return {addBackToTop([creditsSample, '']).join('\n\n')}; + const [value, setValue] = useState(creditsSample); + const store = useCreateStore(); + + const options = useControls(controls, { store }); + + const md = useMemo(() => genMarkdownCredits(options, value), [value, options]); + + return ( + <> + + {md.join('\n\n')} + + ); }); export default Credits; diff --git a/src/ReadmeDevelopment/index.md b/src/ReadmeDevelopment/index.md index 6401f67..51afe7f 100644 --- a/src/ReadmeDevelopment/index.md +++ b/src/ReadmeDevelopment/index.md @@ -5,14 +5,4 @@ title: Development order: 4 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeDevelopment/index.tsx b/src/ReadmeDevelopment/index.tsx index 5fe90b5..ae1668e 100644 --- a/src/ReadmeDevelopment/index.tsx +++ b/src/ReadmeDevelopment/index.tsx @@ -2,7 +2,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; import { defaultControls } from '@/Readme/share'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genMarkdownDevelopment } from '@/services/genMarkdownDevelopment'; const controls = { diff --git a/src/ReadmeFeatures/index.md b/src/ReadmeFeatures/index.md index 43bd701..3d014a8 100644 --- a/src/ReadmeFeatures/index.md +++ b/src/ReadmeFeatures/index.md @@ -5,14 +5,4 @@ title: Features order: 2 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeFeatures/index.tsx b/src/ReadmeFeatures/index.tsx index e4c051f..ec5d2a7 100644 --- a/src/ReadmeFeatures/index.tsx +++ b/src/ReadmeFeatures/index.tsx @@ -1,11 +1,32 @@ -import { memo } from 'react'; +import { useControls, useCreateStore } from '@lobehub/ui'; +import { memo, useMemo, useState } from 'react'; +import MarkdownEditor from '@/components/MarkdownEditor'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { featuresSample } from '@/const/sample'; -import MarkdownEditor from '@/features/MarkdownEditor'; -import { addBackToTop } from '@/utils/addBackTopTop'; +import { genMarkdownFeatures } from '@/services/genMarkdownFeatures'; + +const controls = { + /* eslint-disable sort-keys-fix/sort-keys-fix */ + title: 'Features', + backToTop: true, + /* eslint-enable */ +}; const Features = memo(() => { - return {addBackToTop([featuresSample, '']).join('\n\n')}; + const [value, setValue] = useState(featuresSample); + const store = useCreateStore(); + + const options = useControls(controls, { store }); + + const md = useMemo(() => genMarkdownFeatures(options, value), [value, options]); + + return ( + <> + + {md.join('\n\n')} + + ); }); export default Features; diff --git a/src/ReadmeHero/index.md b/src/ReadmeHero/index.md index 5acda11..8650900 100644 --- a/src/ReadmeHero/index.md +++ b/src/ReadmeHero/index.md @@ -5,14 +5,4 @@ title: Hero order: 1 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeHero/index.tsx b/src/ReadmeHero/index.tsx index e2e831f..05b7aaf 100644 --- a/src/ReadmeHero/index.tsx +++ b/src/ReadmeHero/index.tsx @@ -2,8 +2,8 @@ import { folder, useControls, useCreateStore } from 'leva'; import { memo, useMemo } from 'react'; import { defaultControls, defaultControlsExtra } from '@/Readme/share'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; -import { genMarkdownHero } from '@/services/genMarkdonHero'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; +import { genMarkdownHero } from '@/services/genMarkdownHero'; const controls = { /* eslint-disable sort-keys-fix/sort-keys-fix */ diff --git a/src/ReadmeInstallation/index.md b/src/ReadmeInstallation/index.md index 008dcab..837c7c2 100644 --- a/src/ReadmeInstallation/index.md +++ b/src/ReadmeInstallation/index.md @@ -5,14 +5,4 @@ title: Installation order: 2 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeInstallation/index.tsx b/src/ReadmeInstallation/index.tsx index 7d7c6c8..70ef274 100644 --- a/src/ReadmeInstallation/index.tsx +++ b/src/ReadmeInstallation/index.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genMarkdownInstallation } from '@/services/genMarkdownInstallation'; const controls = { diff --git a/src/ReadmeLicense/index.md b/src/ReadmeLicense/index.md index 44bf08f..2f10a6f 100644 --- a/src/ReadmeLicense/index.md +++ b/src/ReadmeLicense/index.md @@ -5,14 +5,4 @@ title: License order: 7 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ReadmeLicense/index.tsx b/src/ReadmeLicense/index.tsx index e83e4ca..5f517dc 100644 --- a/src/ReadmeLicense/index.tsx +++ b/src/ReadmeLicense/index.tsx @@ -2,7 +2,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; import { defaultControls } from '@/Readme/share'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genMarkdownLicense } from '@/services/genMarkdownLicense'; const controls = { diff --git a/src/ShieldsCustom/Double.tsx b/src/ShieldsCustom/Double.tsx index 5a1cab7..5eff796 100644 --- a/src/ShieldsCustom/Double.tsx +++ b/src/ShieldsCustom/Double.tsx @@ -1,8 +1,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { shieldBaseControls } from '@/const/shieldBaseControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genCustomDoubleShield } from '@/services/genCustomShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsCustom/Single.tsx b/src/ShieldsCustom/Single.tsx index 3898128..14e1c16 100644 --- a/src/ShieldsCustom/Single.tsx +++ b/src/ShieldsCustom/Single.tsx @@ -1,8 +1,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { shieldBaseControls } from '@/const/shieldBaseControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genCustomSingleShield } from '@/services/genCustomShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsCustom/Website.tsx b/src/ShieldsCustom/Website.tsx index fb160b4..e5b9ee9 100644 --- a/src/ShieldsCustom/Website.tsx +++ b/src/ShieldsCustom/Website.tsx @@ -1,8 +1,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { shieldBaseControls } from '@/const/shieldBaseControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genCustomWebsiteShield } from '@/services/genCustomShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsCustom/index.md b/src/ShieldsCustom/index.md index 6a5880a..3bd3cac 100644 --- a/src/ShieldsCustom/index.md +++ b/src/ShieldsCustom/index.md @@ -7,20 +7,8 @@ order: 1 ## Custom Single -
- -
- ## Custom Double -
- - -
- -## Feedback - -
diff --git a/src/ShieldsDiscord/index.md b/src/ShieldsDiscord/index.md index 678301b..06b9cf4 100644 --- a/src/ShieldsDiscord/index.md +++ b/src/ShieldsDiscord/index.md @@ -7,12 +7,4 @@ order: 5 ## Generator [๐Ÿ”—](https://vimeo.com/364220040) -
- - -
- -## Feedback - -
diff --git a/src/ShieldsDiscord/index.tsx b/src/ShieldsDiscord/index.tsx index be70f1b..cd9b121 100644 --- a/src/ShieldsDiscord/index.tsx +++ b/src/ShieldsDiscord/index.tsx @@ -3,8 +3,8 @@ import { LevaInputs } from 'leva'; import { memo, useMemo } from 'react'; import { defaultControls } from '@/ShieldsCustom/share'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { shieldBaseControls } from '@/const/shieldBaseControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genCustomDiscordShield } from '@/services/genCustomShield'; const controls = { diff --git a/src/ShieldsGithub/Action.tsx b/src/ShieldsGithub/Action.tsx index fb072b4..62ec2ab 100644 --- a/src/ShieldsGithub/Action.tsx +++ b/src/ShieldsGithub/Action.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genGithubActionsShield } from '@/services/genGithubShield'; import { defaultControlsExtra } from './share'; diff --git a/src/ShieldsGithub/Codespace.tsx b/src/ShieldsGithub/Codespace.tsx index e8c51be..b52fd19 100644 --- a/src/ShieldsGithub/Codespace.tsx +++ b/src/ShieldsGithub/Codespace.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { GenGithubCodespaceShield } from '@/services/genGithubShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsGithub/Contributors.tsx b/src/ShieldsGithub/Contributors.tsx index 01128eb..17868bb 100644 --- a/src/ShieldsGithub/Contributors.tsx +++ b/src/ShieldsGithub/Contributors.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { GenGithubContributorsShield } from '@/services/genGithubShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsGithub/Release.tsx b/src/ShieldsGithub/Release.tsx index c4bf17c..24c5a18 100644 --- a/src/ShieldsGithub/Release.tsx +++ b/src/ShieldsGithub/Release.tsx @@ -2,8 +2,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { folder } from 'leva'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { githubReleaseControlsPickList } from '@/const/githubShieldControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genGithubReleaseShields } from '@/services/genGithubShield'; import { defaultControlsExtra } from './share'; diff --git a/src/ShieldsGithub/Social.tsx b/src/ShieldsGithub/Social.tsx index 2b33a33..29e9342 100644 --- a/src/ShieldsGithub/Social.tsx +++ b/src/ShieldsGithub/Social.tsx @@ -2,8 +2,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { folder } from 'leva'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { githubSoialControlsPickList } from '@/const/githubShieldControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genGithubSocialShields } from '@/services/genGithubShield'; import { defaultControlsExtra } from './share'; diff --git a/src/ShieldsGithub/StarHistory.tsx b/src/ShieldsGithub/StarHistory.tsx index 6333f12..9eb4eef 100644 --- a/src/ShieldsGithub/StarHistory.tsx +++ b/src/ShieldsGithub/StarHistory.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genGithubStarHistoryShield } from '@/services/genGithubShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsGithub/index.md b/src/ShieldsGithub/index.md index ef5ccb4..512cfdd 100644 --- a/src/ShieldsGithub/index.md +++ b/src/ShieldsGithub/index.md @@ -7,52 +7,24 @@ order: 2 ## Social -
- -
- ## Release -
- -
- ## Action -
- -
- ## Star History -
- -
- ## Codespace -
- -
- ## Contributors -
- - -
- -## Feedback - -
diff --git a/src/ShieldsNpm/index.md b/src/ShieldsNpm/index.md index a9599b9..e38deab 100644 --- a/src/ShieldsNpm/index.md +++ b/src/ShieldsNpm/index.md @@ -5,14 +5,4 @@ title: NPM order: 3 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ShieldsNpm/index.tsx b/src/ShieldsNpm/index.tsx index fdec7b4..1f462d4 100644 --- a/src/ShieldsNpm/index.tsx +++ b/src/ShieldsNpm/index.tsx @@ -2,8 +2,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { folder } from 'leva'; import { memo, useMemo } from 'react'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { npmReleaseControlsPickList } from '@/const/npmShieldControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genNpmReleaseShields } from '@/services/genNpmShield'; import { defaultControlsExtra } from './share'; diff --git a/src/ShieldsVercel/Deploy.tsx b/src/ShieldsVercel/Deploy.tsx index 6af9de9..20061ac 100644 --- a/src/ShieldsVercel/Deploy.tsx +++ b/src/ShieldsVercel/Deploy.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { GenVercelDeployShield } from '@/services/genVercelShield'; import { defaultControls } from './share'; diff --git a/src/ShieldsVercel/Website.tsx b/src/ShieldsVercel/Website.tsx index 211b049..6c6aea7 100644 --- a/src/ShieldsVercel/Website.tsx +++ b/src/ShieldsVercel/Website.tsx @@ -1,7 +1,7 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { genVercelWebsiteShield } from '@/services/genVercelShield'; const controls = { diff --git a/src/ShieldsVercel/index.md b/src/ShieldsVercel/index.md index 8507513..cc9a557 100644 --- a/src/ShieldsVercel/index.md +++ b/src/ShieldsVercel/index.md @@ -5,22 +5,10 @@ title: Vercel order: 4 --- -## Deploy - -
+## Deploy [๐Ÿ”—](https://vercel.com/docs/deployments/deploy-button) -
- ## Website -
- - -
- -## Feedback - -
diff --git a/src/ShieldsWebsite/index.md b/src/ShieldsWebsite/index.md index eceb248..8bb1ca3 100644 --- a/src/ShieldsWebsite/index.md +++ b/src/ShieldsWebsite/index.md @@ -5,14 +5,4 @@ title: Website order: 1 --- -## Generator - -
- - -
- -## Feedback - -
diff --git a/src/ShieldsWebsite/index.tsx b/src/ShieldsWebsite/index.tsx index 2d8259f..fe913ec 100644 --- a/src/ShieldsWebsite/index.tsx +++ b/src/ShieldsWebsite/index.tsx @@ -2,8 +2,8 @@ import { useControls, useCreateStore } from '@lobehub/ui'; import { memo, useMemo } from 'react'; import { defaultControls } from '@/ShieldsCustom/share'; +import MarkdownStorybook from '@/components/MarkdownStorybook'; import { shieldBaseControls } from '@/const/shieldBaseControls'; -import MarkdownStorybook from '@/features/MarkdownStorybook'; import { genCustomWebsiteShield } from '@/services/genCustomShield'; const controls = { diff --git a/src/components/Markdown/HighlightStyle.tsx b/src/components/Markdown/HighlightStyle.tsx index 40d7f11..1de4297 100644 --- a/src/components/Markdown/HighlightStyle.tsx +++ b/src/components/Markdown/HighlightStyle.tsx @@ -1,4 +1,4 @@ -import { FontLoader } from '@lobehub/ui'; +import { FontLoader, genCdnUrl } from '@lobehub/ui'; import { useThemeMode } from 'antd-style'; import { memo } from 'react'; @@ -7,11 +7,20 @@ const HighlightStyle = memo(() => { const isDarkMode = themeMode === 'auto' ? browserPrefers === 'dark' : themeMode === 'dark'; - const css = isDarkMode - ? 'https://esm.sh/highlight.js@11/styles/github-dark.css' - : 'https://esm.sh/highlight.js@11/styles/github.css'; - - return ; + return ( + <> + + + + ); }); export default HighlightStyle; diff --git a/src/features/MarkdownEditor/index.tsx b/src/components/MarkdownEditor/index.tsx similarity index 70% rename from src/features/MarkdownEditor/index.tsx rename to src/components/MarkdownEditor/index.tsx index 8278082..de3bad2 100644 --- a/src/features/MarkdownEditor/index.tsx +++ b/src/components/MarkdownEditor/index.tsx @@ -2,6 +2,7 @@ import { CodeEditor } from '@lobehub/ui'; import { Segmented } from 'antd'; import { memo, useState } from 'react'; import { Flexbox } from 'react-layout-kit'; +import useControlledState from 'use-merge-value'; import Markdown from '@/components/Markdown'; @@ -13,33 +14,38 @@ enum Tabs { Split = 'split', } -const MarkdownEditor = memo<{ children: string }>(({ children }) => { - const [tab, setTab] = useState(Tabs.Split); - const [code, setCode] = useState(children); +interface MarkdownEditorProps { + onChange: (text: string) => void; + value: string; +} + +const MarkdownEditor = memo(({ onChange, value }) => { + const [currentValue, setCurrentValue] = useControlledState(value, { + defaultValue: value, + onChange, + value, + }); + const [tab, setTab] = useState(Tabs.Editor); const { styles } = useStyles(); const editor = ( ); - const preview = {code}; + const preview = {currentValue}; return ( (({ children }) => { label: 'Preview', value: Tabs.Preview, }, + { + label: 'Split', + value: Tabs.Split, + }, ]} style={{ alignSelf: 'center' }} value={tab} diff --git a/src/features/MarkdownEditor/style.ts b/src/components/MarkdownEditor/style.ts similarity index 100% rename from src/features/MarkdownEditor/style.ts rename to src/components/MarkdownEditor/style.ts diff --git a/src/features/MarkdownPreivew/index.tsx b/src/components/MarkdownPreivew/index.tsx similarity index 100% rename from src/features/MarkdownPreivew/index.tsx rename to src/components/MarkdownPreivew/index.tsx diff --git a/src/features/MarkdownPreivew/style.ts b/src/components/MarkdownPreivew/style.ts similarity index 100% rename from src/features/MarkdownPreivew/style.ts rename to src/components/MarkdownPreivew/style.ts diff --git a/src/features/MarkdownStorybook/index.tsx b/src/components/MarkdownStorybook/index.tsx similarity index 100% rename from src/features/MarkdownStorybook/index.tsx rename to src/components/MarkdownStorybook/index.tsx diff --git a/src/features/MarkdownStorybook/style.ts b/src/components/MarkdownStorybook/style.ts similarity index 95% rename from src/features/MarkdownStorybook/style.ts rename to src/components/MarkdownStorybook/style.ts index 9e5e8aa..4e0f357 100644 --- a/src/features/MarkdownStorybook/style.ts +++ b/src/components/MarkdownStorybook/style.ts @@ -8,6 +8,7 @@ export const useStyles = createStyles(({ css, token }) => { overflow: hidden; width: 100%; + margin: 16px 0 32px; border-radius: ${token.borderRadiusLG}px; box-shadow: 0 0 0 1px ${token.colorBorder}; diff --git a/src/const/data.tsx b/src/const/data.tsx deleted file mode 100644 index 95e9717..0000000 --- a/src/const/data.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { Icon } from '@lobehub/ui'; -import { Bug, FileClock, GitFork, Github } from 'lucide-react'; - -import { homepage } from '@/../package.json'; - -export const Resources = [ - { - description: 'Markdown processor ', - openExternal: true, - title: 'Remark', - url: 'https://github.com/remarkjs', - }, - { - description: 'Concise badges', - openExternal: true, - title: 'Shields', - url: 'https://shields.io/', - }, - { - description: 'Icons for popular brands', - openExternal: true, - title: 'Simple Icons', - url: 'https://simpleicons.org', - }, - { - description: 'Dynamically stats for github', - openExternal: true, - title: 'Readme Stats', - url: 'https://github.com/anuraghazra/github-readme-stats', - }, - { - description: 'List of GitHub badges', - openExternal: true, - title: 'Awesome Badges', - url: 'https://github.com/Envoy-VC/awesome-badges', - }, -]; - -export const Community = [ - { - icon: , - openExternal: true, - title: 'Report Bug', - url: `${homepage}/issues/new/choose`, - }, - { - icon: , - openExternal: true, - title: 'Request Feature', - url: `${homepage}/issues/new/choose`, - }, -]; - -export const Help = [ - { - icon: , - openExternal: true, - title: 'GitHub', - url: homepage, - }, - { - icon: , - openExternal: true, - title: 'Changelog', - url: `${homepage}/blob/main/CHANGELOG.md`, - }, -]; - -export const MoreProducts = [ - { - description: 'OpenAI Chat Bot', - openExternal: true, - title: '๐Ÿค– Lobe Chat', - url: 'https://chat.lobehub.com', - }, - { - description: 'Stable Diffusion Webui Extension', - openExternal: true, - title: '๐Ÿคฏ Lobe Theme', - url: 'https://chat.lobehub.com', - }, - { - description: 'AIGC Components', - openExternal: true, - title: '๐Ÿญ Lobe UI', - url: 'https://ui.lobehub.com', - }, - { - description: 'AI Commit CLI', - openExternal: true, - title: '๐Ÿ’Œ Lobe Commit', - url: 'https://github.com/lobehub/lobe-commit', - }, - { - description: 'AI i18n CLI', - openExternal: true, - title: '๐ŸŒ Lobe i18n', - url: 'https://github.com/lobehub/lobe-commit', - }, -]; diff --git a/src/const/sample.ts b/src/const/sample.ts index b11e40f..afcc6ef 100644 --- a/src/const/sample.ts +++ b/src/const/sample.ts @@ -3,31 +3,20 @@ import urlJoin from 'url-join'; import { GITHUB_URL, SHIELD_BADGE_URL } from '@/const/url'; import { genShield } from '@/utils/genShield'; -export const featuresSample = `## โœจ Features - -- [x] ๐Ÿ’จ **Quick Deployment**: Using the Vercel platform, you can deploy with just one click and complete the process within 1 minute, without any complex configuration; +export const featuresSample = `- [x] ๐Ÿ’จ **Quick Deployment**: Using the Vercel platform, you can deploy with just one click and complete the process within 1 minute, without any complex configuration; - [x] ๐Ÿ’Ž **Exquisite UI Design**: With a carefully designed interface, it offers an elegant appearance and smooth interaction. It supports light and dark themes and is mobile-friendly. PWA support provides a more native-like experience; - [x] ๐Ÿ—ฃ๏ธ **Smooth Conversation Experience**: Fluid responses ensure a smooth conversation experience. It fully supports Markdown rendering, including code highlighting, LaTex formulas, Mermaid flowcharts, and more; -- [x] ๐Ÿงฉ **Plugin Support & Custom Plugin Development**: Conversations are extendable with plugins. Users can install and use various plugins, such as search engines, web extraction, etc. It also supports the development of custom plugins to meet custom needs; -- [x] ๐Ÿ”’ **Privacy Protection**: All data is stored locally in the user's browser, ensuring user privacy; -- [x] ๐Ÿค– **Customizable Assistant Roles**: Users can create, share, and debug personalized dialogue assistant roles according to their needs, providing more flexible and personalized dialogue functions; -- [x] ๐ŸŒ **Custom Domain**: If users have their own domain, they can bind it to the platform for quick access to the dialogue assistant from anywhere. -- [x] ๐Ÿฌ **Role Market**: A Role Market is provided where users can select their preferred dialogue assistant roles, enriching the content and style of the dialogue; `; -export const creditsSample = `## ๐Ÿ”— Links - -### More Products +export const creditsSample = `### More Products -- **[๐Ÿค– Lobe Chat][lobe-chat] :** An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application. -- **[๐ŸŒ Lobe i18n][lobe-i18n] :** Lobe i18n is an automation tool for the i18n (internationalization) translation process, powered by ChatGPT. It supports features such as automatic splitting of large files, incremental updates, and customization options for the OpenAI model, API proxy, and temperature. -- **[๐Ÿ’Œ Lobe Commit][lobe-commit] :** Lobe Commit is a CLI tool that leverages Langchain/ChatGPT to generate Gitmoji-based commit messages. +- **[๐Ÿค– Lobe Chat](https://github.com/lobehub/lobe-chat)** - An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application. +- **[๐Ÿคฏ Lobe theme](https://github.com/lobehub/sd-webui-lobe-theme)** - The modern theme for stable diffusion webui, exquisite interface design, highly customizable UI, and efficiency boosting features. ### Credits -- stable-diffusion-webui๏ผš -- gradio-theme-gallery: -- cozy-nest: +- **remark** - https://github.com/remarkjs/remark +- **shikiji** - https://github.com/antfu/shikiji `; export const bunShields = genShield( diff --git a/src/services/genMarkdownCredits.ts b/src/services/genMarkdownCredits.ts new file mode 100644 index 0000000..c84578a --- /dev/null +++ b/src/services/genMarkdownCredits.ts @@ -0,0 +1,14 @@ +import { addBackToTop } from '@/utils/addBackTopTop'; + +interface MarkdownCreditsOptions { + backToTop?: boolean; + title: string; +} + +export const genMarkdownCredits = (options: MarkdownCreditsOptions, value: string) => { + const { title, backToTop } = options; + + const content = [[`## ๐Ÿ”— ${title}`, value].join('\n\n'), '']; + + return backToTop ? addBackToTop(content) : content; +}; diff --git a/src/services/genMarkdownFeatures.ts b/src/services/genMarkdownFeatures.ts new file mode 100644 index 0000000..de9354a --- /dev/null +++ b/src/services/genMarkdownFeatures.ts @@ -0,0 +1,14 @@ +import { addBackToTop } from '@/utils/addBackTopTop'; + +interface MarkdownFeaturesOptions { + backToTop?: boolean; + title: string; +} + +export const genMarkdownFeatures = (options: MarkdownFeaturesOptions, value: string) => { + const { title, backToTop } = options; + + const content = [[`## โœจ ${title}`, value].join('\n\n'), '']; + + return backToTop ? addBackToTop(content) : content; +}; diff --git a/src/services/genMarkdonHero.ts b/src/services/genMarkdownHero.ts similarity index 70% rename from src/services/genMarkdonHero.ts rename to src/services/genMarkdownHero.ts index 239eeb0..5190046 100644 --- a/src/services/genMarkdonHero.ts +++ b/src/services/genMarkdownHero.ts @@ -20,22 +20,46 @@ interface MarkdownHeroOptions { workflow: string; } export const genMarkdownHero = (options: MarkdownHeroOptions) => { - const { logo, logo2, title, description, banner, workflow, packageName, backToTop } = options; + const { + logo, + logo2, + title, + description, + banner, + workflow, + packageName, + backToTop, + owner, + repo, + branch, + ...config + } = options; - const [releaseShields, releaseLinks] = genGithubReleaseShields(options, { - release: !packageName, - releaseDate: true, - }); + const [releaseShields, releaseLinks] = genGithubReleaseShields( + { owner, repo, ...config }, + { + release: !packageName, + releaseDate: true, + }, + ); const [npmShield, npmLinks] = packageName - ? genNpmReleaseShields(options, { - release: true, - }) + ? genNpmReleaseShields( + { packageName, ...config }, + { + release: true, + }, + ) : ['', '']; - const [workflowShields, workflowLinks] = workflow ? genGithubActionsShield(options) : ['', '']; + const [workflowShields, workflowLinks] = workflow + ? genGithubActionsShield({ owner, repo, workflow, ...config }) + : ['', '']; - const [socialShields, socialLinks] = genGithubSocialShields(options, githubSoialControlsPickList); + const [socialShields, socialLinks] = genGithubSocialShields( + { branch, owner, repo, ...config }, + githubSoialControlsPickList, + ); const logoGroup = logo2 ? [ @@ -51,7 +75,7 @@ export const genMarkdownHero = (options: MarkdownHeroOptions) => { const md = [ `
${backToTop ? '' : ''}`, logoGroup, - `# ${title}`, + `

${title}

`, description, shieldRows, '[Changelog](./CHANGELOG.md) ยท [Report Bug][github-issues-link] ยท [Request Feature][github-issues-link]', diff --git a/tsconfig.json b/tsconfig.json index bf8ff7e..9590e8d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,8 @@ "paths": { "@@/*": [".dumi/tmp/*"], "@/*": ["src/*"], - "@lobehub/readme-generator": ["src"], - "@lobehub/readme-generator/*": ["src/*"] + "@lobehub/readme-wizard": ["src"], + "@lobehub/readme-wizard/*": ["src/*"] }, "resolveJsonModule": true, "skipLibCheck": true,