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

refactor(mobile): remove @opentiny/mobile-utils package, and add alia… #2767

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Jan 9, 2025

PR

  1. 移除了 @opentiny/mobile-utils包, 在tsconfig, vite.config中增加 alias 引用路径
  2. mobile中引用utils函数时, 通过@mobile-root/utils 去引用
  3. 构建mobile之后,dist内的文件自动展开成 ../../../的路径
  4. pnpm site:mobile时,自动解析 @mobile-root/utils路径

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

Release Notes

  • Project Structure

    • Refactored utility imports from @opentiny/mobile-utils to @mobile-root/utils
    • Updated module resolution paths across multiple components
    • Added new module alias @mobile-root for improved import management
  • Configuration Changes

    • Updated ESLint configuration
    • Modified Vite configuration
    • Updated TypeScript configuration to support new module paths
  • Dependency Management

    • Removed @opentiny/mobile-utils package
    • Restored core dependencies like Vue and TypeScript
    • Maintained existing theme and localization dependencies
  • Component Updates

    • Minor import path adjustments across multiple mobile components
    • No significant functional changes to component behaviors
    • Preserved existing logic and component interactions
  • Utility Modifications

    • Restructured utility function imports
    • Maintained existing utility function implementations

Copy link

coderabbitai bot commented Jan 9, 2025

Walkthrough

This pull request involves a comprehensive refactoring of import paths across the mobile components package. The primary change is replacing imports from @opentiny/mobile-utils with a new @mobile-root/utils alias. This modification affects numerous files across the mobile components, updating utility function and module imports while maintaining the existing functionality. The changes include updates to ESLint configuration, Vite configuration, TypeScript configuration, and package dependencies to support this new import strategy.

Changes

