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

fix(preset-umi): tmp umi tsconfig includes add .umirc.*.ts #12251

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

17hz
Copy link
Contributor

@17hz 17hz commented Mar 29, 2024

修复 .umi/tsconfig.jsoninclude 字段没有包含 .umirc.*.ts 导致额外创建的配置文件如 .umirc.local.ts等 无法获得类型补全的问题

Summary by CodeRabbit

  • New Features
    • Enhanced file matching capabilities with wildcard support for configuration file lookup.

Copy link

vercel bot commented Mar 29, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
umi ⬜️ Ignored (Inspect) Visit Preview Mar 29, 2024 4:00am

Copy link

coderabbitai bot commented Mar 29, 2024

Walkthrough

The update introduces a new capability within the tmpFiles.ts feature of the Umi preset package, allowing for more flexible file matching. Specifically, it now supports the use of wildcards in file extensions when searching for configuration files. This enhancement simplifies the process of managing temporary files by accommodating a broader range of file types with a single configuration entry.

Changes

File Path Summary
packages/preset-umi/src/features/tmpFiles/tmpFiles.ts Added support for wildcard extension matching in configuration file lookup.

🐇 A whimsical note from a coding hare,
To celebrate changes both fair and rare.
"In the realm of code, where wildcards play,
We now match files in a flexible way.
Let configs embrace, with wildcards in chase,
A hop, skip, and jump, in the digital space."
🌟📂🌟

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-tests 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 tests 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 tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ac85e52 and 644678c.
Files selected for processing (1)
  • packages/preset-umi/src/features/tmpFiles/tmpFiles.ts (1 hunks)
Additional Context Used
Additional comments not posted (1)
packages/preset-umi/src/features/tmpFiles/tmpFiles.ts (1)

97-97: The addition of ${baseUrl}.${frameworkName}rc.*.ts to the include array in the TypeScript configuration is a welcome change that addresses the issue of missing type completions for .umirc.*.ts files. Ensure that baseUrl and frameworkName are always correctly set to avoid potential path resolution issues.

Verification successful

The script successfully located the tmpFiles.ts file and verified the presence and definitions of baseUrl and frameworkName. The output confirms that both variables are indeed defined within the file, with frameworkName being assigned the value from api.service.frameworkName and baseUrl being conditionally set based on whether api.appData.hasSrcDir is true or false. This addresses the concern raised in the review comment about ensuring that baseUrl and frameworkName are always correctly set to avoid potential path resolution issues.

Given this information, the addition of ${baseUrl}.${frameworkName}rc.*.ts to the include array in the TypeScript configuration, as mentioned in the review comment, is verified to be correctly implemented with the necessary variables being defined and utilized as intended.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that baseUrl and frameworkName are always defined and valid
grep -E 'const (baseUrl|frameworkName) =' tmpFiles.ts

Length of output: 100



Script:

#!/bin/bash
# Find the correct path to tmpFiles.ts and verify the presence of baseUrl and frameworkName
fd tmpFiles.ts --exec grep -E 'const (baseUrl|frameworkName) =' {}

Length of output: 185

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.40%. Comparing base (ac85e52) to head (644678c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12251   +/-   ##
=======================================
  Coverage   28.40%   28.40%           
=======================================
  Files         492      492           
  Lines       15171    15171           
  Branches     3630     3630           
=======================================
  Hits         4310     4310           
  Misses      10088    10088           
  Partials      773      773           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stormslowly stormslowly merged commit 0c59059 into umijs:master Apr 11, 2024
24 checks passed
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