Skip to content

feat(mono-pub): replace glob with globby to support negative globs#33

Merged
SavelevMatthew merged 2 commits intomainfrom
globby
Jun 4, 2025
Merged

feat(mono-pub): replace glob with globby to support negative globs#33
SavelevMatthew merged 2 commits intomainfrom
globby

Conversation

@SavelevMatthew
Copy link
Copy Markdown
Owner

@SavelevMatthew SavelevMatthew commented Jun 4, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of negative glob patterns when searching for packages, ensuring that excluded directories are properly omitted from results.
  • Chores

    • Updated internal dependencies to use a more modern file-matching library for improved reliability.
  • Tests

    • Added a new test to verify correct behavior with negative glob patterns.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 4, 2025

Walkthrough

The changes replace the "glob" dependency with "globby" in the project, updating the getAllPackages function to use "globby" for file system path matching. Associated logic is adjusted to accommodate "globby"'s API. A new test is added to verify correct handling of negative glob patterns.

Changes

File(s) Change Summary
packages/mono-pub/package.json Removed "glob" dependency; added "globby" dependency.
packages/mono-pub/src/utils/path.ts Replaced "glob" usage with "globby" in getAllPackages; updated logic for path and dirent access.
packages/mono-pub/src/utils/path.spec.ts Added a test for getAllPackages to verify negative glob pattern handling.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant getAllPackages
    participant globby
    participant fs (filesystem)
    participant scanPackageInfo

    Caller->>getAllPackages: Call with patterns and cwd
    getAllPackages->>globby: Search for matches with patterns
    globby-->>getAllPackages: Return list of matches (objects with path and dirent)
    loop For each match
        getAllPackages->>fs: Check if match is directory or package.json
        alt Directory
            getAllPackages->>fs: Check for package.json inside directory
            fs-->>getAllPackages: Exists/Not exists
        end
        alt Valid package.json found
            getAllPackages->>scanPackageInfo: Scan package info
            scanPackageInfo-->>getAllPackages: Package info
        end
    end
    getAllPackages-->>Caller: Return list of package info objects (filtered)
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@SavelevMatthew SavelevMatthew merged commit 19de659 into main Jun 4, 2025
7 of 8 checks passed
@SavelevMatthew SavelevMatthew deleted the globby branch June 4, 2025 05:53
Copy link
Copy Markdown

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ea9c2f6 and 1eeb269.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • packages/mono-pub/package.json (1 hunks)
  • packages/mono-pub/src/utils/path.spec.ts (1 hunks)
  • packages/mono-pub/src/utils/path.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/mono-pub/src/utils/path.spec.ts (1)
packages/mono-pub/src/utils/path.ts (1)
  • getAllPackages (23-60)
🔇 Additional comments (4)
packages/mono-pub/src/utils/path.spec.ts (1)

39-43: Excellent test coverage for negative glob patterns.

The test correctly validates the core functionality being added - ensuring that negative glob patterns properly exclude matching paths while preserving positive matches.

packages/mono-pub/src/utils/path.ts (3)

3-3: Import change supports the migration to globby.

The import update is necessary for the glob-to-globby migration and enables negative glob pattern support.


24-30: Globby configuration correctly enables negative glob support.

The globby options are well-chosen:

  • objectMode: true provides detailed file/directory information
  • absolute: true maintains existing path behavior
  • expandDirectories: false and onlyFiles: false preserve original glob matching semantics

34-37: Iteration logic correctly handles globby's object mode results.

The updated logic properly processes globby's object format using match.dirent, match.name, and match.path properties, maintaining the original functionality while supporting the new API.

},
"dependencies": {
"glob": "^10.2.2",
"globby": "^11.1.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify globby version currency and security.

Please confirm that globby version ^11.1.0 is current and secure, as this dependency change affects the core file matching functionality.


🌐 Web query:

What is the latest version of globby npm package and are there any known security vulnerabilities in version 11.1.0?

💡 Result:

The latest version of the globby npm package is 14.1.0, released approximately a month ago. (npmjs.com)

Regarding version 11.1.0, there are no known security vulnerabilities associated with it. Snyk's vulnerability database indicates that this version has no reported issues. (snyk.io)

However, it's important to note that version 11.1.0 was released in January 2022, and the latest version, 14.1.0, was released in February 2025. Using the most recent version is recommended to benefit from the latest features, improvements, and security patches.

Citations:


Update globby to the latest version

globby ^11.1.0 has no known security vulnerabilities (per Snyk), but it was released in January 2022. The current latest release is 14.1.0 (February 2025) which includes new features, performance improvements, and any recent security patches.

• File: packages/mono-pub/package.json
Line 69

Suggested change:

-   "globby": "^11.1.0",
+   "globby": "^14.1.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
"globby": "^11.1.0",
"globby": "^14.1.0",
🤖 Prompt for AI Agents
In packages/mono-pub/package.json at line 69, update the globby dependency
version from "^11.1.0" to "^14.1.0" to use the latest release. This will ensure
the project benefits from the newest features, performance improvements, and
recent security patches. Simply replace the version string while preserving the
caret symbol for compatible updates.

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