Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add vitepress docs website #48

Merged
merged 9 commits into from
Oct 16, 2024

Conversation

Ares-Chang
Copy link
Member

@Ares-Chang Ares-Chang commented Oct 16, 2024

更新内容

添加了 vitepress 文档,梳理了使用指南。

PS

我想要调整一下仓库的结构及功能分组,改成 monorepo ,然后像 vueuse 类似把文档的读取生成抽离,方便做搜索。

当然,不包含在本 issuse 内,如果可以请告知。

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new scripts in package.json for documentation generation.
    • Added a comprehensive guide for using the @uni-helper/uni-use library.
    • Enhanced documentation site layout with a hero section and features highlight.
    • Added a new component to display team members on the documentation site.
  • Bug Fixes

    • Removed redundant return links from various documentation files to streamline navigation.
  • Chores

    • Updated .gitignore to exclude unnecessary files.
    • Marked useStorageAsync and useStorageSync as deprecated, recommending useStorage instead.

Copy link

coderabbitai bot commented Oct 16, 2024

Walkthrough

The changes in this pull request include updates to the .gitignore file to exclude specific build outputs and cache directories, particularly for Vitepress and Android. The package.json file has been modified to update the version, add new documentation scripts, and include new dependencies. A new configuration file for VitePress has been created, which sets up site settings and navigation. Additionally, several markdown files have been updated to enhance the documentation, including adding a function list and comprehensive guides, while some redundant links have been removed for clarity.

Changes

File Change Summary
.gitignore Added entries for cache (Vitepress) and *.keystore (Android).
package.json Updated version to 0.19.14, added documentation scripts, and included fast-glob and vitepress as dependencies.
src/.vitepress/config.ts New configuration file for VitePress with dynamic navigation and site settings.
src/apis/index.md Added a new section "函数列表" (Function List) with links to various functions.
src/guide/index.md Introduced a comprehensive guide for @uni-helper/uni-use, including installation and usage instructions.
src/guide/notice.md Provided guidelines and limitations for developers using uni-app.
src/index.md New home layout for the documentation site with hero and features sections.
src/readme.md Deleted file containing a list of functions.
src/tryOn*/*.md Removed "返回列表" (Return to List) links from multiple function documentation files.
src/use*/*.md Removed "返回列表" (Return to List) links from various utility function documentation files.
src/useStorageAsync/index.md Marked as deprecated, recommending useStorage instead.
src/useStorageSync/index.md Marked as deprecated, recommending useStorage instead.
src/useToast/index.md Removed "返回列表" (Return to List) links while retaining core content.
src/useUploadFile/index.md Removed "返回列表" (Return to List) links.
src/useVisible/index.md Removed "返回列表" (Return to List) links while retaining core content.

Poem

🐇 In the garden of code, we hop and play,
New scripts and guides brighten the way.
With functions aplenty, and links now refined,
Our documentation's clearer, and joyfully aligned!
So here’s to the changes, both big and small,
A leap for our project, let’s celebrate them all! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (18)
src/index.md (1)

31-58: Approve CSS styles with a minor suggestion for accessibility.

The CSS styles effectively enhance the visual presentation of the hero section, using gradient backgrounds and blur effects. The responsive design implemented through media queries is a good practice.

Consider adding a prefers-reduced-motion media query to disable or reduce animations for users who have requested reduced motion in their system settings. This improves accessibility. For example:

@media (prefers-reduced-motion: reduce) {
  :root {
    --vp-home-hero-image-filter: none;
  }
}
src/apis/index.md (1)

1-1: Consider clarifying language choice for the title

The title "函数列表" is in Chinese, while the rest of the content (function names) is in English. This might be inconsistent with the project's language guidelines.

Consider either:

  1. Translating the title to English: "Function List"
  2. Adding an English translation alongside the Chinese title: "函数列表 (Function List)"
  3. If the project is intended to be bilingual, consider adding English translations for all Chinese text throughout the documentation.

Please clarify the intended language approach for the documentation.

src/guide/index.md (5)

1-21: LGTM! Consider adding a version compatibility table.

The introduction and installation instructions are clear and comprehensive. Great job on including package manager-specific details and notes about @vueuse/core version compatibility.

Consider adding a version compatibility table that shows which versions of @uni-helper/uni-use are compatible with different versions of @vueuse/core. This could help users quickly determine which versions to use together.


23-33: LGTM! Consider expanding the usage example.

The usage section provides a clear, basic example of how to use the library. The reference to the full API documentation is helpful.

Consider expanding the usage example to show a more complete use case. For instance, you could demonstrate how tryOnLoad interacts with a Vue component or how it might be used in a typical uni-app scenario. This would give users a better understanding of how to integrate the library into their projects.


35-56: LGTM! Consider adding a brief explanation of auto-import benefits.

The configuration example for using @uni-helper/uni-use with unplugin-auto-import is clear and well-structured.

Consider adding a brief explanation of the benefits of using auto-import before the code example. This would help users understand why they might want to use this feature and how it can improve their development workflow.


62-64: Enhance the contribution guidelines.

While it's great to encourage contributions, this section could be more informative and helpful for potential contributors.

Consider expanding this section to include:

  1. A link to a CONTRIBUTING.md file (if one exists) or create one with detailed guidelines.
  2. Information about the project's coding standards and commit message conventions.
  3. Steps for setting up the development environment.
  4. The process for submitting a PR and getting it reviewed.
  5. Any specific areas where contributions are particularly welcome.

This additional information would make it easier for interested developers to contribute effectively to the project.


66-72: LGTM! Consider adding brief descriptions for each project.

The acknowledgments section is a great addition, showing appreciation for the projects that inspired and helped in the development of @uni-helper/uni-use.

Consider adding a brief description (1-2 sentences) for each listed project, explaining how they specifically inspired or contributed to @uni-helper/uni-use. This would give readers more context and potentially spark interest in exploring these projects further.

src/.vitepress/config.ts (4)

1-12: LGTM! Consider using top-level await explicitly.

The use of fast-glob for dynamic directory retrieval is a good practice. It will help maintain an up-to-date sidebar as the project structure evolves.

Consider explicitly declaring the use of top-level await:

-const files = await fg('*', {
+const files = await fg('*', {

This makes it clear that you're intentionally using a top-level await, which is a relatively new feature in JavaScript.


19-26: LGTM! Consider adding a base URL configuration.

The theme configuration for logo and navigation is well-structured and covers essential sections.

Consider adding a base configuration to the VitePress config if this documentation is not served from the root of a domain. This ensures that asset paths (like the logo) and navigation links work correctly in all deployment scenarios.

Example:

export default defineConfig({
  base: '/your-repo-name/',
  // ... other configurations
})

28-70: LGTM! Consider removing redundant Change Log link.

The sidebar configuration is well-structured and makes good use of dynamic generation for API links, which will help with maintainability as the project grows.

The Change Log link appears in both the navigation bar and the sidebar. Consider removing it from one of these locations to avoid redundancy. If you decide to keep it in both places, ensure that the URLs are consistent:

 {
   text: '更新日志',
-  link: 'https://github.com/uni-helper/uni-use/blob/main/CHANGELOG.md',
+  link: '/changelog',
 },

Then add a new markdown file at src/changelog.md that redirects to the GitHub changelog. This approach allows for future flexibility if you decide to host the changelog directly on your documentation site.


72-75: LGTM! Consider adding more community links.

The inclusion of a GitHub social link is great for open-source visibility.

Consider adding more community or social links if applicable, such as:

  • Discord or Slack for community discussions
  • Twitter for announcements
  • npm package link

Example:

socialLinks: [
  { icon: 'github', link: 'https://github.com/uni-helper/uni-use' },
  { icon: 'discord', link: 'https://discord.gg/your-server' },
  { icon: 'twitter', link: 'https://twitter.com/your-account' },
  { icon: 'npm', link: 'https://www.npmjs.com/package/your-package' },
],
src/guide/notice.md (4)

1-11: Enhance readability of the "Limitations" section

The content provides valuable information about the limitations of mini-programs and mobile applications. Consider the following suggestions to improve clarity and readability:

  1. Add a brief introductory sentence explaining the purpose of this document.
  2. Use bullet points consistently for all limitations.
  3. Consider adding examples or links to documentation for each limitation.

Here's a suggested revision for the opening lines:

# 注意事项 (Important Considerations)

This document outlines crucial guidelines and limitations for developers working with mini-programs and mobile applications using the `uni-app` framework.

## 限制 (Limitations)

In mini-program and mobile application environments, the following unavoidable limitations exist:

- Absence of certain global variables (e.g., `window`, `navigator`)
- Mandatory use of `uni-app` provided APIs for functionality (such as interceptors, storage)
  - APIs not supported by `uni-app` cannot be implemented (e.g., intercepting synchronous APIs, monitoring clipboard changes triggered elsewhere)
- Inability to use top-level `await`

For web development, it is recommended to use `vue` directly to avoid excessive environment checks and benefit from a richer ecosystem, including full support for `vueuse`.

13-60: Improve structure and clarity of the "Build" section

The build section contains valuable information but could benefit from better organization and clarity. Consider the following suggestions:

  1. Use subheadings to separate different aspects of the build process (e.g., "Transpilation", "Vite Configuration", "Polyfills", "WeChat Mini-Program Compatibility").
  2. Add brief explanations before code snippets to provide context.
  3. Consider using collapsible sections for code snippets to improve readability.

Here's a suggested structure for the build section:

## 构建 (Build)

### Transpilation
[Your existing content about unbuild and ES2017]

### Vite Configuration
For `vite + vue3` projects, set `build.target` to `ES6`. Here's an example configuration:

<details>
<summary>Vite Configuration Example</summary>

```typescript
[Your existing Vite configuration code]

Polyfills

Add polyfills in src/main.ts or src/main.js. Here's an example using core-js:

Polyfill Example
[Your existing polyfill code]

WeChat Mini-Program Compatibility

[Your existing content about WeChat mini-program compatibility]


This structure will make the document more scannable and easier to navigate.

---

`62-64`: **Enhance the "EventBus" section with additional context**

The EventBus section provides clear recommendations for alternative libraries. To improve user understanding, consider adding a brief explanation of why EventBus functionality is not included in this library.


Here's a suggested revision:

```markdown
## EventBus

This library does not provide EventBus functionality to maintain a focused scope and avoid duplicating features available in well-established libraries. If you need EventBus functionality, consider using one of the following alternatives:

- [VueUse - useEventBus](https://vueuse.org/core/useeventbus/#useeventbus)
- [mitt](https://github.com/developit/mitt)
- [nanoevents](https://github.com/ai/nanoevents)

These libraries offer robust EventBus implementations and are widely used in the Vue ecosystem.

This addition provides context for the decision and reinforces the recommendation to use established alternatives.


1-64: Overall assessment: Valuable content with room for improvement

This document provides crucial information for developers working with the uni-app framework. The content covers important aspects such as limitations, build process, and recommendations for EventBus functionality. While the information is valuable, consider the following overall improvements:

  1. Add a table of contents at the beginning of the document for easy navigation.
  2. Ensure consistent use of language (Chinese and English) throughout the document.
  3. Consider adding a "Troubleshooting" or "FAQ" section to address common issues developers might face.

To enhance the documentation structure, consider organizing it as follows:

  1. Introduction
  2. Table of Contents
  3. Limitations
  4. Build Process
    • Transpilation
    • Configuration
    • Polyfills
    • Compatibility
  5. Recommendations (including EventBus alternatives)
  6. Troubleshooting / FAQ
  7. Additional Resources

This structure will provide a more comprehensive and user-friendly guide for developers working with your library in the uni-app framework context.

.gitignore (1)

178-180: LGTM! Good additions to .gitignore

The new entries for Android keystore files and Vitepress cache are appropriate and align with best practices:

  1. Excluding *.keystore files enhances security by preventing sensitive signing information from being tracked in version control.
  2. Adding the Vitepress cache directory helps keep the repository clean of temporary build artifacts.

For consistency with the rest of the file, consider adding a comment above the Vitepress section:

 # Android
 *.keystore
 
+# Vitepress
 cache
package.json (2)

64-66: LGTM: New documentation scripts added.

The new scripts for VitePress documentation are well-structured and align with the PR objectives. They provide a complete set of commands for development, building, and previewing the documentation.

Consider adding a docs:serve script as an alias for docs:preview for consistency with other projects:

+ "docs:serve": "vitepress preview src"

This addition would provide a more intuitive command for serving the built documentation.


Line range hint 1-116: Overall assessment: Changes support VitePress documentation integration.

The modifications to package.json effectively support the integration of VitePress for documentation. The version update, new scripts, and addition of VitePress as a dependency are all appropriate. However, clarification is needed regarding the addition of fast-glob.

Consider the following recommendations for future improvements:

  1. Document the purpose of each new dependency in the project's contributing guidelines or README to aid future contributors.
  2. Implement a dependency management strategy to keep all dependencies up-to-date, which could include regular audits or automated update PRs.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d5c2e62 and de1d650.

⛔ Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • src/public/logo.png is excluded by !**/*.png
📒 Files selected for processing (46)
  • .gitignore (1 hunks)
  • package.json (3 hunks)
  • src/.vitepress/config.ts (1 hunks)
  • src/apis/index.md (1 hunks)
  • src/guide/index.md (1 hunks)
  • src/guide/notice.md (1 hunks)
  • src/index.md (1 hunks)
  • src/readme.md (0 hunks)
  • src/tryOnBackPress/index.md (0 hunks)
  • src/tryOnHide/index.md (0 hunks)
  • src/tryOnInit/index.md (0 hunks)
  • src/tryOnLoad/index.md (0 hunks)
  • src/tryOnReady/index.md (0 hunks)
  • src/tryOnScopeDispose/index.md (0 hunks)
  • src/tryOnShow/index.md (0 hunks)
  • src/tryOnUnload/index.md (0 hunks)
  • src/useActionSheet/index.md (0 hunks)
  • src/useClipboardData/index.md (0 hunks)
  • src/useDownloadFile/index.md (0 hunks)
  • src/useGlobalData/index.md (0 hunks)
  • src/useInterceptor/index.md (0 hunks)
  • src/useLoading/index.md (0 hunks)
  • src/useModal/index.md (0 hunks)
  • src/useNetwork/index.md (0 hunks)
  • src/useOnline/index.md (0 hunks)
  • src/usePage/index.md (0 hunks)
  • src/usePageScroll/index.md (0 hunks)
  • src/usePages/index.md (0 hunks)
  • src/usePreferredDark/index.md (0 hunks)
  • src/usePreferredLanguage/index.md (0 hunks)
  • src/usePrevPage/index.md (0 hunks)
  • src/usePrevRoute/index.md (0 hunks)
  • src/useProvider/index.md (0 hunks)
  • src/useRequest/index.md (0 hunks)
  • src/useRoute/index.md (0 hunks)
  • src/useRouter/index.md (0 hunks)
  • src/useScanCode/index.md (0 hunks)
  • src/useScreenBrightness/index.md (0 hunks)
  • src/useSelectorQuery/index.md (0 hunks)
  • src/useSocket/index.md (0 hunks)
  • src/useStorage/index.md (0 hunks)
  • src/useStorageAsync/index.md (0 hunks)
  • src/useStorageSync/index.md (0 hunks)
  • src/useToast/index.md (0 hunks)
  • src/useUploadFile/index.md (0 hunks)
  • src/useVisible/index.md (0 hunks)
💤 Files with no reviewable changes (39)
  • src/readme.md
  • src/tryOnBackPress/index.md
  • src/tryOnHide/index.md
  • src/tryOnInit/index.md
  • src/tryOnLoad/index.md
  • src/tryOnReady/index.md
  • src/tryOnScopeDispose/index.md
  • src/tryOnShow/index.md
  • src/tryOnUnload/index.md
  • src/useActionSheet/index.md
  • src/useClipboardData/index.md
  • src/useDownloadFile/index.md
  • src/useGlobalData/index.md
  • src/useInterceptor/index.md
  • src/useLoading/index.md
  • src/useModal/index.md
  • src/useNetwork/index.md
  • src/useOnline/index.md
  • src/usePage/index.md
  • src/usePageScroll/index.md
  • src/usePages/index.md
  • src/usePreferredDark/index.md
  • src/usePreferredLanguage/index.md
  • src/usePrevPage/index.md
  • src/usePrevRoute/index.md
  • src/useProvider/index.md
  • src/useRequest/index.md
  • src/useRoute/index.md
  • src/useRouter/index.md
  • src/useScanCode/index.md
  • src/useScreenBrightness/index.md
  • src/useSelectorQuery/index.md
  • src/useSocket/index.md
  • src/useStorage/index.md
  • src/useStorageAsync/index.md
  • src/useStorageSync/index.md
  • src/useToast/index.md
  • src/useUploadFile/index.md
  • src/useVisible/index.md
🧰 Additional context used
🔇 Additional comments (9)
src/index.md (1)

1-29: LGTM! Well-structured home page configuration.

The YAML front matter is well-organized and provides a clear structure for the home page. It effectively introduces UniUse with a hero section and highlights key features, aligning well with the PR objectives of introducing VitePress documentation.

src/apis/index.md (2)

3-39: Confirm intended ordering of the function list

The current list is organized first by prefix ("tryOn" and "use"), and then alphabetically within each prefix group. This organization improves readability by grouping related functions together.

Please confirm if this is the intended order. If a strict alphabetical order (ignoring prefixes) is preferred, consider reordering the list. Here's a script to check the current order and generate a strictly alphabetical order:

If you decide to change the order, please update the list accordingly.

✅ Verification successful

Function list is already in strict alphabetical order

The current list in src/apis/index.md is correctly ordered alphabetically. No changes are necessary.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check current order and generate alphabetical order

echo "Current order:"
grep -oP '(?<=\[)[^\]]+' src/apis/index.md

echo -e "\nStrictly alphabetical order:"
grep -oP '(?<=\[)[^\]]+' src/apis/index.md | sort

Length of output: 1146


3-39: Verify the existence of linked documentation files

The links to function documentation appear to follow a consistent pattern. However, it's crucial to ensure that all these linked files actually exist.

Please run the following script to verify the existence of all linked documentation files:

If any files are reported as missing, please create the corresponding documentation files or update the links accordingly.

✅ Verification successful

Please run the following updated script to verify the existence of all linked documentation files:


Please run the following updated script to verify the existence of all linked documentation files without using realpath:


Please run the following script to check for any removed or altered documentation links in src/apis/index.md:


All linked documentation files exist and no links were removed or altered.

The src/apis/index.md file accurately reflects the current state of the documentation without any missing or outdated links.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of all linked documentation files

# Extract the relative paths from the markdown file
grep -oP '\(.*\)' src/apis/index.md | tr -d '()' | while read -r path; do
  if [ ! -f "src/apis/$path" ]; then
    echo "Missing file: src/apis/$path"
  fi
done

Length of output: 2495


Script:

#!/bin/bash
# Description: Verify the existence of all linked documentation files with detailed logging

# Extract the relative paths from the markdown file
grep -oP '\(../[^)]+\)' src/apis/index.md | tr -d '()' | while read -r path; do
  # Resolve the absolute path
  resolved_path=$(realpath -m "src/apis/$path")
  if [ ! -f "$resolved_path" ]; then
    echo "Missing file: $resolved_path"
  else
    echo "Exists: $resolved_path"
  fi
done

Length of output: 8051


Script:

#!/bin/bash
# Description: Verify the existence of all linked documentation files without using realpath

# Extract the relative paths from the markdown file
grep -oP '\(../[^)]+\)' src/apis/index.md | tr -d '()' | while read -r path; do
  # Construct the path relative to the repository root
  file_path="src/apis/$path"
  
  if [ ! -f "$file_path" ]; then
    echo "Missing file: $file_path"
  else
    echo "Exists: $file_path"
  fi
done

Length of output: 7608


Script:

#!/bin/bash
# Description: Check for removed or altered documentation links in src/apis/index.md

# Get the lines removed in the latest commit for src/apis/index.md
git diff HEAD~1 HEAD -- src/apis/index.md | grep '^- ' || echo "No removed links detected."

Length of output: 119

src/guide/index.md (1)

58-60: LGTM! Clear and concise TypeScript information.

The TypeScript section effectively communicates that the library is developed with TypeScript and provides built-in type hints. This is valuable information for developers who prioritize type safety in their projects.

src/.vitepress/config.ts (2)

14-18: LGTM! Basic site configuration is well-defined.

The basic site configuration is appropriately set up with a title, description, and language specification for a Chinese documentation site.


1-76: Excellent VitePress configuration! Addresses PR objectives well.

This configuration file sets up a comprehensive and flexible documentation structure using VitePress. It aligns well with the PR objectives of introducing VitePress documentation and providing a structured usage guide.

Key strengths:

  1. Dynamic sidebar generation for easy maintenance
  2. Clear navigation structure
  3. Proper use of VitePress configuration options

Regarding the author's desire to reorganize the repository into a monorepo format:

  • The current configuration is flexible enough to accommodate future restructuring.
  • The use of fast-glob for dynamic directory retrieval will make it easier to adapt the documentation to any new structure.

For future consideration:

  • When implementing the monorepo structure, you may need to adjust the base configuration and file paths.
  • Consider setting up aliases or using relative imports to maintain clean import statements across the monorepo.

Overall, this configuration provides a solid foundation for the documentation site and can be easily adapted for future enhancements.

package.json (3)

Line range hint 3-3: LGTM: Version update is appropriate.

The version update to "0.19.14" is suitable for the documentation changes being introduced. It adheres to semantic versioning principles.


109-109: LGTM: VitePress added as a devDependency.

The addition of VitePress (version ^1.4.0) as a devDependency is appropriate and aligns with the PR objective of creating a VitePress documentation website. The version is recent, which is good for security and access to the latest features.


97-97: Please clarify the purpose of adding fast-glob.

The addition of "fast-glob" as a devDependency is noted. While it's a useful utility for file system operations, it's not immediately clear from the context why it's needed for this project.

Could you please explain the intended use of fast-glob in this project? This will help ensure it's necessary and being used appropriately.

src/index.md Outdated
Comment on lines 19 to 28
features:
- icon: 🎛
title: 功能丰富
details: 提供了丰富的功能,封装了 uni-app 中常用的功能。
- icon: 💚
title: 开箱即用
details: 开箱即用的支持了 uni-app Vue3 的 Composition API。
- icon: 🦾
title: 功能丰富
details: 所有函数都支持 TS 类型推导,无需手动标注类型
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix inconsistency in features section.

There's a minor inconsistency in the features section. The third feature (lines 26-28) has the same title as the first one ("功能丰富"), but the details describe TypeScript support.

Consider updating the title to better reflect the TypeScript support feature:

  - icon: 🦾
-   title: 功能丰富
+   title: 类型支持
    details: 所有函数都支持 TS 类型推导,无需手动标注类型
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
features:
- icon: 🎛
title: 功能丰富
details: 提供了丰富的功能,封装了 uni-app 中常用的功能。
- icon: 💚
title: 开箱即用
details: 开箱即用的支持了 uni-app Vue3 的 Composition API。
- icon: 🦾
title: 功能丰富
details: 所有函数都支持 TS 类型推导,无需手动标注类型
features:
- icon: 🎛
title: 功能丰富
details: 提供了丰富的功能,封装了 uni-app 中常用的功能。
- icon: 💚
title: 开箱即用
details: 开箱即用的支持了 uni-app Vue3 的 Composition API。
- icon: 🦾
title: 类型支持
details: 所有函数都支持 TS 类型推导,无需手动标注类型

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
src/.vitepress/theme/index.ts (2)

8-14: LGTM: Theme object structure is correct, but consider utilizing custom slots.

The exported theme object correctly extends the DefaultTheme and satisfies the Theme type, which is great for type safety. The Layout function is properly set up to use the DefaultTheme's Layout.

However, the Layout function currently doesn't utilize any custom slots. Consider if you need to add any custom content to the layout. If not, you could simplify this to:

Layout: DefaultTheme.Layout,

If you do plan to add custom slots later, you might want to add a TODO comment to remind yourself.


15-17: LGTM: enhanceApp method correctly registers the HomeTeam component.

The enhanceApp method properly registers the HomeTeam component globally, which is valid for components used across multiple pages.

However, consider if this component truly needs global registration. If it's only used in specific locations, you might want to import and use it locally in those components or pages instead. This can lead to better code organization and potentially improved performance.

src/.vitepress/components/HomeTeam.vue (1)

4-21: Consider enhancing team member information

The teamMembers array is well-structured and provides essential information. To improve it further:

  1. Consider adding more social links or contact information for each team member (e.g., Twitter, LinkedIn, or email).
  2. You could provide more specific information about each member's contributions or areas of expertise in the title field.

Example enhancement:

{
  avatar: 'https://github.com/ModyQyW.png',
  name: 'ModyQyW',
  title: 'Author & Core Developer',
  links: [
    { icon: 'github', link: 'https://github.com/ModyQyW' },
    { icon: 'twitter', link: 'https://twitter.com/ModyQyW' },
  ],
}
src/.vitepress/theme/style.css (1)

77-87: Namespace Button Variables for Better Maintainability

The button component variables are defined in the :root selector from lines 77-87. To improve maintainability and prevent potential variable conflicts, consider namespacing these variables under a more specific selector or prefixing them to indicate their association with the button component.

For example:

-:root {
-  --vp-button-brand-border: transparent;
-  --vp-button-brand-text: var(--vp-c-white);
-  --vp-button-brand-bg: var(--vp-c-brand-3);
-  ...
-}
+.button-component {
+  --vp-button-brand-border: transparent;
+  --vp-button-brand-text: var(--vp-c-white);
+  --vp-button-brand-bg: var(--vp-c-brand-3);
+  ...
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between de1d650 and 13a372b.

📒 Files selected for processing (5)
  • src/.vitepress/components/HomeTeam.vue (1 hunks)
  • src/.vitepress/config.ts (1 hunks)
  • src/.vitepress/theme/index.ts (1 hunks)
  • src/.vitepress/theme/style.css (1 hunks)
  • src/index.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/.vitepress/config.ts
  • src/index.md
🧰 Additional context used
🔇 Additional comments (4)
src/.vitepress/theme/index.ts (2)

1-6: LGTM: Imports are appropriate and well-structured.

The import statements are correctly set up for creating a custom VitePress theme. They include necessary types, the default theme for extension, Vue's h function for virtual DOM manipulation, and a custom component. The CSS import also ensures proper styling.


1-18: LGTM: Overall theme implementation is well-structured and follows best practices.

The custom VitePress theme is implemented correctly by extending the default theme. The code is concise, focused on necessary customizations, and follows VitePress theme customization best practices. Proper use of imports, exports, and type assertions ensures type safety and maintainability.

Great job on setting up this custom theme! It provides a solid foundation for further customizations as needed.

src/.vitepress/components/HomeTeam.vue (2)

1-2: LGTM: Proper setup for Vue 3 with TypeScript

The script setup and import are correctly implemented for a Vue 3 component using TypeScript and VitePress theme components.


1-31: Overall assessment: Well-structured component with room for enhancements

The HomeTeam component is well-implemented and serves its purpose effectively. It correctly uses the VitePress theme components and provides a clear structure for displaying team members. The suggestions provided in the previous comments will help improve maintainability, internationalization support, and the overall user experience. These enhancements align well with the PR objectives of introducing a comprehensive VitePress documentation structure.

Comment on lines +24 to +31
<template>
<div>
<h2 style="text-align: center;">
团队成员
</h2>
<VPTeamMembers size="small" :members="teamMembers" />
</div>
</template>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve template structure and i18n support

The template structure is functional, but there are a few areas for improvement:

  1. Instead of using inline styles, consider using CSS classes for better maintainability:
-    <h2 style="text-align: center;">
+    <h2 class="team-heading">

Then add a <style> section:

<style scoped>
.team-heading {
  text-align: center;
}
</style>
  1. For better internationalization support, consider using a translation function for the heading text:
<h2 class="team-heading">{{ t('teamMembers') }}</h2>

This assumes you have set up i18n in your VitePress configuration.

  1. You might want to add some spacing between the heading and the team members list for better visual separation.

Comment on lines 144 to 169
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
315deg,
#42d392 25%,
#647eff
);
--vp-home-hero-image-background-image: linear-gradient(
-45deg,
#41b88380 30%,
#35495e80
);
--vp-home-hero-image-filter: blur(30px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(72px);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove Duplicate Home Component Variable Definitions

The --vp-home-hero-* variables and associated media queries are defined twice in the file:

  • First definition: Lines 93-119
  • Duplicate definition: Lines 144-169

This duplication can lead to confusion and potential styling conflicts. Please remove the duplicate block to maintain clarity and prevent unintended overrides.

Apply this diff to remove the duplicate definitions:

-/**
- * Component: Home
- * -------------------------------------------------------------------------- */
-
- :root {
-  --vp-home-hero-name-color: transparent;
-  --vp-home-hero-name-background: -webkit-linear-gradient(
-    315deg,
-    #42d392 25%,
-    #647eff
-  );
-  --vp-home-hero-image-background-image: linear-gradient(
-    -45deg,
-    #41b88380 30%,
-    #35495e80
-  );
-  --vp-home-hero-image-filter: blur(30px);
-}
-
-@media (min-width: 640px) {
-  :root {
-    --vp-home-hero-image-filter: blur(56px);
-  }
-}
-
-@media (min-width: 960px) {
-  :root {
-    --vp-home-hero-image-filter: blur(72px);
-  }
-}

If both blocks are intended for different themes or contexts, consider commenting accordingly or organizing them into separate files.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
315deg,
#42d392 25%,
#647eff
);
--vp-home-hero-image-background-image: linear-gradient(
-45deg,
#41b88380 30%,
#35495e80
);
--vp-home-hero-image-filter: blur(30px);
}
@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}
@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(72px);
}
}

Comment on lines +125 to +130
:root {
--vp-custom-block-tip-border: transparent;
--vp-custom-block-tip-text: var(--vp-c-text-1);
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Custom Block Tip Variables Are Not Used

The custom block tip variables defined in src/.vitepress/theme/style.css are not utilized in any styles within the codebase. Consider removing these unused variables to maintain clean and efficient code.

🔗 Analysis chain

Verify Usage of Custom Block Tip Variables

The custom block tip variables are defined from lines 125-130. Please ensure these variables are utilized in the styles for custom blocks to achieve the intended design.

Run the following script to confirm the usage of these variables:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that custom block tip variables are used in the styles.

# Test: Search for the custom block tip variables in CSS files.
rg --type css '\-\-vp-custom-block-tip-' src/

Length of output: 47


Script:

#!/bin/bash
# Description: Confirm the definitions of custom block tip variables.

# Test: Display the lines where the custom block tip variables are defined.
grep -- '--vp-custom-block-tip-' src/.vitepress/theme/style.css

Length of output: 267


Script:

#!/bin/bash
# Description: Search for the usage of custom block tip variables across all relevant file types.

# Test: Search for the custom block tip variables in all files that could use them.
rg '\-\-vp-custom-block-tip-' src/ --type-add 'vue:*.vue' --type-add 'js:*.js' --type-add 'ts:*.ts' --type-add 'scss:*.scss'

Length of output: 126


Script:

#!/bin/bash
# Description: Search for variations in the usage patterns of custom block tip variables.

# Test: Look for any indirect or dynamic usage of the custom block tip variables.
rg '(var\(--vp-custom-block-tip-[^)]*\))' src/

Length of output: 48


Script:

#!/bin/bash
# Description: Search for the usage of custom block tip variables in additional file types.

# Test: Search in HTML and Markdown files.
rg '\-\-vp-custom-block-tip-' src/ --type-add 'html:*.html' --type-add 'md:*.md' --type-add 'jsx:*.jsx' --type-add 'tsx:*.tsx'

Length of output: 128


Script:

#!/bin/bash
# Description: Broaden the search pattern for custom block tip variables.

# Test: Search for any partial matches or variations of the variable names.
rg '\-\-vp-custom-block-tip[\w-]*' src/

Length of output: 41


Script:

#!/bin/bash
# Description: Inspect indirect references to custom block tip variables.

# Test: Search for functions or components that might construct variable names dynamically.
rg 'var\(--vp-custom-block-tip-[^)]*\)' src/

Length of output: 46


Script:

#!/bin/bash
# Description: Check for mentions of custom block tip variables within comments.

# Test: Search for the variable names within comment blocks.
rg '/\*.*\-\-vp-custom-block-tip-.*\*/' src/

Length of output: 46

@Ares-Chang
Copy link
Member Author

本地搜索个人感觉不是很好用,不如 Algolia,有条件可以配置下

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
src/.vitepress/config.ts (1)

131-135: LGTM: Social links configuration is correct.

The GitHub link is properly configured.

Consider adding links to other relevant social or community platforms if applicable to the project (e.g., Discord, Twitter).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 13a372b and 12fcd86.

📒 Files selected for processing (2)
  • src/.vitepress/config.ts (1 hunks)
  • src/.vitepress/theme/style.css (1 hunks)
🧰 Additional context used
🔇 Additional comments (9)
src/.vitepress/config.ts (6)

1-12: LGTM: Import statements and directory retrieval logic look good.

The use of fast-glob for dynamic directory retrieval is a good practice for maintainability. The exclusion of certain directories (public, apis, guide) aligns with common practices.


14-18: LGTM: Basic site configuration is correct and consistent.

The title, description, and language settings are properly configured. The use of Chinese for the description aligns well with the language setting.


19-70: LGTM: Theme configuration for navigation and sidebar is well-structured.

The navigation and sidebar configurations are clear and well-organized. The use of dynamic sidebar generation for API sections is a good practice for maintainability. The Chinese text used in the configuration is consistent with the site's language setting.


72-80: LGTM: Edit link and footer configuration are properly set up.

The edit link configuration is correct and encourages contributions by directing users to the GitHub repository. The footer information appropriately includes the license and copyright details.


82-129: LGTM: Localization and UI text configuration are comprehensive.

The configuration includes thorough localization efforts, consistent with the site's Chinese language setting. The search functionality is well-configured with detailed translations, enhancing the user experience. The date and time formatting for the "last updated" feature is appropriately set up.


1-135: Overall, the VitePress configuration is well-implemented and comprehensive.

The configuration file demonstrates good practices such as:

  1. Dynamic content generation for maintainability
  2. Consistent localization efforts
  3. Clear navigation and sidebar structure
  4. Proper setup of essential features like search and edit links

These elements contribute to a robust documentation setup that should serve the project well.

src/.vitepress/theme/style.css (3)

47-71: Consistency in Variable Definitions

The color variables are consistently defined, and the usage of existing color variables like --vp-c-gray-1 and --vp-c-indigo-1 promotes reusability and maintainability.


125-130: Unused Custom Block Tip Variables

The custom block tip variables defined here are not utilized elsewhere in the codebase. To maintain clean and efficient code, consider removing these unused variables unless they are reserved for future use.


93-119: ⚠️ Potential issue

Duplicate Definitions of Home Component Variables

The variables for the Home component (--vp-home-hero-*) are defined twice:

  • First definition: Lines 93-119
  • Second definition: Lines 144-169

This duplication can lead to confusion and potential styling conflicts. If both sets are intended for different themes or contexts (e.g., light and dark mode), consider segregating them appropriately or adding comments to clarify their purpose. Otherwise, remove the duplicate block to prevent unintended overrides.

Apply this diff to remove the duplicate definitions if they are unnecessary:

-/**
- * Component: Home
- * -------------------------------------------------------------------------- */
-
- :root {
-  --vp-home-hero-name-color: transparent;
-  --vp-home-hero-name-background: -webkit-linear-gradient(
-    315deg,
-    #42d392 25%,
-    #647eff
-  );
-  --vp-home-hero-image-background-image: linear-gradient(
-    -45deg,
-    #41b88380 30%,
-    #35495e80
-  );
-  --vp-home-hero-image-filter: blur(30px);
-}
-
-@media (min-width: 640px) {
-  :root {
-    --vp-home-hero-image-filter: blur(56px);
-  }
-}
-
-@media (min-width: 960px) {
-  :root {
-    --vp-home-hero-image-filter: blur(72px);
-  }
-}

Alternatively, organize the variables into separate files or sections if they are meant for different contexts.

Also applies to: 144-169

Comment on lines +136 to +139
.DocSearch {
--docsearch-primary-color: var(--vp-c-brand-1) !important;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid Unnecessary Use of !important

Using !important can make CSS harder to maintain and override. In line 137, the !important declaration might be unnecessary if specificity is properly managed. Consider increasing the selector specificity or restructuring the CSS to avoid using !important.

Comment on lines +175 to +201
.VPLocalSearchBox .result {
--vp-c-bg-search-result: var(--vp-c-bg);
background: var(--vp-c-bg-search-result) !important;
padding: 4px !important;
border: 1px solid var(--vp-c-divider) !important;
}
.VPLocalSearchBox .result.selected {
--vp-c-bg-search-result: var(--vp-c-bg-soft) !important;
}
.VPLocalSearchBox .result .excerpt-gradient-top {
background: linear-gradient(
var(--vp-c-bg-search-result),
transparent
) !important;
}
.VPLocalSearchBox .result .excerpt-gradient-bottom {
background: linear-gradient(
transparent,
var(--vp-c-bg-search-result)
) !important;
}
.VPLocalSearchBox .title-icon {
display: none;
}
.VPLocalSearchBox .excerpt-wrapper {
margin-top: 4px;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Minimize Usage of !important for Maintainability

The styles for .VPLocalSearchBox contain multiple !important declarations (lines 177, 179, 182, 188, 195). Overusing !important can lead to CSS conflicts and make future maintenance challenging. It's better to increase selector specificity or reorganize the CSS to eliminate the need for !important.

@edwinhuish edwinhuish merged commit 2e95a34 into uni-helper:main Oct 16, 2024
3 of 4 checks passed
@edwinhuish
Copy link
Collaborator

非常感谢。

本地搜索个人感觉不是很好用,不如 Algolia,有条件可以配置下

这些工具我都不熟,欢迎PR

@Ares-Chang
Copy link
Member Author

这个我可能搞不了,得先把文档上线,然后有账号的人去 Algolia 搞下仓库爬取,搞个 apikey, 填写下就行。

image

另外,可以我改下仓库结构嘛,我想添加个子包,但不发布,需要用来读取文档需要的配置。

改成 monorepo,我把读取文件的部分抽离出来,代码更干净些,类似

image

@edwinhuish
Copy link
Collaborator

刚刚重看了一下你的PR。.vuepress, apis, guide, public 这些文件夹不应该在 src 内,应该在项目根目录。

另外,首页文档链接失效了,也需要修复一下。

至于monorepo,可以考虑,但暂时列表不算太长,不算太迫切需求

@Ares-Chang
Copy link
Member Author

ok,我是按照 monorepo 模式写的,这几个文件应该在顶层,下面是 group 包。

还有,vitepress 需要部署一下,然后就可以把顶层的 README 改掉了,我没有改顶层的东西。

现在还需要更改吗?还是等部署完直接替换?

@Ares-Chang
Copy link
Member Author

可是我看了下,这几个文件好像不应该放到顶层,有点乱,这应该是属于文档的内容

@edwinhuish
Copy link
Collaborator

可是我看了下,这几个文件好像不应该放到顶层,有点乱,这应该是属于文档的内容

文档也是放外层的,或者monorepo的子package,没见过放src里面的

@Ares-Chang
Copy link
Member Author

不是的,文档必须和内容在一起,否则没法通过 vitepress 提取文件。

可以参考 VueUse 文档,我后期如果有空的话,可以试着把 ts 类型,维护成员,Demo 等引入进来。

image

@Ares-Chang Ares-Chang deleted the docs/vitepress branch October 17, 2024 06:19
@edwinhuish
Copy link
Collaborator

已将 vitepress 移动到根目录 dde5255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants