refactor: replace find-up with escalade#4605
refactor: replace find-up with escalade#4605escapedcat merged 3 commits intoconventional-changelog:masterfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
Replaces find-up with escalade for locating the nearest Git root in @commitlint/top-level, aiming to reduce the dependency footprint.
Changes:
- Refactor Git root discovery to use
escaladeinstead offind-up. - Update
@commitlint/top-leveldependencies to removefind-upand addescalade. - Remove now-unused
find-up@^7-related entries fromyarn.lock.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
@commitlint/top-level/src/index.ts |
Switches Git root detection implementation from find-up to escalade. |
@commitlint/top-level/package.json |
Replaces runtime dependency find-up with escalade. |
yarn.lock |
Drops lock entries that were only needed for find-up@^7.0.0 and its dependency chain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Great idea! Thanks! Got this AI feedback: PR Review SummaryThanks for this PR! The dependency reduction is a great improvement. However, there are a few items that need to be addressed before merging: ✅ What's Good
❌ Required Changes
❓ QuestionThe original code explicitly checked for .git as both a file (submodules) and directory (normal repos). The escalade callback's files parameter includes both files and directories in its array. Can you confirm this works correctly for submodules where .git is a file pointing to the parent repo's modules directory? RecommendationOnce tests are added and the async/await is fixed, this PR will be ready to merge. The dependency reduction is valuable and escalade is a solid choice! After looking at this it might be better to first add tests to the module before we exchange the dep. wdyt? |
|
@escapedcat, what about this? |
Sorry, the main point here is to first add tests to the current master for top-level, let those pass and then make sure they still pass with this PR. Makes sense? |
|
Thanks! Is it possible to include further test cases?:
|
I have do it before.
I will try this. |
|
Thanks! |
|
Thanks! 👏 Now you can re-add the commits from before. Sorry for the confusion! |
|
❤️ |
User description
Description
Replace
find-upwithescalade.Motivation and Context
find-upis has 5 dependencies in its tree but escalade is has 0 dependencies in its tree.And because
yargsuse it, we maybe don't add the dependency :).Usage examples
How Has This Been Tested?
Types of changes
Checklist:
PR Type
Enhancement
Description
Replace
find-updependency withescaladeReduce dependency tree from 5 to 0 dependencies
Simplify git root detection logic
Leverage existing
yargsdependencyDiagram Walkthrough
File Walkthrough
index.ts
Refactor git root detection with escalade@commitlint/top-level/src/index.ts
find-upimport withescaladeprocessimport for default cwdtoplevel()to useescaladedirectlysearchDotGit()helper function.gitin directory filespackage.json
Update dependencies find-up to escalade@commitlint/top-level/package.json
find-updependency version^7.0.0escaladedependency version^3.2.0