Skip to content

Commit d045f1d

Browse files
committed
Don't mention a workspace if one isn't used
1 parent 74deb59 commit d045f1d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/commands/optimize.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ async function addOverrides(
612612
)
613613
}
614614
if (spinner) {
615-
spinner.text = `Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`
615+
spinner.text = `Adding overrides${isWorkspace ? ` to ${workspaceName}` : ''}...`
616616
}
617617
const depAliasMap = new Map<string, { id: string; version: string }>()
618618
// Chunk package names to process them in parallel 3 at a time.
@@ -635,7 +635,9 @@ async function addOverrides(
635635
pkgSpec = `${regSpecStartsLike}^${version}`
636636
depObj[origPkgName] = pkgSpec
637637
state.added.add(regPkgName)
638-
state.addedInWorkspaces.add(workspaceName)
638+
if (isWorkspace) {
639+
state.addedInWorkspaces.add(workspaceName)
640+
}
639641
}
640642
depAliasMap.set(origPkgName, {
641643
id: pkgSpec,
@@ -681,12 +683,11 @@ async function addOverrides(
681683
}
682684
if (newSpec !== oldSpec) {
683685
overrides[origPkgName] = newSpec
684-
if (overrideExists) {
685-
state.updated.add(regPkgName)
686-
state.updatedInWorkspaces.add(workspaceName)
687-
} else {
688-
state.added.add(regPkgName)
689-
state.addedInWorkspaces.add(workspaceName)
686+
const addedOrUpdated = overrideExists ? 'updated' : 'added'
687+
state[addedOrUpdated].add(regPkgName)
688+
if (isWorkspace) {
689+
const addedOrUpdatedIn = overrideExists ? 'updatedInWorkspaces' : 'addedInWorkspaces'
690+
state[addedOrUpdatedIn].add(workspaceName)
690691
}
691692
}
692693
}

0 commit comments

Comments
 (0)