Skip to content

Commit

Permalink
Use more OVERRIDES_FIELD_NAME and RESOLUTIONS_FIELD_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Dec 23, 2024
1 parent 9d99734 commit 67657a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const updateManifestByAgent: Record<Agent, AgentModifyManifestFn> = (() => {
let insertIndex = -1
let isPlacingHigher = false
if (field === OVERRIDES_FIELD_NAME) {
insertIndex = getLowestEntryIndex(entries, ['resolutions'])
insertIndex = getLowestEntryIndex(entries, [RESOLUTIONS_FIELD_NAME])
if (insertIndex === -1) {
isPlacingHigher = true
insertIndex = getHighestEntryIndex(entries, [...depFields, PNPM])
Expand All @@ -259,11 +259,11 @@ const updateManifestByAgent: Record<Agent, AgentModifyManifestFn> = (() => {
isPlacingHigher = true
insertIndex = getHighestEntryIndex(entries, [
...depFields,
'overrides',
OVERRIDES_FIELD_NAME,
PNPM
])
} else if (field === PNPM_FIELD_NAME) {
insertIndex = getLowestEntryIndex(entries, ['overrides', 'resolutions'])
insertIndex = getLowestEntryIndex(entries, [OVERRIDES_FIELD_NAME, RESOLUTIONS_FIELD_NAME])
if (insertIndex === -1) {
isPlacingHigher = true
insertIndex = getHighestEntryIndex(entries, depFields)
Expand Down

0 comments on commit 67657a2

Please sign in to comment.