-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support for sorting dependenciesMeta in Yarn berry (#323)
* fix: support for sorting dependenciesMeta in Yarn berry * refactor: sortObjectByIdent - renamed getIdent to getPackageName - moved getPackageName and parseNameAndVersionRange functions to outer scope.
- Loading branch information
Showing
5 changed files
with
222 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,40 @@ function sortObjectAlphabetically(t, options = {}) { | |
} | ||
} | ||
|
||
function sortObjectWithRangeAlphabetically(t, options = {}) { | ||
const { maxDepth = 1, expect } = options | ||
|
||
for (let depth = 1; depth < maxDepth + 1; depth++) { | ||
sortObject(t, { | ||
...options, | ||
value: keysToObject( | ||
[ | ||
'@[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'@[email protected]', | ||
'[email protected]', | ||
'@b-package', | ||
], | ||
depth, | ||
), | ||
expect: | ||
expect || | ||
keysToObject( | ||
[ | ||
'@[email protected]', | ||
'@b-package', | ||
'@[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
], | ||
depth, | ||
), | ||
}) | ||
} | ||
} | ||
|
||
function sortObject( | ||
t, | ||
{ | ||
|
@@ -211,6 +245,7 @@ export const macro = { | |
sortObject, | ||
asItIs, | ||
sortObjectAlphabetically, | ||
sortObjectWithRangeAlphabetically, | ||
testCLI, | ||
uniqueArray, | ||
uniqueAndSort, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.