Skip to content

ci(automate): fix automate dependencies error #2428

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

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

zzcr
Copy link
Member

@zzcr zzcr commented Oct 28, 2024

PR

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

  • New Features

    • Added new dependencies across multiple packages, enhancing functionality:
      • @opentiny/vue-tree in @opentiny/vue-base-select
      • @opentiny/vue-icon in @opentiny/vue-dialog-select, @opentiny/vue-image, @opentiny/vue-loading, @opentiny/vue-switch, and @opentiny/vue-upload
      • @opentiny/vue-locale in @opentiny/vue-load-list
      • @opentiny/vue-button in @opentiny/vue-time-range
    • Removed @opentiny/vue-theme-mobile from @opentiny/vue-sticky, reducing dependencies.
  • Bug Fixes

    • Improved file writing behavior to ensure proper formatting.

Copy link

coderabbitai bot commented Oct 28, 2024

Walkthrough

This pull request includes modifications to multiple package.json files across various Vue components, primarily involving the addition and removal of dependencies. Notably, the add-dependencies.ts file has been updated to change file writing behavior, expand ignored patterns in the fg function, and modify the directory being scanned. These changes reflect adjustments in component dependencies and the overall structure of the project.

Changes

File Path Change Summary
internals/automate/src/add-dependencies.ts - Updated writeJson to append a newline to JSON string.
- Expanded ignore option in addComponentDepencies.
- Changed directory in scanDir from chart to huicharts.
packages/vue/src/base-select/package.json - Added dependency: "@opentiny/vue-tree": "workspace:~".
packages/vue/src/config-provider/package.json - Removed dependency: "@opentiny/vue-config-provider": "workspace:~".
packages/vue/src/dialog-select/package.json - Added dependency: "@opentiny/vue-icon": "workspace:~".
packages/vue/src/image/package.json - Added dependency: "@opentiny/vue-icon": "workspace:~".
packages/vue/src/load-list/package.json - Added dependency: "@opentiny/vue-locale": "workspace:~".
packages/vue/src/loading/package.json - Added dependency: "@opentiny/vue-icon": "workspace:~".
packages/vue/src/sticky/package.json - Removed dependency: @opentiny/vue-theme-mobile.
packages/vue/src/switch/package.json - Added dependency: "@opentiny/vue-icon": "workspace:~".
packages/vue/src/time-range/package.json - Added dependency: "@opentiny/vue-button": "workspace:~".
packages/vue/src/upload/package.json - Added dependency: "@opentiny/vue-icon": "workspace:~".

Possibly related PRs

🐇 In the garden where dependencies grow,
New friends join in, while some must go.
With icons and trees, our packages bloom,
A tidy workspace, no clutter or gloom.
Let's hop with joy, for changes are here,
In the code we trust, let’s give a cheer! 🎉


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