File Change Summary
.eslintrc.js Added @typescript-eslint/no-this-alias rule set to 'off'
examples/sites/vite.config.ts Added @mobile-root alias for packages/mobile directory
packages/mobile/package.json Removed @opentiny/mobile-utils dependency, added/restored Vue, TypeScript, and Vite dependencies
packages/mobile/tsconfig.json Added @mobile-root/* path alias
packages/mobile/vite.config.ts Removed SVG loader, added @mobile-root alias
Multiple component files Updated import paths from @opentiny/mobile-utils/* to @mobile-root/utils/*

Suggested labels

bug

Suggested reviewers

  • zzcr

Poem

🐰 A Rabbit's Refactoring Tale

Import paths were tangled, a developer's plight
With @mobile-root, we'll make everything right
Utilities dancing to a new module's beat
Refactoring code, making imports neat
A hop, skip, and jump to cleaner design! 🌟

Finishing Touches

  • 📝 Generate Docstrings

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@github-actions github-actions bot added the refactoring Refactoring (重构) label Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

Copy link

Walkthrough

此PR移除了@opentiny/mobile-utils包,并在tsconfigvite.config中增加了别名引用路径。所有对utils函数的引用现在通过@mobile-root/utils进行。构建后,dist内的文件路径自动展开为../../../格式。此外,pnpm site:mobile时会自动解析@mobile-root/utils路径。

Changes

文件 摘要
.eslintrc.js 添加了@typescript-eslint/no-this-alias规则。
examples/sites/vite.config.ts 添加了@mobile-root路径别名。
多个packages/mobile/components文件 @opentiny/mobile-utils替换为@mobile-root/utils
packages/mobile/vite.config.ts 移除了vite-svg-loader,添加了路径别名配置。
packages/mobile/tsconfig.json 更新了路径配置。
packages/mobile/utils/package.json 删除了不必要的依赖。

@@ -128,7 +128,7 @@ export const computedLeftStyle =
export const computedShowRight =
({ constants, props }) =>
() => {
return props.pattern === constants.DEFAULT ? false : true
return props.pattern !== constants.DEFAULT

Choose a reason for hiding this comment

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

The condition props.pattern === constants.DEFAULT ? false : true is simplified to props.pattern !== constants.DEFAULT. This change is correct and maintains the original logic.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Walkthrough

This PR removes the @opentiny/mobile-utils package and adds alias reference paths in tsconfig and vite.config. All references to utils functions are now made through @mobile-root/utils. After building, the file path in dist is automatically expanded into ../../../ format. In addition, the @mobile-root/utils path will be automatically resolved when pnpm site:mobile is used.

Changes

Documentation Abstract
.eslintrc.js Added @typescript-eslint/no-this-alias rule.
examples/sites/vite.config.ts Added @mobile-root path alias.
Multiple packages/mobile/components files Replace @opentiny/mobile-utils with @mobile-root/utils.
packages/mobile/vite.config.ts Removed vite-svg-loader and added path alias configuration.
packages/mobile/tsconfig.json Updated path configuration.
packages/mobile/utils/package.json Removed unnecessary dependencies.

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

🧹 Nitpick comments (2)
packages/mobile/components/dropdown-menu/src/mobile.vue (1)

54-55: Fix indentation in conditional rendering.

The template's conditional expression needs proper indentation.

Apply this diff to fix the formatting:

-                    ? 'IconUp'
-                    : 'IconDown'
+                      ? 'IconUp'
+                      : 'IconDown'
🧰 Tools
🪛 eslint

[error] 54-54: Insert ··

(prettier/prettier)


[error] 55-55: Insert ··

(prettier/prettier)

packages/mobile/components/image-viewer/src/mobileTouch.ts (1)

52-52: Good improvement: Using strict equality

The change from == to === for touchType comparisons is a good improvement that enhances type safety. While this wasn't mentioned in the PR objectives, it's a welcome enhancement.

Consider applying similar strict equality improvements throughout the codebase for consistency. I can help identify other locations where this could be applied.

Also applies to: 69-69, 73-73, 77-77, 81-81, 85-85, 90-90

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb80f1 and 249f86c.

📒 Files selected for processing (60)
  • .eslintrc.js (1 hunks)
  • examples/sites/vite.config.ts (1 hunks)
  • packages/mobile/components/badge/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/button/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/checkbox/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/container/src/renderless/index.ts (2 hunks)
  • packages/mobile/components/date-picker/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/dialog-box/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/dialog-box/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/dropdown-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/dropdown-item/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/dropdown-menu/src/mobile.vue (2 hunks)
  • packages/mobile/components/dropdown-menu/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/file-upload/src/renderless/index.ts (0 hunks)
  • packages/mobile/components/file-upload/src/renderless/vue.ts (2 hunks)
  • packages/mobile/components/form-item/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/form/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/image-viewer/src/mobileTouch.ts (4 hunks)
  • packages/mobile/components/image-viewer/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/input/src/renderless/index.ts (0 hunks)
  • packages/mobile/components/input/src/renderless/tall-storage/index.ts (1 hunks)
  • packages/mobile/components/loading/src/directive.ts (1 hunks)
  • packages/mobile/components/loading/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/loading/src/service.ts (1 hunks)
  • packages/mobile/components/message/index.ts (1 hunks)
  • packages/mobile/components/modal/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/multi-select/src/mobile.vue (1 hunks)
  • packages/mobile/components/multi-select/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/numeric/src/mobile.vue (1 hunks)
  • packages/mobile/components/numeric/src/numeric.ts (2 hunks)
  • packages/mobile/components/numeric/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/picker-column/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/popover/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/popover/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/popup/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/pull-refresh/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/radio-group/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/search/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/slider/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/tabbar-item/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/tabbar-item/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/tabbar/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/tabbar/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/tabs/src/mobile.vue (1 hunks)
  • packages/mobile/components/tabs/src/tab-nav/renderless/index.ts (1 hunks)
  • packages/mobile/components/time-line/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/tooltip/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/tooltip/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/upload-list/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/upload-list/src/renderless/vue.ts (1 hunks)
  • packages/mobile/components/upload/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/upload/src/upload.ts (1 hunks)
  • packages/mobile/components/wheel/src/renderless/index.ts (1 hunks)
  • packages/mobile/package.json (1 hunks)
  • packages/mobile/tsconfig.json (1 hunks)
  • packages/mobile/utils/package.json (0 hunks)
  • packages/mobile/vite.config.ts (2 hunks)
  • packages/mobile/vue-common/src/adapter/index.ts (1 hunks)
  • packages/mobile/vue-common/src/adapter/vue3/index.ts (1 hunks)
  • packages/mobile/vue-common/src/breakpoint.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/mobile/components/input/src/renderless/index.ts
  • packages/mobile/components/file-upload/src/renderless/index.ts
  • packages/mobile/utils/package.json
✅ Files skipped from review due to trivial changes (43)
  • packages/mobile/components/form/src/renderless/index.ts
  • packages/mobile/components/upload-list/src/renderless/index.ts
  • packages/mobile/components/dropdown-item/src/renderless/index.ts
  • packages/mobile/components/tabbar-item/src/renderless/index.ts
  • packages/mobile/components/button/src/renderless/index.ts
  • packages/mobile/components/badge/src/renderless/vue.ts
  • packages/mobile/components/tooltip/src/renderless/index.ts
  • packages/mobile/components/input/src/renderless/tall-storage/index.ts
  • packages/mobile/components/checkbox/src/renderless/index.ts
  • packages/mobile/components/tabbar/src/renderless/vue.ts
  • packages/mobile/components/wheel/src/renderless/index.ts
  • packages/mobile/components/picker-column/src/renderless/index.ts
  • packages/mobile/components/radio-group/src/renderless/index.ts
  • packages/mobile/components/loading/src/directive.ts
  • packages/mobile/components/loading/src/renderless/index.ts
  • packages/mobile/components/upload/src/upload.ts
  • packages/mobile/components/loading/src/service.ts
  • packages/mobile/vue-common/src/adapter/index.ts
  • packages/mobile/components/upload/src/renderless/index.ts
  • packages/mobile/components/dialog-box/src/renderless/vue.ts
  • packages/mobile/components/tooltip/src/renderless/vue.ts
  • packages/mobile/components/image-viewer/src/renderless/index.ts
  • packages/mobile/components/popover/src/renderless/index.ts
  • packages/mobile/components/tabbar/src/renderless/index.ts
  • packages/mobile/components/multi-select/src/renderless/index.ts
  • packages/mobile/components/pull-refresh/src/renderless/index.ts
  • packages/mobile/components/popover/src/renderless/vue.ts
  • packages/mobile/components/tabbar-item/src/renderless/vue.ts
  • packages/mobile/vue-common/src/breakpoint.ts
  • packages/mobile/components/form-item/src/renderless/index.ts
  • packages/mobile/components/dialog-box/src/renderless/index.ts
  • packages/mobile/components/numeric/src/numeric.ts
  • packages/mobile/vue-common/src/adapter/vue3/index.ts
  • packages/mobile/components/date-picker/src/renderless/vue.ts
  • packages/mobile/components/search/src/renderless/index.ts
  • packages/mobile/components/file-upload/src/renderless/vue.ts
  • packages/mobile/components/modal/src/renderless/index.ts
  • packages/mobile/components/upload-list/src/renderless/vue.ts
  • packages/mobile/components/tabs/src/tab-nav/renderless/index.ts
  • packages/mobile/components/time-line/src/renderless/index.ts
  • packages/mobile/components/dropdown-menu/src/renderless/index.ts
  • packages/mobile/components/popup/src/renderless/index.ts
  • packages/mobile/components/numeric/src/renderless/index.ts
🧰 Additional context used
🪛 eslint
packages/mobile/components/dropdown-menu/src/mobile.vue

[error] 54-54: Insert ··

(prettier/prettier)


[error] 55-55: Insert ··

(prettier/prettier)

🔇 Additional comments (18)
packages/mobile/components/dropdown-item/src/mobile.vue (1)

106-106: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of removing @opentiny/mobile-utils package.

Let's verify the new import path exists:

✅ Verification successful

Import path verification successful

The Clickoutside directive exists at the new location: packages/mobile/utils/deps/clickoutside.ts

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the new utils path exists and contains the clickoutside directive
fd clickoutside.ts -t f

Length of output: 120

packages/mobile/components/multi-select/src/mobile.vue (1)

128-128: LGTM! Import path updated consistently.

The import path change maintains consistency with other components.

packages/mobile/components/dropdown-menu/src/mobile.vue (1)

74-74: LGTM! Import path updated consistently.

The import path change aligns with the PR objective and maintains consistency with other components.

packages/mobile/components/numeric/src/mobile.vue (2)

Line range hint 74-93: Appreciate the well-structured component architecture!

The component demonstrates good practices:

  • Separation of concerns using the renderless pattern
  • Proper v-model implementation with 'update:modelValue'
  • Good accessibility with aria attributes
  • Clean event handling

74-75: LGTM! Import changes align with refactoring objectives.

The changes correctly implement the new @mobile-root/utils alias and remove the unused props import. The component continues to use numericProps imported directly from ./numeric.

Let's verify the new import path resolution works correctly:

✅ Verification successful

Import changes are correctly implemented and working as expected

The verification confirms:

  • The @mobile-root alias is properly configured in the Vite config
  • The new import path @mobile-root/utils/deps/repeat-click resolves to an existing file
  • The codebase shows consistent usage of the new alias pattern across multiple components
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new alias path resolution and check for any remaining old imports
# that might have been missed.

# Check if there are any remaining references to the old package
rg "@opentiny/mobile-utils/deps/repeat-click"

# Verify the new alias is properly configured in build files
rg -l "@mobile-root/utils" "vite.config*" "tsconfig*"

Length of output: 202


Script:

#!/bin/bash
# Find configuration files that might define aliases
fd -e js -e ts "vite\.config|tsconfig" --type f

# Check for any remaining references to the old package more broadly
rg -l "@opentiny/mobile-utils"

# Check if the new utils directory exists and contains repeat-click
fd -t f "repeat-click" --full-path "*utils/deps*"

Length of output: 775


Script:

#!/bin/bash
# Check mobile package's vite config for alias definitions
cat packages/mobile/vite.config.ts

# Find repeat-click file in the codebase
fd -t f "repeat-click.ts" -e js -e ts -e vue

# Check if there are any imports using the new @mobile-root alias
rg "@mobile-root/utils"

Length of output: 11525

packages/mobile/components/message/index.ts (1)

2-2: LGTM! Import path updated correctly

The import path has been updated to use the new @mobile-root/utils alias, aligning with the PR's objective.

packages/mobile/vite.config.ts (2)

4-4: LGTM! Alias configuration added correctly

The alias configuration for @mobile-root has been properly set up to support the new import strategy.

Also applies to: 24-27


7-7: Verify impact of removing svgLoader

The removal of svgLoader from plugins wasn't mentioned in the PR objectives. Please confirm this won't affect SVG handling in the mobile components.

✅ Verification successful

SVG handling remains intact without svgLoader

The removal of svgLoader is safe as the codebase doesn't use direct SVG imports. SVG handling is managed through the @opentiny/vue-icon component system, and SVG support in file uploads is handled at runtime.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for SVG imports or usage in mobile components
rg -t ts -t vue '\.svg' packages/mobile/

Length of output: 70


Script:

#!/bin/bash
# Find any .svg files in the mobile package
fd -e svg . packages/mobile/

# Search for SVG imports and usage without file type restrictions
rg "\.svg|from.*svg|import.*svg" packages/mobile/

# Check if svgLoader was previously present in vite config
git log -p packages/mobile/vite.config.ts | grep -A 5 -B 5 "svgLoader"

# Look for any SVG-related configuration
rg -l "svg" packages/mobile/

Length of output: 888


Script:

#!/bin/bash
# Check package.json for SVG-related dependencies
cat packages/mobile/package.json

# Check actual SVG usage in the matched files
rg -A 2 -B 2 "svg" packages/mobile/components/

Length of output: 14969

.eslintrc.js (1)

54-55: Verify necessity of disabling typescript-eslint rules

The addition of @typescript-eslint/no-this-alias: 'off' seems unrelated to the PR's main objective of updating import paths. Please clarify:

  1. Why is this rule being disabled?
  2. Are there specific use cases in the mobile components that require this?
✅ Verification successful

Rule disabling is justified by codebase patterns

The @typescript-eslint/no-this-alias rule is disabled to support existing patterns in the codebase where 'this' aliasing is commonly used in Vue components for preserving component context in callbacks and event handlers. Found multiple legitimate uses in core components like image-viewer, grid system, and tree models.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for instances where 'this' is aliased in mobile components
ast-grep --pattern 'const $var = this' packages/mobile/

Length of output: 57


Script:

#!/bin/bash
# First, verify the repository structure
fd mobile

# Then, search for 'this' aliases across all files
ast-grep --pattern 'const $_ = this'

# Also search with let declaration
ast-grep --pattern 'let $_ = this'

# Search for any direct assignments of 'this'
rg "= this;" -A 2 -B 2

Length of output: 35711

packages/mobile/components/image-viewer/src/mobileTouch.ts (1)

13-13: LGTM! Import path updated correctly

The import path has been updated to use the new @mobile-root/utils alias, aligning with the PR's objective.

examples/sites/vite.config.ts (1)

138-138: LGTM! Alias configuration looks good.

The addition of the @mobile-root alias is correctly configured and aligns with the PR objective of replacing @opentiny/mobile-utils with alias references.

packages/mobile/components/slider/src/renderless/index.ts (1)

13-16: LGTM! Import paths updated correctly.

The import paths have been successfully updated to use the new @mobile-root/utils alias, consistent with the PR objective of removing the @opentiny/mobile-utils package.

packages/mobile/tsconfig.json (1)

23-26: LGTM! Verify alias resolution across the codebase.

The path alias configuration for @mobile-root/* is correctly set up and aligns with the PR objective of implementing alias references.

Let's verify the usage of this new alias across the codebase:

✅ Verification successful

Alias configuration verified successfully

The @mobile-root alias is properly implemented and widely used across the mobile package components. No remaining @opentiny/mobile-utils imports were found, indicating successful migration to local utilities.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any potential issues with the new @mobile-root alias usage

# Search for all imports using the new alias
echo "Checking @mobile-root alias usage:"
rg "from ['\"]\@mobile-root/" --type ts --type vue

# Search for any remaining @opentiny/mobile-utils imports that should have been migrated
echo -e "\nChecking for remaining @opentiny/mobile-utils imports that should be migrated:"
rg "from ['\"]\@opentiny\/mobile-utils" --type ts --type vue

Length of output: 579


Script:

#!/bin/bash
# Search for new alias usage with corrected regex
echo "Files using @mobile-root alias:"
rg -l "@mobile-root/" --type ts --type vue

echo -e "\nFiles with @opentiny/mobile-utils imports:"
rg -l "@opentiny/mobile-utils" --type ts --type vue

Length of output: 324


Script:

#!/bin/bash
# First, let's see what extensions we're dealing with
echo "Checking file extensions in the project:"
fd . -e ts -e tsx -e vue -e js -e jsx --type f | grep -o '\.[^.]*$' | sort | uniq

echo -e "\nFiles using @mobile-root alias:"
rg -l "@mobile-root/"

echo -e "\nFiles with @opentiny/mobile-utils imports:"
rg -l "@opentiny/mobile-utils"

Length of output: 3470

packages/mobile/package.json (2)

34-35: LGTM! Dependencies cleanup looks good.

The removal of @opentiny/mobile-utils aligns with the PR objective while maintaining other necessary dependencies.


40-41: Consider using explicit versions for TypeScript and Vite.

The use of catalog: for version specifiers is unusual. Consider using explicit version numbers for better version control and reproducibility.

Let's check the current versions being used:

packages/mobile/components/container/src/renderless/index.ts (2)

131-131: LGTM! Logic simplification maintains functionality.

The return statement has been simplified while maintaining the same logical outcome. The change from a ternary to a direct comparison is a good improvement in readability.


13-13: Import path change aligns with PR objectives.

The modification from @opentiny/mobile-utils/type to @mobile-root/utils/type is consistent with the PR's goal of removing the @opentiny/mobile-utils package.

Let's verify the alias configuration:

✅ Verification successful

Import path change is valid and correctly configured

The import path change from @opentiny/mobile-utils/type to @mobile-root/utils/type is valid as:

  • The @mobile-root alias is properly configured in the build system
  • The required isNumber function is exported from packages/mobile/utils/type.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration in tsconfig and vite.config

# Check tsconfig.json for alias configuration
echo "Checking tsconfig.json for @mobile-root alias:"
fd -t f "tsconfig.*json" | xargs cat | jq -r 'select(.compilerOptions.paths."@mobile-root/*" != null)'

# Check vite.config files for alias configuration
echo "Checking vite.config files for @mobile-root alias:"
fd -t f "vite.config.*" | xargs cat

Length of output: 21534


Script:

#!/bin/bash
# Verify the existence of utils/type module
echo "Checking for utils/type module:"
fd -t f "type.ts" packages/mobile/utils

Length of output: 238


Script:

#!/bin/bash
# Check the content of type.ts for isNumber export
echo "Content of packages/mobile/utils/type.ts:"
cat packages/mobile/utils/type.ts

Length of output: 4371

packages/mobile/components/tabs/src/mobile.vue (1)

17-17: Import path change aligns with PR objectives.

The modification from @opentiny/mobile-utils/deps/touch to @mobile-root/utils/deps/touch is consistent with the PR's goal.

Let's verify the touch utilities are properly exported from the new path:

✅ Verification successful

Import path change verified successfully

The touch utilities (touchStart, touchMove) are properly exported from @mobile-root/utils/deps/touch with the expected functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the touch utilities are properly exported from @mobile-root/utils/deps/touch

# Check if the touch utilities exist in the new path
echo "Checking for touch utilities in the new path:"
fd -t f "touch.*" -d 4 packages/mobile/utils/deps

# Check the exports
echo "Checking exports of touch utilities:"
rg -A 5 "export.*touch(Start|Move)" packages/mobile/utils/deps

Length of output: 1234

"vite-plugin-dts": "^4.3.0",
"vite-svg-loader": "^5.1.0"
"vite-svg-loader": "^5.1.0",
"vue": "^3.5.0"
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 incorrect Vue version.

The specified Vue version ^3.5.0 appears to be incorrect as Vue 3.5.0 hasn't been released yet. The latest stable version of Vue 3 is lower than this.

Please update to a valid Vue 3.x version:

-    "vue": "^3.5.0"
+    "vue": "^3.4.0"
📝 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
"vue": "^3.5.0"
"vue": "^3.4.0"

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

🧹 Nitpick comments (4)
packages/mobile/components/action-sheet/src/mobile.vue (1)

Line range hint 38-38: Overall changes look consistent and well-structured.

The import path changes from relative paths to @mobile-root/vue-common are consistent across all components and align perfectly with the PR's objective to refactor the mobile module's utility imports. The changes maintain proper TypeScript types where applicable and preserve all necessary utilities in the imports.

This standardization of import paths will improve maintainability by:

  1. Making the codebase more consistent
  2. Simplifying future refactoring efforts
  3. Making dependencies more explicit and easier to track

Also applies to: 31-31, 41-41, 55-55

packages/mobile/components/time-line/src/mobile.vue (1)

Line range hint 61-84: Consistent use of aliases improves maintainability.

The systematic replacement of relative paths and @opentiny/mobile-utils with @mobile-root aliases across components is a good architectural decision that:

  1. Makes imports more readable and maintainable
  2. Centralizes common utilities
  3. Reduces the dependency on external packages
packages/mobile/components/input/src/mobile.vue (1)

Line range hint 13-176: Consider documenting the new import structure

The move to using @mobile-root aliases improves maintainability, but it would be helpful to:

  1. Document the new import structure in the project's README or contribution guidelines
  2. Consider creating an ESLint rule to enforce the new import pattern
  3. Add TypeScript path aliases to ensure proper IDE support

This will help future contributors understand and maintain the new structure.

packages/mobile/components/dropdown-menu/src/mobile.vue (1)

54-55: Fix indentation for better readability.

Add proper indentation (2 spaces) at the start of these lines to maintain consistent code formatting.

-                    ? 'IconUp'
-                    : 'IconDown'
+                      ? 'IconUp'
+                      : 'IconDown'
🧰 Tools
🪛 eslint

[error] 54-54: Insert ··

(prettier/prettier)


[error] 55-55: Insert ··

(prettier/prettier)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 249f86c and d6c2821.

📒 Files selected for processing (70)
  • examples/vue3/vite.config.ts (1 hunks)
  • packages/mobile/components/action-sheet/src/mobile.vue (1 hunks)
  • packages/mobile/components/alert/src/mobile.vue (1 hunks)
  • packages/mobile/components/avatar/src/mobile.vue (1 hunks)
  • packages/mobile/components/badge/src/mobile.vue (1 hunks)
  • packages/mobile/components/button/src/mobile.vue (1 hunks)
  • packages/mobile/components/checkbox-group/src/mobile.vue (1 hunks)
  • packages/mobile/components/checkbox/src/checkbox.ts (1 hunks)
  • packages/mobile/components/checkbox/src/mobile.vue (1 hunks)
  • packages/mobile/components/container/src/mobile.vue (1 hunks)
  • packages/mobile/components/date-picker/src/date-picker.ts (1 hunks)
  • packages/mobile/components/date-picker/src/mobile.vue (1 hunks)
  • packages/mobile/components/dialog-box/src/dialog-box.ts (1 hunks)
  • packages/mobile/components/dialog-box/src/mobile.vue (1 hunks)
  • packages/mobile/components/dropdown-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/dropdown-menu/src/mobile.vue (2 hunks)
  • packages/mobile/components/exception/src/mobile.vue (1 hunks)
  • packages/mobile/components/file-upload/src/file-upload.ts (1 hunks)
  • packages/mobile/components/file-upload/src/mobile.vue (1 hunks)
  • packages/mobile/components/file-upload/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/form-item/src/label-wrap.ts (1 hunks)
  • packages/mobile/components/form-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/form/src/mobile.vue (1 hunks)
  • packages/mobile/components/image-viewer/src/mobile.vue (1 hunks)
  • packages/mobile/components/image-viewer/src/mobileTouch.ts (4 hunks)
  • packages/mobile/components/index-bar-anchor/src/index.vue (1 hunks)
  • packages/mobile/components/index-bar/src/mobile.vue (1 hunks)
  • packages/mobile/components/input/src/input.ts (1 hunks)
  • packages/mobile/components/input/src/mobile.vue (1 hunks)
  • packages/mobile/components/input/src/renderless/index.ts (1 hunks)
  • packages/mobile/components/label/src/mobile.vue (1 hunks)
  • packages/mobile/components/list/src/mobile.vue (1 hunks)
  • packages/mobile/components/loading/src/directive.ts (1 hunks)
  • packages/mobile/components/loading/src/mobile.vue (1 hunks)
  • packages/mobile/components/loading/src/service.ts (1 hunks)
  • packages/mobile/components/mask/src/mobile.vue (1 hunks)
  • packages/mobile/components/message/index.ts (1 hunks)
  • packages/mobile/components/mini-picker/src/mobile.vue (1 hunks)
  • packages/mobile/components/modal/src/mobile.vue (1 hunks)
  • packages/mobile/components/multi-select-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/multi-select/src/mobile.vue (1 hunks)
  • packages/mobile/components/multi-select/src/multi-select.ts (1 hunks)
  • packages/mobile/components/nav-bar/src/mobile.vue (1 hunks)
  • packages/mobile/components/numeric/src/mobile.vue (1 hunks)
  • packages/mobile/components/picker-column/src/mobile.vue (1 hunks)
  • packages/mobile/components/popover/src/mobile.vue (1 hunks)
  • packages/mobile/components/popup/src/mobile.vue (1 hunks)
  • packages/mobile/components/progress/src/mobile.vue (1 hunks)
  • packages/mobile/components/pull-refresh/src/mobile.vue (1 hunks)
  • packages/mobile/components/radio-group/src/mobile.vue (1 hunks)
  • packages/mobile/components/radio/src/mobile.vue (1 hunks)
  • packages/mobile/components/search/src/mobile.vue (1 hunks)
  • packages/mobile/components/slider/src/mobile.vue (1 hunks)
  • packages/mobile/components/switch/src/mobile.vue (1 hunks)
  • packages/mobile/components/tab-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/tabbar-item/src/mobile.vue (1 hunks)
  • packages/mobile/components/tabbar/src/mobile.vue (1 hunks)
  • packages/mobile/components/table/src/mobile.vue (1 hunks)
  • packages/mobile/components/tabs/src/mobile.vue (1 hunks)
  • packages/mobile/components/tag/src/mobile.vue (1 hunks)
  • packages/mobile/components/time-line/src/mobile.vue (1 hunks)
  • packages/mobile/components/time-line/src/time-line.ts (1 hunks)
  • packages/mobile/components/toast/src/mobile.vue (1 hunks)
  • packages/mobile/components/toast/src/service.ts (1 hunks)
  • packages/mobile/components/tooltip/src/mobile.vue (1 hunks)
  • packages/mobile/components/upload-list/src/mobile.vue (1 hunks)
  • packages/mobile/components/upload/src/mobile.vue (1 hunks)
  • packages/mobile/components/user-head/src/mobile.vue (1 hunks)
  • packages/mobile/components/wheel/src/mobile.vue (1 hunks)
  • packages/mobile/vue-common/src/adapter/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (28)
  • packages/mobile/components/toast/src/service.ts
  • packages/mobile/components/radio-group/src/mobile.vue
  • packages/mobile/components/form-item/src/mobile.vue
  • packages/mobile/components/picker-column/src/mobile.vue
  • packages/mobile/components/nav-bar/src/mobile.vue
  • packages/mobile/components/file-upload/src/file-upload.ts
  • packages/mobile/components/time-line/src/time-line.ts
  • packages/mobile/components/loading/src/mobile.vue
  • packages/mobile/components/index-bar/src/mobile.vue
  • packages/mobile/components/input/src/input.ts
  • packages/mobile/components/container/src/mobile.vue
  • packages/mobile/components/dialog-box/src/dialog-box.ts
  • packages/mobile/components/upload/src/mobile.vue
  • packages/mobile/components/checkbox/src/mobile.vue
  • packages/mobile/components/form-item/src/label-wrap.ts
  • packages/mobile/components/multi-select/src/multi-select.ts
  • packages/mobile/components/tooltip/src/mobile.vue
  • packages/mobile/components/mask/src/mobile.vue
  • packages/mobile/components/button/src/mobile.vue
  • packages/mobile/components/checkbox/src/checkbox.ts
  • packages/mobile/components/popup/src/mobile.vue
  • packages/mobile/components/list/src/mobile.vue
  • packages/mobile/components/mini-picker/src/mobile.vue
  • packages/mobile/components/dialog-box/src/mobile.vue
  • packages/mobile/components/date-picker/src/date-picker.ts
  • packages/mobile/components/avatar/src/mobile.vue
  • packages/mobile/components/form/src/mobile.vue
  • packages/mobile/components/upload-list/src/mobile.vue
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/mobile/components/tabs/src/mobile.vue
  • packages/mobile/components/loading/src/directive.ts
  • packages/mobile/components/input/src/renderless/index.ts
  • packages/mobile/components/loading/src/service.ts
  • packages/mobile/vue-common/src/adapter/index.ts
  • packages/mobile/components/multi-select/src/mobile.vue
  • packages/mobile/components/numeric/src/mobile.vue
  • packages/mobile/components/message/index.ts
  • packages/mobile/components/file-upload/src/renderless/index.ts
  • packages/mobile/components/dropdown-item/src/mobile.vue
  • packages/mobile/components/image-viewer/src/mobileTouch.ts
🧰 Additional context used
🪛 eslint
packages/mobile/components/dropdown-menu/src/mobile.vue

[error] 54-54: Insert ··

(prettier/prettier)


[error] 55-55: Insert ··

(prettier/prettier)

🔇 Additional comments (34)
packages/mobile/components/multi-select-item/src/mobile.vue (1)

52-52: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias aligns with the PR objectives to improve path references.

packages/mobile/components/tabbar/src/mobile.vue (1)

25-25: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias improves maintainability by removing deep relative paths.

Let's verify the alias configuration:

✅ Verification successful

Alias configuration verified and properly set up

The @mobile-root alias is correctly configured in both Vite and TypeScript configurations, supporting the import path change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration

# Check vite.config.ts for alias configuration
echo "Checking vite.config.ts for @mobile-root alias:"
rg -A 5 "@mobile-root" "packages/mobile/vite.config.ts"

# Check tsconfig.json for path mapping
echo "Checking tsconfig.json for @mobile-root path mapping:"
rg -A 5 "@mobile-root" "packages/mobile/tsconfig.json"

Length of output: 572

packages/mobile/components/pull-refresh/src/mobile.vue (1)

63-63: LGTM! Verify alias configuration.

The change from relative path to @mobile-root/vue-common alias aligns with the PR objectives and improves maintainability.

Let's verify the alias configuration in the build system:

✅ Verification successful

Alias configuration verified successfully

The @mobile-root alias is properly configured in both Vite and TypeScript configurations, ensuring correct path resolution during development and build.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify @mobile-root alias configuration

# Check vite.config.ts for alias configuration
echo "Checking vite.config.ts for @mobile-root alias:"
rg -A 5 "@mobile-root" "packages/mobile/vite.config.ts"

# Check tsconfig.json for path mapping
echo "Checking tsconfig.json for path mapping:"
rg -A 5 "@mobile-root" "packages/mobile/tsconfig.json"

Length of output: 546

packages/mobile/components/tabbar-item/src/mobile.vue (1)

35-35: LGTM! Import path standardization looks good.

The change from relative path to @mobile-root/vue-common aligns with the PR's objective of standardizing import paths.

Let's verify that $props removal doesn't impact the component:

✅ Verification successful

Removal of $props import is safe

The component uses standard Vue 3 props system and doesn't rely on the removed $props utility. Props are properly defined in tabbar-item.ts and correctly used throughout the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if $props is used elsewhere in the component or if it's referenced in tabbar-item.ts

# Check if $props is used in the component file
rg '\$props' packages/mobile/components/tabbar-item/src/

# Check the props definition file
cat packages/mobile/components/tabbar-item/src/tabbar-item.ts

Length of output: 401


Script:

#!/bin/bash
# Check the component implementation
cat packages/mobile/components/tabbar-item/src/mobile.vue

Length of output: 1684

packages/mobile/components/progress/src/mobile.vue (1)

71-71: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias aligns with the PR objectives to standardize import paths.

Let's verify the alias configuration:

✅ Verification successful

Alias configuration verified successfully.

The @mobile-root alias is properly configured in both Vite and TypeScript configurations, resolving to the package root directory. This validates the import path change in the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration in tsconfig and vite config

# Check tsconfig.json for path alias
echo "Checking tsconfig.json for @mobile-root alias:"
fd -t f "tsconfig.json" -x cat {} | jq -r 'select(.compilerOptions.paths != null) | .compilerOptions.paths'

# Check vite.config.ts for alias
echo "Checking vite.config.ts for @mobile-root alias:"
rg -l "@mobile-root" | grep "vite.config"

Length of output: 505


Script:

#!/bin/bash
# Check the actual content of vite.config.ts files for alias configuration
echo "Content of packages/mobile/vite.config.ts:"
rg -A 5 -B 5 "@mobile-root" "packages/mobile/vite.config.ts"

echo -e "\nChecking tsconfig.json content:"
fd -t f "tsconfig.json" -x cat {}

Length of output: 10059

examples/vue3/vite.config.ts (1)

95-95: LGTM! Verify path resolution.

The alias addition aligns with the PR objectives to facilitate the new import strategy using @mobile-root/utils.

Let's verify the path resolution works as expected:

✅ Verification successful

Alias configuration and usage verified successfully.

The @mobile-root alias is properly configured in build tools and TypeScript, with consistent usage across the mobile package components and utilities. The directory structure and import patterns confirm the alias works as intended.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the mobile package directory exists and check for any unresolved imports.

# Check if the mobile package directory exists
if [ -d "$(pwd)/packages/mobile" ]; then
  echo "✓ Mobile package directory exists"
else
  echo "✗ Mobile package directory not found"
  exit 1
fi

# Search for any unresolved @mobile-root imports that might indicate path resolution issues
rg -g '!{node_modules,dist}' '@mobile-root' -A 3 -B 3

Length of output: 65771

packages/mobile/components/badge/src/mobile.vue (1)

41-41: LGTM! Import path update aligns with refactoring goals.

The change from relative path to @mobile-root alias improves maintainability and aligns with the PR's refactoring strategy.

Let's verify the path resolution configuration:

✅ Verification successful

Import path change is correctly implemented and consistent with codebase patterns

The @mobile-root/vue-common import path is consistently used across 60+ component files in the mobile package, confirming this is the established pattern for importing Vue utilities.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration and its usage

# Check if the alias is properly configured in vite config
rg -l "@mobile-root.*vue-common" "packages/mobile/vite.config.ts"

# Verify consistent usage of this import pattern across other components
rg "@mobile-root/vue-common" "packages/mobile/components/"

Length of output: 8274

packages/mobile/components/user-head/src/mobile.vue (1)

41-41: LGTM! The import path change aligns with the refactoring objectives.

The change from relative path to @mobile-root alias improves code maintainability and readability.

Let's verify the alias resolution works correctly:

✅ Verification successful

Alias configuration verified and properly set up

The @mobile-root alias is correctly configured in both tsconfig.json and vite.config.ts, and is consistently used across the project. The import path change aligns with the established patterns in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias is properly configured

# Check if the alias is defined in tsconfig
echo "Checking tsconfig.json for @mobile-root alias:"
cat packages/mobile/tsconfig.json | jq '.compilerOptions.paths'

# Check if the alias is defined in vite config
echo "Checking vite.config.ts for @mobile-root alias:"
rg "@mobile-root" packages/mobile/vite.config.ts

Length of output: 427


Script:

#!/bin/bash
# Description: Further verify alias configuration

# Check raw tsconfig content
echo "Raw tsconfig.json content:"
cat packages/mobile/tsconfig.json

# Look for other potential alias configurations
echo -e "\nSearching for other alias configurations:"
rg -g '*.{js,ts,json}' -l "@mobile-root"

Length of output: 4447

packages/mobile/components/switch/src/mobile.vue (2)

22-22: LGTM! Import path updated correctly.

The import path change from relative path to @mobile-root/vue-common aligns with the PR's objective to standardize import paths.

Let's verify this change is consistent across other mobile components:

✅ Verification successful

Import path standardization verified successfully

The import path @mobile-root/vue-common is correctly standardized and consistent with all 63 mobile component files. No relative imports remain.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the standardization of vue-common imports across mobile components
# Expected: All components should use @mobile-root/vue-common

# Check for any remaining relative imports of vue-common
rg -g '*.vue' -g '*.ts' "from '\.\./\.\./\.\./vue-common'" packages/mobile/components/

# Check for standardized imports
rg -g '*.vue' -g '*.ts' "from '@mobile-root/vue-common'" packages/mobile/components/

Length of output: 8339


23-23: Verify if @opentiny theme import should be updated.

The file still imports from @opentiny/vue-theme-mobile. Should this import path also be updated to use an alias for consistency with the PR's objectives?

Let's check if other components have updated their theme imports:

✅ Verification successful

Theme import is consistent with codebase pattern

The current import @opentiny/vue-theme-mobile/switch/index.less follows the consistent pattern used across all mobile components. No updates are needed as this maintains uniformity with the rest of the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check theme import patterns across mobile components
# Expected: Consistent pattern across all components

rg -g '*.vue' "from '@opentiny/vue-theme-mobile" packages/mobile/components/

Length of output: 202


Script:

#!/bin/bash
# Search for all .less imports in mobile components
echo "=== All .less imports in mobile components ==="
rg -g '*.vue' "import.*\.less['|\"]" packages/mobile/components/

# Search for potential theme alias usage
echo -e "\n=== Searching for potential theme alias usage ==="
rg -g '*.vue' "import.*@tiny-theme" packages/mobile/components/

Length of output: 5611

packages/mobile/components/index-bar-anchor/src/index.vue (1)

21-21: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias aligns with the PR's objective to standardize import paths.

Let's verify the alias resolution is configured correctly:

✅ Verification successful

Import path change is correctly implemented and widely used

The @mobile-root/vue-common import path is properly configured and consistently used across 60+ components in the mobile package. The alias resolution is working as expected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration

# Check if the alias is properly configured in tsconfig
echo "Checking tsconfig.json for @mobile-root alias:"
cat packages/mobile/tsconfig.json | jq '.compilerOptions.paths["@mobile-root/*"]'

# Check if the alias is properly configured in vite config
echo "Checking vite.config.ts for @mobile-root alias:"
rg "@mobile-root" packages/mobile/vite.config.ts

Length of output: 447


Script:

#!/bin/bash
# Check raw tsconfig content and vue-common existence
echo "=== tsconfig.json content ==="
cat packages/mobile/tsconfig.json

echo -e "\n=== Checking vue-common location ==="
fd vue-common packages/mobile

echo -e "\n=== Looking for related imports ==="
rg "@mobile-root/vue-common" packages/mobile --type ts --type vue

Length of output: 1170


Script:

#!/bin/bash
# Search for @mobile-root/vue-common imports with correct file type handling
echo "=== Checking other files using the same import ==="
rg -t js -t ts "@mobile-root/vue-common" packages/mobile
rg --type-add 'vue:*.vue' -t vue "@mobile-root/vue-common" packages/mobile

Length of output: 14966

packages/mobile/components/image-viewer/src/mobile.vue (1)

115-115: LGTM! Import path updated to use alias.

The change from relative path (../../../vue-common) to alias path (@mobile-root/vue-common) aligns with the PR's objective of improving import path management.

Let's verify that the new alias is properly configured:

✅ Verification successful

Import path change verified and consistent with codebase patterns

The @mobile-root/vue-common import is properly configured and widely used across the mobile components ecosystem. The vue-common directory exists at the expected location, and the import pattern is consistent with 40+ other mobile components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the @mobile-root alias configuration

# Check if the alias is configured in tsconfig
echo "Checking tsconfig.json for @mobile-root alias..."
fd -t f tsconfig.json | xargs cat | jq -r '.compilerOptions.paths["@mobile-root/*"]'

# Check if the alias is configured in vite config
echo "Checking vite.config for @mobile-root alias..."
fd -t f "vite.config.*" | xargs cat | rg "@mobile-root"

Length of output: 627


Script:

#!/bin/bash
# Verify vue-common existence and usage
echo "Checking for vue-common in packages/mobile..."
fd vue-common packages/mobile

echo "Checking for other imports using @mobile-root/vue-common..."
rg "@mobile-root/vue-common" -A 1 -B 1

Length of output: 20783

packages/mobile/components/radio/src/mobile.vue (1)

50-50: LGTM! Verify path resolution in build output.

The import path change aligns with the PR objectives of using alias paths. The change from relative path to @mobile-root/vue-common maintains the same functionality while improving code organization.

Let's verify that the build process correctly resolves the alias path:

✅ Verification successful

Import path change is safe and follows established patterns

The @mobile-root/vue-common import is:

  • Properly configured in the build system
  • Consistently used across 50+ components in the mobile package
  • Following the same import pattern for setup and defineComponent
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the build process correctly resolves @mobile-root/vue-common
# Expected: The path should be expanded to relative format (../../../) in the dist output

# Check the import statement in the built files
fd -e js -e ts . dist/mobile/components/radio/src/ --exec grep -l "@mobile-root/vue-common" {} \;

Length of output: 221


Script:

#!/bin/bash
# Find build configuration files
echo "=== Build Configuration Files ==="
fd -e js -e ts "vite.config|webpack.config|rollup.config" .

# Check for alias definitions
echo -e "\n=== Alias Definitions ==="
rg -l "@mobile-root" --type js --type ts | grep -i "config\|alias"

# Find similar import patterns
echo -e "\n=== Similar Import Patterns ==="
rg "from ['|\"]@mobile-root/vue-common" --type vue --type js --type ts

Length of output: 1119


Script:

#!/bin/bash
# Check mobile package's vite config
echo "=== Mobile Package Vite Config ==="
cat packages/mobile/vite.config.ts

# Search for similar imports in vue files
echo -e "\n=== Similar Imports in Vue Files ==="
rg "from ['\"]@mobile-root/vue-common" --type-add 'vue:*.vue' --type vue

Length of output: 7470

packages/mobile/components/tag/src/mobile.vue (2)

Line range hint 1-38: LGTM! Changes align with PR objectives

The component maintains its functionality while adopting the new import path strategy. The removal of the unused props import and the switch to alias-based imports improve code maintainability.


24-24: Verify the alias resolution for @mobile-root/vue-common

The import path change from relative to alias-based looks good and aligns with the PR objectives.

Let's verify the alias resolution and the presence of the required exports:

✅ Verification successful

Import statement is correctly configured and all exports are available

The import path @mobile-root/vue-common is properly aliased and the required exports (setup, h, defineComponent) are available through the Vue adapter implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the alias resolution and exports

# Check if the vue-common file exists and contains the required exports
fd -t f "vue-common.(ts|js)" packages/mobile/ -x grep -l "export.*{.*setup.*h.*defineComponent.*}"

# Verify the alias configuration
fd "vite.config.ts|tsconfig.json" packages/mobile/ -x grep -A 5 "@mobile-root"

Length of output: 423


Script:

#!/bin/bash
# Try different approaches to locate vue-common and its exports

# Find all possible vue-common files
fd "vue-common" packages/mobile/

# Use ast-grep to find exports of setup, h, defineComponent
ast-grep --pattern 'export { $$$setup$$$, $$$h$$$, $$$defineComponent$$$ }'

# Look for any file importing from vue
rg "from 'vue'" packages/mobile/

Length of output: 11372


Script:

#!/bin/bash
# Check the contents of the adapter files for the specific exports

# Check vue3 adapter
cat packages/mobile/vue-common/src/adapter/vue3/index.ts

# Check main adapter
cat packages/mobile/vue-common/src/adapter/index.ts

Length of output: 27574

packages/mobile/components/wheel/src/mobile.vue (2)

50-50: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias aligns with the PR's objective to improve import path maintainability.


50-50: Verify alias resolution configuration.

Let's ensure the @mobile-root alias is properly configured in the build system.

✅ Verification successful

The @mobile-root alias is properly configured and resolves correctly.

The alias configuration in both vite.config.ts and tsconfig.json is set up correctly to resolve @mobile-root to the mobile package root directory, allowing proper imports of the vue-common module.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify alias configuration in tsconfig and vite config

# Check tsconfig paths configuration
echo "Checking tsconfig.json for @mobile-root alias:"
fd -t f tsconfig.json -x cat {} | jq -r '.compilerOptions.paths | select(."@mobile-root/*" != null)'

# Check vite.config.ts for alias configuration
echo "Checking vite.config.ts for @mobile-root alias:"
fd -t f "vite.config.ts" -x rg -l "@mobile-root"

Length of output: 514


Script:

#!/bin/bash
# Check vite config content
echo "Content of packages/mobile/vite.config.ts:"
cat packages/mobile/vite.config.ts

# Try finding tsconfig without jq
echo -e "\nSearching for @mobile-root in tsconfig files:"
rg "@mobile-root" -A 2 -B 2 $(fd tsconfig)

# Check if vue-common exists
echo -e "\nChecking for vue-common module:"
fd -t f "vue-common" -d 3

Length of output: 2491


Script:

#!/bin/bash
# Search for vue-common more thoroughly
echo "Searching for vue-common in all files:"
fd vue-common

echo -e "\nSearching for vue-common in source files:"
rg -l "vue-common" -g "!package-lock.json" -g "!yarn.lock"

echo -e "\nChecking package.json files for vue-common:"
fd package.json -x rg -l "vue-common" {}

Length of output: 65934

packages/mobile/components/label/src/mobile.vue (1)

21-21: LGTM! Verify import resolution.

The import path change aligns with the PR objective to use alias paths. Let's verify that the new import path resolves correctly.

✅ Verification successful

Import path @mobile-root/vue-common is valid and correctly used

The import follows the established pattern used consistently across 60+ mobile components, and the alias is properly configured in the project's build setup files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that @mobile-root/vue-common resolves correctly in the build process
rg -g 'vite.config.*' -g 'tsconfig.*' '"@mobile-root"' .

Length of output: 58


Script:

#!/bin/bash
# Check package.json files for @mobile-root
rg -g 'package.json' '"@mobile-root"'

# Look for similar imports across the codebase
rg -g '*.{vue,ts,js}' '@mobile-root/vue-common'

# Check for alias configurations in other potential files
fd -g '*config*.{js,ts,json}' --exec grep -l "@mobile-root"

Length of output: 8425

packages/mobile/components/toast/src/mobile.vue (1)

14-14: LGTM! Import cleanup looks good.

The import path change and removal of unused props import improve code cleanliness while maintaining functionality.

packages/mobile/components/tab-item/src/mobile.vue (1)

27-27: LGTM! Verify component registration.

The import path change maintains the component's naming convention through $prefix. Let's verify the component registration in the mobile package.

✅ Verification successful

Component registration verified successfully

The TabItem component maintains proper registration, exports, and integration with the Tabs component after the import path change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify TabItem component registration and exports
rg -A 5 'TabItem' packages/mobile/

Length of output: 11128

packages/mobile/components/checkbox-group/src/mobile.vue (1)

29-29: LGTM! Import structure is well-organized.

The import path change maintains a clear distinction between aliased common utilities and local/external dependencies.

packages/mobile/components/date-picker/src/mobile.vue (1)

38-38: LGTM! Verify path resolution in build output.

The import path change aligns with the PR objectives. The change from relative path to @mobile-root/vue-common is consistent with the refactoring strategy.

Run this script to verify the path resolution in the build output:

✅ Verification successful

Import path @mobile-root/vue-common is properly configured and verified.

The path alias is correctly set up in both Vite and TypeScript configurations, and is consistently used across the mobile component ecosystem. The change aligns with the established patterns in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the build process correctly resolves @mobile-root/vue-common path
# Expected: The path should be expanded to relative format (../../../) in the dist output

# Find the built date-picker component file
fd -t f "date-picker.*\.js$" packages/mobile/dist -x cat {} | grep -A 1 "vue-common"

Length of output: 194


Script:

#!/bin/bash
# Check for similar import patterns across the codebase
echo "=== Checking similar imports ==="
rg "@mobile-root/vue-common" -A 1

echo -e "\n=== Checking package.json files ==="
fd "package.json" packages/mobile -x cat {}

echo -e "\n=== Looking for path alias configs ==="
fd "vite.config|tsconfig|webpack.config" -e js -e ts -e json

Length of output: 18230


Script:

#!/bin/bash
# Check vite configuration for path aliases
echo "=== Checking Vite config for path aliases ==="
cat packages/mobile/vite.config.ts

echo -e "\n=== Checking tsconfig for path aliases ==="
cat packages/mobile/tsconfig.json

Length of output: 1627

packages/mobile/components/alert/src/mobile.vue (1)

31-31: LGTM! Import path standardization looks good.

The change from relative path to @mobile-root/vue-common is consistent with the refactoring strategy while maintaining proper TypeScript type usage.

packages/mobile/components/exception/src/mobile.vue (1)

41-41: LGTM! Import path update is consistent.

The change from relative path to @mobile-root/vue-common maintains all required utilities and aligns with the refactoring strategy.

packages/mobile/components/action-sheet/src/mobile.vue (1)

55-55: LGTM! Verify build output for complex component.

The import path change is consistent with the refactoring strategy. Given this component's complexity (using BetterScroll), let's verify the build output.

Run this script to verify the build output:

✅ Verification successful

Import path is correctly configured and will work in build

The @mobile-root path is a valid local alias configured in vite.config.ts, pointing to the package root. The build configuration properly handles module preservation and external dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the build process correctly handles the complex dependencies
# Expected: Both @mobile-root/vue-common and @better-scroll/core should be properly resolved

# Find the built action-sheet component file and check its dependencies
fd -t f "action-sheet.*\.js$" packages/mobile/dist -x cat {} | grep -A 2 "import.*from.*['\"][@]"

Length of output: 211


Script:

#!/bin/bash
# Check package.json for @mobile-root/vue-common dependency
fd -t f "package.json" packages/mobile -x cat {}

# Find other files using similar import patterns
rg "from ['\"]\@mobile-root/vue-common['\"]" packages/mobile --type vue

Length of output: 1426


Script:

#!/bin/bash
# Search for the import pattern with fixed escaping
rg "from ['\"]@mobile-root/vue-common['\"]" packages/mobile --type vue

# Look for potential alias configurations
fd -t f "vite.config.[tj]s" packages/mobile -x cat {}

Length of output: 779

packages/mobile/components/slider/src/mobile.vue (1)

61-61: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias aligns with the PR objectives.

Let's verify the alias resolution:

✅ Verification successful

Import path change is verified and consistent with codebase patterns

The change to use @mobile-root/vue-common is correct as:

  • The module exists at the expected location
  • The same import pattern is used consistently across mobile components
  • The alias is properly configured in the build system
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify @mobile-root alias resolution in tsconfig and vite config

# Check tsconfig paths configuration
fd -t f tsconfig.json | xargs rg '"@mobile-root"'

# Check vite config alias configuration
fd -t f vite.config.ts | xargs rg '"@mobile-root"'

Length of output: 104


Script:

#!/bin/bash
# Cast a wider net for configuration files and imports

# Look for path alias configurations in various config files
fd -e json -e js -e ts -e mjs | xargs rg -i "alias|paths"

# Check if vue-common exists and its location
fd -t d vue-common

# Find similar imports to establish pattern
rg "@mobile-root/vue-common" -A 2 -B 2

Length of output: 52541

packages/mobile/components/popover/src/mobile.vue (1)

56-56: Verify props usage after import removal.

While the path change to @mobile-root/vue-common is good, the props import was removed but props is still used in the setup function parameters.

Let's verify if props is available implicitly or imported elsewhere:

packages/mobile/components/search/src/mobile.vue (1)

69-69: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias is consistent with the PR objectives.

packages/mobile/components/time-line/src/mobile.vue (1)

84-84: LGTM! Import path updated to use alias.

The change from relative path to @mobile-root/vue-common alias is consistent with the PR objectives.

packages/mobile/components/table/src/mobile.vue (1)

93-93: Import path update looks good!

The change from relative path to @mobile-root/vue-common alias is consistent with the PR objectives.

packages/mobile/components/file-upload/src/mobile.vue (1)

14-14: Import path update looks good!

The change to use @mobile-root/vue-common alias maintains TypeScript type safety while aligning with the PR objectives.

packages/mobile/components/modal/src/mobile.vue (1)

13-13: Verify props handling after import changes

While the import path change to @mobile-root/vue-common is good, please verify that all props previously imported from vue-common are now properly covered by the modalProps import from ./modal.

✅ Verification successful

Props handling verified successfully after import changes

The migration of props from vue-common to local modalProps in ./modal is complete and correct. All necessary props are properly defined and used throughout the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if any props from vue-common are still referenced
rg -l "props\." packages/mobile/components/modal/src/

Length of output: 167


Script:

#!/bin/bash
# Check the content of mobile.vue and related files
echo "=== mobile.vue content ==="
cat packages/mobile/components/modal/src/mobile.vue

echo -e "\n=== modal.ts content ==="
cat packages/mobile/components/modal/src/modal.ts

echo -e "\n=== renderless files content ==="
cat packages/mobile/components/modal/src/renderless/index.ts
cat packages/mobile/components/modal/src/renderless/vue.ts

Length of output: 41990

packages/mobile/components/input/src/mobile.vue (1)

176-176: Import path update looks good!

The change to use @mobile-root/vue-common alias and separate inputProps import maintains component functionality while aligning with the PR objectives.

packages/mobile/components/dropdown-menu/src/mobile.vue (1)

71-71: Verify alias path configuration.

The import paths have been correctly updated to use the new @mobile-root alias. However, let's verify that these paths are properly configured in the build system.

Also applies to: 74-74

✅ Verification successful

Alias path configuration is correct

The @mobile-root alias is properly configured in both the TypeScript compiler (via tsconfig.json) and Vite build system, mapping correctly to the package root directory.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify alias path configuration in tsconfig and vite config

# Check tsconfig.json for path aliases
echo "Checking tsconfig.json for @mobile-root alias:"
fd -t f tsconfig.json | xargs cat | jq -r '.compilerOptions.paths | select(."@mobile-root/*" != null)'

# Check vite.config.ts for alias configuration
echo "Checking vite.config.ts for @mobile-root alias:"
rg -A 5 "@mobile-root" packages/mobile/vite.config.ts

Length of output: 522


Script:

#!/bin/bash
# Check raw content of tsconfig.json files
echo "Checking raw content of tsconfig.json files:"
fd tsconfig.json -x cat {}

Length of output: 9812

@zzcr zzcr merged commit 3502466 into opentiny:dev Jan 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring (重构)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants