Skip to content

Commit 9e97577

Browse files
committed
Use more OVERRIDES_FIELD_NAME and RESOLUTIONS_FIELD_NAME
1 parent 9d99734 commit 9e97577

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/commands/optimize.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ const updateManifestByAgent: Record<Agent, AgentModifyManifestFn> = (() => {
250250
let insertIndex = -1
251251
let isPlacingHigher = false
252252
if (field === OVERRIDES_FIELD_NAME) {
253-
insertIndex = getLowestEntryIndex(entries, ['resolutions'])
253+
insertIndex = getLowestEntryIndex(entries, [RESOLUTIONS_FIELD_NAME])
254254
if (insertIndex === -1) {
255255
isPlacingHigher = true
256256
insertIndex = getHighestEntryIndex(entries, [...depFields, PNPM])
@@ -259,11 +259,14 @@ const updateManifestByAgent: Record<Agent, AgentModifyManifestFn> = (() => {
259259
isPlacingHigher = true
260260
insertIndex = getHighestEntryIndex(entries, [
261261
...depFields,
262-
'overrides',
262+
OVERRIDES_FIELD_NAME,
263263
PNPM
264264
])
265265
} else if (field === PNPM_FIELD_NAME) {
266-
insertIndex = getLowestEntryIndex(entries, ['overrides', 'resolutions'])
266+
insertIndex = getLowestEntryIndex(entries, [
267+
OVERRIDES_FIELD_NAME,
268+
RESOLUTIONS_FIELD_NAME
269+
])
267270
if (insertIndex === -1) {
268271
isPlacingHigher = true
269272
insertIndex = getHighestEntryIndex(entries, depFields)

0 commit comments

Comments
 (0)