[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

@zzcr zzcr changed the title ci(automate): fia automate dependencies error ci(automate): fix automate dependencies error Oct 28, 2024
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 (2)
packages/vue/src/sticky/package.json (1)

Line range hint 1-22: Document dependency changes in package.json.

Consider adding a comment in the package.json description field or updating the component's documentation to explain why mobile theming is no longer needed. This will help future maintainers understand the rationale behind the dependency changes.

packages/vue/src/loading/package.json (1)

21-22: Consider updating documentation for icon usage.

If the loading component uses icons, please ensure the component's documentation reflects this new dependency and describes which icons are available/used.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b44978b and ab75dff.

📒 Files selected for processing (11)
  • internals/automate/src/add-dependencies.ts (3 hunks)
  • packages/vue/src/base-select/package.json (1 hunks)
  • packages/vue/src/config-provider/package.json (1 hunks)
  • packages/vue/src/dialog-select/package.json (1 hunks)
  • packages/vue/src/image/package.json (1 hunks)
  • packages/vue/src/load-list/package.json (1 hunks)
  • packages/vue/src/loading/package.json (1 hunks)
  • packages/vue/src/sticky/package.json (1 hunks)
  • packages/vue/src/switch/package.json (1 hunks)
  • packages/vue/src/time-range/package.json (1 hunks)
  • packages/vue/src/upload/package.json (1 hunks)
🔇 Additional comments (18)
packages/vue/src/config-provider/package.json (2)

18-18: LGTM! Removed circular dependency.

Good cleanup by removing the self-dependency @opentiny/vue-config-provider. Circular dependencies can cause resolution issues and are generally considered an anti-pattern.


17-19: Verify the impact of removing self-dependency.

Let's ensure that removing the self-dependency doesn't break any functionality.

✅ Verification successful

Let me try another verification approach since the previous commands had issues with the file type.


Removing self-dependency is safe

Based on the verification results:

  • The component only depends on @opentiny/vue-common and @opentiny/vue-theme
  • No circular dependencies or self-imports of @opentiny/vue-config-provider found in the component's source files
  • The only reference to the package name is in tests, which is a valid external import
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any internal usage of the config-provider within itself

# Test 1: Look for imports of config-provider within its own directory
echo "Checking for internal usage of config-provider..."
rg -t ts -t vue "from ['|\"]@opentiny/vue-config-provider" packages/vue/src/config-provider/

# Test 2: Check if any files reference the package name
echo "Checking for package name references..."
rg "@opentiny/vue-config-provider" packages/vue/src/config-provider/ --type ts --type vue

# Test 3: Look for potential circular dependency patterns
echo "Checking for circular dependency patterns..."
ast-grep --pattern 'import { $$$ } from "@opentiny/vue-config-provider"'

Length of output: 614


Script:

#!/bin/bash
# Let's check for any self-references using more reliable commands

# Check all files in the config-provider directory
echo "Files in config-provider directory:"
fd . packages/vue/src/config-provider/

# Look for any imports or requires in the directory
echo -e "\nChecking for any imports/requires:"
rg "require|import" packages/vue/src/config-provider/

# Check package.json dependencies before removal
echo -e "\nChecking package.json:"
cat packages/vue/src/config-provider/package.json

Length of output: 3114

packages/vue/src/sticky/package.json (1)

8-11: Verify mobile theme dependency removal.

The removal of @opentiny/vue-theme-mobile dependency might affect mobile-specific styling. Please ensure that:

  1. The sticky component doesn't require mobile-specific theming
  2. Any mobile-specific styles are now handled elsewhere
✅ Verification successful

Removal of vue-theme-mobile dependency is safe

The sticky component only uses the base theme package (@opentiny/vue-theme) for its styles through sticky/index.less. While there is a mobile-first template import pattern, it doesn't specifically depend on the mobile theme package. The removal of @opentiny/vue-theme-mobile dependency appears to be a safe cleanup.

  • packages/vue/src/sticky/src/pc.vue: Uses base theme import @opentiny/vue-theme/sticky/index.less
  • packages/vue/src/sticky/src/index.ts: Uses virtual template with mobile-first pattern but no direct mobile theme dependency
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the sticky component has any mobile-specific theme usage
rg -l "theme.*mobile" packages/vue/src/sticky/

Length of output: 48


Script:

#!/bin/bash
# Let's check for any mobile-specific styles or theme references in the sticky component
rg -i "mobile|theme" packages/vue/src/sticky/ -A 3

# Also check for any theme imports or configurations
ast-grep --pattern 'import $_ from "@opentiny/vue-theme$_"'

# Check if there are any mobile-specific class names or styles
rg -i "class.*mobile|style.*mobile" packages/vue/src/sticky/

Length of output: 938

packages/vue/src/load-list/package.json (2)

11-11: Consider updating documentation for i18n support.

If this component now supports internationalization, it would be helpful to document this capability in the component's documentation.

Let's check if documentation exists and needs updating:

#!/bin/bash
# Look for documentation files
fd -t f "README" "packages/vue/src/load-list/"

11-11: Verify the usage of newly added locale dependency.

The addition of @opentiny/vue-locale suggests internationalization support for this component.

Let's verify if the locale dependency is being utilized:

✅ Verification successful

Locale dependency is properly utilized in the component

The @opentiny/vue-locale dependency is correctly used in the component's implementation:

  • Imported and used via t() function for internationalization
  • Applied to default text properties: errorText, loadingText, and finishedText
  • Follows the standard i18n pattern with ui.loadList.* translation keys
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the component actually uses the locale dependency
rg -l "import.*@opentiny/vue-locale" "packages/vue/src/load-list/"

# Look for typical i18n usage patterns
rg "t\(['\"](.*?)['\"]\)" "packages/vue/src/load-list/"

Length of output: 138


Script:

#!/bin/bash
# Check for locale imports with different patterns
rg -l "@opentiny/vue-locale" "packages/vue/src/load-list/"

# Check for i18n related code patterns
rg -l "useLocale|createI18n|i18n\." "packages/vue/src/load-list/"

# Look at the component's source files to understand the implementation
fd -e vue -e js . "packages/vue/src/load-list/" -x cat {}

Length of output: 1963


Script:

#!/bin/bash
# Let's check the index.ts file that shows locale import
cat "packages/vue/src/load-list/src/index.ts"

# Check the renderless implementation for locale usage
rg -l "@opentiny/vue-locale" "packages/vue/src/renderless/load-list/"
cat "packages/vue/src/renderless/load-list/vue.ts"

Length of output: 1280

packages/vue/src/image/package.json (2)

21-22: LGTM! Dependency declaration follows project conventions.

The new dependency follows the established patterns:

  • Uses the workspace protocol with consistent version specifier
  • Maintains proper alphabetical ordering

21-22: Verify the icon dependency usage in the image component.

The addition of @opentiny/vue-icon as a dependency is consistent with similar updates across other components in this PR.

Let's verify if this dependency is actually used in the image component:

✅ Verification successful

Icon dependency is correctly added and used in the image component

The @opentiny/vue-icon dependency is justified as the component uses the iconImageError icon from this package:

  • Imports iconImageError from '@opentiny/vue-icon'
  • Uses it as TinyIconImageError component in the error state template
  • Registers it in components section: TinyIconImageError: iconImageError()
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the image component uses icons from @opentiny/vue-icon

# Test: Search for icon imports or usage in the image component
rg -t ts -t vue "@opentiny/vue-icon" "packages/vue/src/image/"

Length of output: 88


Script:

#!/bin/bash
# Let's try a different approach to search for icon-related code in the image component
# First, let's find the main component file
fd -t f "index" "packages/vue/src/image" --exec cat {}

# Also search for any icon-related terms without specific package
rg -l "icon|Icon" "packages/vue/src/image"

Length of output: 2901


Script:

#!/bin/bash
# Let's examine the pc.vue file which seems to contain icon-related code
cat "packages/vue/src/image/src/pc.vue"

Length of output: 2564

packages/vue/src/switch/package.json (2)

22-22: LGTM on dependency version syntax.

The use of workspace:~ for version specifier is consistent with other dependencies in the package.


21-22: Verify the necessity of @opentiny/vue-icon dependency.

Let's verify that this dependency is actually used in the switch component code.

✅ Verification successful

Let's gather more information about how the icon dependency is used in the identified files.


The @opentiny/vue-icon dependency is correctly added and actively used

The switch component legitimately uses the icon dependency:

  • In pc.vue: Imports and uses IconLoadingShadow for loading state
  • In tests: Uses IconArrowLeft and IconArrowRight for testing icon slots functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for icon imports or usage in switch component
echo "Checking for icon imports in switch component..."
rg -l "import.*@opentiny/vue-icon" "packages/vue/src/switch"

echo "Checking for icon usage patterns..."
ast-grep --pattern 'Icon' "packages/vue/src/switch"

Length of output: 383


Script:

#!/bin/bash
# Check the actual icon imports and usage in the files
echo "Checking icon imports and usage in pc.vue..."
rg "import.*@opentiny/vue-icon" -A 5 "packages/vue/src/switch/src/pc.vue"
rg "Icon" -A 5 "packages/vue/src/switch/src/pc.vue"

echo -e "\nChecking icon imports and usage in switch.test.tsx..."
rg "import.*@opentiny/vue-icon" -A 5 "packages/vue/src/switch/__tests__/switch.test.tsx"
rg "Icon" -A 5 "packages/vue/src/switch/__tests__/switch.test.tsx"

Length of output: 1679

packages/vue/src/loading/package.json (1)

21-22: Verify the necessity of @opentiny/vue-icon dependency.

Let's verify if the loading component actually uses icons from this package.

✅ Verification successful

Let's check the content of pc.vue to understand how icons are used in the loading component.


The @opentiny/vue-icon dependency is correctly added and necessary

The loading component uses the iconLoadingShadow component from @opentiny/vue-icon package as its default loading spinner. This is evidenced by:

  • The import statement: import { iconLoadingShadow } from '@opentiny/vue-icon'
  • Component registration: TinyIconLoadingShadow: iconLoadingShadow()
  • Usage in template: <tiny-icon-loading-shadow v-else class="circular"></tiny-icon-loading-shadow>
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for icon usage in the loading component
echo "Searching for icon imports and usage in loading component..."
rg -l "vue-icon|Icon" "packages/vue/src/loading"

# Search for loading component implementation to understand icon usage
ast-grep --pattern 'import { $_ } from "@opentiny/vue-icon"'

Length of output: 316


Script:

#!/bin/bash
# Check the content of pc.vue for icon usage
echo "Checking pc.vue for icon imports and usage..."
cat "packages/vue/src/loading/src/pc.vue"

# Also check for any icon-related props or components
ast-grep --pattern 'import { $_ } from "@opentiny/vue-icon"' "packages/vue/src/loading/src/pc.vue"

Length of output: 1990

packages/vue/src/time-range/package.json (1)

21-22: Verify the necessity of @opentiny/vue-button dependency.

The addition of @opentiny/vue-button appears to be part of the automated dependency detection. Let's verify if this dependency is actually used in the time-range component.

✅ Verification successful

@opentiny/vue-button dependency is correctly required

The time-range component uses the Button component (tiny-button) in its template for both cancel and confirm actions. The dependency is imported as Button from '@opentiny/vue-button' and registered as TinyButton in the components section.

Specific usage found in pc.vue:

  • Import statement: import Button from '@opentiny/vue-button'
  • Component registration: components: { TimeSpinner, TinyButton: Button }
  • Template usage:
    • Cancel button: <tiny-button class="tiny-time-range-picker__btn cancel">
    • Confirm button: <tiny-button size="small">
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the time-range component actually uses the button component

# Search for button imports or usage in time-range component
echo "Checking for button component usage in time-range..."
rg -l --type ts --type vue "@opentiny/vue-button|TinyButton" "packages/vue/src/time-range"

# Check if the dependency was automatically added by the dependency detection tool
echo "Checking automated dependency addition..."
rg -l "addDependencies|updateDependencies" "packages/vue/scripts"

Length of output: 453


Script:

#!/bin/bash
# Let's try a different approach to check for button usage

# First, let's find the main component file
echo "Finding time-range component files..."
fd . "packages/vue/src/time-range" -t f -e ts -e js -e vue

# Then let's search for Button-related content with proper file type handling
echo "Checking for Button usage..."
rg -t js -t typescript -t html "Button|button" "packages/vue/src/time-range"

# Let's also check package.json to understand the context better
echo "Checking package.json content..."
cat packages/vue/src/time-range/package.json

Length of output: 1180


Script:

#!/bin/bash
# Let's check the actual content of the component files

echo "Checking content of pc.vue..."
cat "packages/vue/src/time-range/src/pc.vue"

echo "Checking content of index.ts..."
cat "packages/vue/src/time-range/index.ts"

Length of output: 5603

packages/vue/src/upload/package.json (2)

22-23: LGTM! Icon dependency addition is consistent.

The addition of @opentiny/vue-icon as a workspace dependency aligns with the standardization across other packages.


23-23: Verify icon usage in the upload component.

Let's verify that this dependency is actually used in the upload component code.

✅ Verification successful

Let me check the actual usage of icons in the mobile-first.vue file to verify this dependency.


Icon dependency is correctly used in the upload component

The @opentiny/vue-icon dependency is actively used in mobile-first.vue where it imports and uses the iconHelpCircle component, confirming this is a necessary dependency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the upload component actually uses icons from @opentiny/vue-icon

# Search for icon imports or usage in the upload component
echo "Checking for icon imports and usage in upload component..."
rg -l "vue-icon|Icon" packages/vue/src/upload/

Length of output: 257


Script:

#!/bin/bash
# Check the actual icon usage in mobile-first.vue
echo "Checking icon imports and usage in mobile-first.vue..."
rg "(@opentiny/vue-icon|Icon)" -A 2 packages/vue/src/upload/src/mobile-first.vue

Length of output: 391

packages/vue/src/dialog-select/package.json (1)

24-25: Verify the necessity of @opentiny/vue-icon dependency.

The addition follows the correct workspace dependency format, but let's verify if the dialog-select component actually uses icons.

✅ Verification successful

@opentiny/vue-icon dependency is correctly required

The dialog-select component actively uses the icon component:

  • Imports iconSearch from '@opentiny/vue-icon'
  • Uses <tiny-icon-search> component in the template
  • Registers TinyIconSearch in components using iconSearch()
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the dialog-select component actually uses the icon component
# Expected: Find imports or uses of icons in the dialog-select component code

# Search for icon imports or usage in dialog-select source files
echo "Checking for icon usage in dialog-select component:"
rg -l "icon" "packages/vue/src/dialog-select" --type ts --type vue

# Check for specific icon component imports
echo -e "\nChecking for specific icon imports:"
rg -l "@opentiny/vue-icon" "packages/vue/src/dialog-select" --type ts --type vue

Length of output: 399


Script:

#!/bin/bash
# Let's try a different approach using fd to find files first, then search within them

# Find all relevant files
echo "Files in dialog-select directory:"
fd . "packages/vue/src/dialog-select" -t f

echo -e "\nChecking for icon usage in these files:"
fd . "packages/vue/src/dialog-select" -t f -x rg -l "icon" {} \;

echo -e "\nChecking for specific icon imports:"
fd . "packages/vue/src/dialog-select" -t f -x rg -l "@opentiny/vue-icon" {} \;

# Let's also check the actual content where icons might be used
echo -e "\nDetailed icon-related content:"
fd . "packages/vue/src/dialog-select" -t f -x rg "icon" -C 2 {} \;

Length of output: 1572

packages/vue/src/base-select/package.json (2)

30-30: LGTM on dependency version format.

The workspace:~ version specifier is correct for internal package dependencies.


29-30: Verify the usage of @opentiny/vue-tree in base-select component.

Let's verify that this dependency is actually being used in the base-select component's code.

✅ Verification successful

The tree component dependency is correctly used and required

The verification confirms that the base-select component directly imports and uses the tree component in mobile-first.vue:

  • Imports TinyTree from '@opentiny/vue-tree'
  • Uses <tiny-tree> component in the template when renderType === 'tree'
  • Implements tree-specific functionality like filterMethod, nodeCheckClick, etc.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if base-select actually imports or uses the tree component

# Test 1: Look for direct imports of tree component
echo "Checking for direct imports of tree component..."
rg -l "from ['\"]\@opentiny\/vue-tree['\"]" packages/vue/src/base-select/

# Test 2: Look for tree-related component usage in template
echo "Checking for tree component usage in templates..."
rg -l "<tiny-tree|TinyTree" packages/vue/src/base-select/

# Test 3: Check if this might create circular dependencies
echo "Checking if tree component depends back on base-select..."
rg -l "from ['\"]\@opentiny\/vue-base-select['\"]" packages/vue/src/tree/

Length of output: 835


Script:

#!/bin/bash
# Let's fix the regex syntax and try again

# Test 1: Look for direct imports of tree component
echo "Checking for direct imports of tree component..."
rg -l "from ['\"]@opentiny/vue-tree['\"]" packages/vue/src/base-select/

# Test 2: Look for any references to tree component
echo "Checking for any tree references..."
rg -C 3 "tree" packages/vue/src/base-select/src/mobile-first.vue

# Test 3: Check if tree component depends back on base-select
echo "Checking for potential circular dependencies..."
rg -l "from ['\"]@opentiny/vue-base-select['\"]" packages/vue/src/tree/

# Test 4: Let's check the actual implementation where tree is used
echo "Checking the implementation in mobile-first.vue..."
cat packages/vue/src/base-select/src/mobile-first.vue

Length of output: 28045

internals/automate/src/add-dependencies.ts (2)

30-30: LGTM: Adding newline improves file format consistency.

Adding a newline character at the end of JSON files follows best practices and improves version control diff readability.


76-77: 🛠️ Refactor suggestion

Verify directory rename and consider refactoring.

  1. The change from 'chart' to 'huicharts' suggests a component directory rename. Please verify this is intentional and all related changes are made.

  2. The code structure is duplicated. Consider refactoring to avoid repetition:

Let's verify the directory rename:

#!/bin/bash
# Description: Check references to the old 'chart' directory
# Expected: No references to the old directory name should remain

echo "Checking for remaining references to 'chart' directory:"
rg -i "chart" --type ts --type vue

Consider this refactoring to reduce code duplication:

-scanDir(root, 'dir').then((dirs) => {
-  dirs.forEach((dir) => addComponentDepencies(dir, root))
-})
-
-scanDir(path.join(root, 'huicharts'), 'dir').then((dirs) => {
-  dirs.forEach((dir) => addComponentDepencies(dir, path.join(root, 'huicharts')))
-})
+const dirsToScan = [
+  { path: root, base: root },
+  { path: path.join(root, 'huicharts'), base: path.join(root, 'huicharts') }
+]
+
+Promise.all(
+  dirsToScan.map(async ({ path: scanPath, base }) => {
+    const dirs = await scanDir(scanPath, 'dir')
+    return dirs.forEach((dir) => addComponentDepencies(dir, base))
+  })
+)

Comment on lines +21 to +22
"@opentiny/vue-theme": "workspace:~",
"@opentiny/vue-button": "workspace:~"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Version inconsistencies found in workspace dependencies

Two packages are using non-workspace versions which should be updated to maintain consistency:

  • packages/vue/src/huicharts/huicharts-core/package.json: @opentiny/huicharts uses version 1.0.1
  • packages/vue/src/fluent-editor/package.json: @opentiny/fluent-editor uses version ~3.20.0

The remaining 1,228 @opentiny dependencies correctly use workspace:~ versioning.

🔗 Analysis chain

Verify workspace version consistency.

The workspace:~ version specifier is consistent with other dependencies in this file and aligns with the pattern seen across other package updates.


Let me gather more specific information about the outliers to provide a complete verification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of workspace:~ version usage across package.json files

# Check if all @opentiny dependencies use workspace:~ version
echo "Checking version consistency across package.json files..."
fd package.json packages/vue/src -x grep -l "workspace:~" {} \; | \
  xargs jq -r '.dependencies | select(.) | to_entries[] | select(.key | startswith("@opentiny")) | .value' | \
  sort | uniq -c

Length of output: 367


Script:

#!/bin/bash
# Find the specific package.json files with non-workspace versions
echo "Files with version 1.0.1:"
fd package.json packages/vue/src -x sh -c 'if jq -e ".dependencies | select(.) | to_entries[] | select(.key | startswith(\"@opentiny\")) | select(.value == \"1.0.1\")" {} > /dev/null; then echo {}; fi'

echo -e "\nFiles with version ~3.20.0:"
fd package.json packages/vue/src -x sh -c 'if jq -e ".dependencies | select(.) | to_entries[] | select(.key | startswith(\"@opentiny\")) | select(.value == \"~3.20.0\")" {} > /dev/null; then echo {}; fi'

echo -e "\nShowing the specific dependencies with non-workspace versions:"
fd package.json packages/vue/src -x sh -c 'if jq -e ".dependencies | select(.) | to_entries[] | select(.key | startswith(\"@opentiny\")) | select(.value != \"workspace:~\")" {} > /dev/null; then echo "=== {}:"; jq ".dependencies | to_entries[] | select(.key | startswith(\"@opentiny\")) | select(.value != \"workspace:~\")" {}; fi'

Length of output: 1340

@@ -55,7 +55,7 @@ async function addComponentDepencies(component, dir) {
const allFiles = await fg(['**/*.ts', '**/*.vue'], {
dot: true,
cwd: componentPath,
ignore: ['**/node_modules', '__test__']
ignore: ['**/node_modules', '__test__', '__tests__']
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Test directory naming convention needs standardization

The codebase shows inconsistent test directory naming patterns in the Vue package:

  • Most components (54) use __tests__ (double underscore)
  • Some components (11) use __test__ (single underscore)

This inconsistency should be standardized to __tests__ as it's:

  • The more commonly used pattern in this codebase
  • The more widely adopted convention in the JavaScript/TypeScript ecosystem

Components using __test__ that need updating:

  • action-menu
  • collapse-item
  • collapse
  • divider
  • dropdown
  • fullscreen
  • pager
  • tooltip
  • tree
  • user-contact
  • user-head
🔗 Analysis chain

Verify test directory naming consistency across the codebase.

While ignoring both __test__ and __tests__ is more comprehensive, having both patterns might indicate inconsistent test directory naming conventions.

Let's check the test directory naming patterns:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for inconsistent test directory naming patterns
# Expected: All test directories should follow the same naming convention

echo "Directories with '__test__' pattern:"
fd -t d "__test__$"

echo -e "\nDirectories with '__tests__' pattern:"
fd -t d "__tests__$"

Length of output: 283


Script:

#!/bin/bash
# Let's try a different approach to find test directories
# Using find command which is more reliable for this case
echo "Directories with '__test__' pattern:"
find . -type d -name "__test__" -not -path "*/node_modules/*" -not -path "*/\.*"

echo -e "\nDirectories with '__tests__' pattern:"
find . -type d -name "__tests__" -not -path "*/node_modules/*" -not -path "*/\.*"

# Also let's check for any test files that might indicate the convention
echo -e "\nFiles in directories containing 'test':"
find . -type d -name "*test*" -not -path "*/node_modules/*" -not -path "*/\.*" | while read dir; do
    echo "Directory: $dir"
    ls -1 "$dir" 2>/dev/null || true
done

Length of output: 16515

@zzcr zzcr merged commit cf206f5 into dev Oct 28, 2024
10 checks passed
@kagol kagol deleted the fix-automate-dependencies-1028 branch November 4, 2024 06:17
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.

1 participant