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

feat(create-umi): 为create-umi新增设置项目名称的步骤 #12516

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Redish101
Copy link

@Redish101 Redish101 commented Jul 2, 2024

#10011
create-umi新增了设置项目名称的步骤,默认值为cli传入的第一个参数。

Summary by CodeRabbit

  • 新功能
    • 在项目创建过程中,新增了setName功能,提示用户输入项目名称,进行验证,并根据输入更新目标路径。这增强了用户在使用create-umi工具时的交互体验。

Copy link

vercel bot commented Jul 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 6:54am

Copy link

coderabbitai bot commented Jul 2, 2024

Walkthrough

本次更改在 create-umi 工具中引入了一个新的 setName 函数,该函数用于提示用户输入项目名称,对其进行验证,并根据输入内容更新目标路径。这一新功能增强了用户在创建项目时的互动体验。

Changes

文件路径 更改摘要
packages/.../src/index.ts 引入新的 setName 函数,提示用户输入项目名称,验证并更新 target 路径。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant setNameFunction as setName Function
    participant System

    User ->> setNameFunction: Prompt for project name
    setNameFunction -->> User: Validate project name
    setNameFunction ->> System: Update target based on input
    System -->> User: Confirmation of new target
Loading

Poem

代码如诗墨笔挥,
更新功能添光辉。
项目名称随心定,
验证更新皆智能。
兔子为君送祝福,
编程路上快乐随。
🌟🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b89cd4 and 02c156c.

Files selected for processing (1)
  • packages/create-umi/src/index.ts (2 hunks)
Additional comments not posted (2)
packages/create-umi/src/index.ts (2)

109-125: 新增的 setName 函数看起来不错!

该函数通过 clackPrompts 库提示用户输入项目名称,并进行输入验证。代码逻辑清晰且符合预期。


179-184: 集成的项目名称设置步骤工作良好!

该代码段调用了新的 setName 函数,并根据用户输入更新了 target 变量,确保项目名称设置步骤正确集成到现有流程中。

exitPrompt();
}

target = join(cwd, name);
Copy link
Member

Choose a reason for hiding this comment

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

这样的话就没法在当前目录下创建项目了吧?

Copy link
Author

@Redish101 Redish101 Jul 4, 2024

Choose a reason for hiding this comment

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

去掉这个验证对.的拦截后就可以了。

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 02c156c and 6ba879a.

Files selected for processing (1)
  • packages/create-umi/src/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/create-umi/src/index.ts

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

Successfully merging this pull request may close these issues.

None yet

2 participants