Repository: JoshuaKGoldberg/template-typescript-node-package (ts)

Issue:
🐛 Bug: Label setups misses existing prefixed labels
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

When a label such as `area: documentation` already exists in the repo, `hydrateRepositoryLabels` > `getExistingEquivalentLabel` should find that as an existing label.

### Actual

Because of the fun `.replace` logic, existing prefixed labels are actually missed...

### Additional Info

_No response_

Pull request:
fix: match existing, prefixed labels in setup
## PR Checklist

- [x] Addresses an existing open issue: fixes #529
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

Fixes the `.find` logic to match on an aliased or prefixed label.

Patch:
diff --git a/package.json b/package.json
index fc5dfb1..afad86b 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
 		"@types/prettier": "^2.7.2",
 		"@typescript-eslint/eslint-plugin": "^5.59.5",
 		"@typescript-eslint/parser": "^5.59.5",
-		"@vitest/coverage-istanbul": "^0.31.0",
+		"@vitest/coverage-istanbul": "^0.32.0",
 		"all-contributors-cli": "^6.25.1",
 		"c8": "^7.13.0",
 		"console-fail-test": "^0.2.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 28088be..2f303fa 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -41,8 +41,8 @@ devDependencies:
     specifier: ^5.59.5
     version: 5.59.5(eslint@8.40.0)(typescript@5.0.4)
   '@vitest/coverage-istanbul':
-    specifier: ^0.31.0
-    version: 0.31.0(vitest@0.31.0)
+    specifier: ^0.32.0
+    version: 0.32.0(vitest@0.31.0)
   all-contributors-cli:
     specifier: ^6.25.1
     version: 6.25.1
@@ -1674,10 +1674,10 @@ packages:
       eslint-visitor-keys: 3.4.1
     dev: true
 
-  /@vitest/coverage-istanbul@0.31.0(vitest@0.31.0):
-    resolution: {integrity: sha512-SaTI1PSpCRtBhJ5ihBx7Z+jgrFAQlDjuI4MFmKQ/HjyYWzEoaU+I062SquRrOLjJtVOHnwJdjVJXKi0dgFiR9Q==}
+  /@vitest/coverage-istanbul@0.32.0(vitest@0.31.0):
+    resolution: {integrity: sha512-itX7qym7g9SxUpE/VoJWUQ6KR2k1poSbpJCou3R8wmNZ0i5K4HT0o33Sc8tKT4XJ0SluHrS7voORpu5w6y/hGg==}
     peerDependencies:
-      vitest: '>=0.30.0 <1'
+      vitest: '>=0.32.0 <1'
     dependencies:
       istanbul-lib-coverage: 3.2.0
       istanbul-lib-instrument: 5.2.1
diff --git a/src/setup/settings/addOwnerAsAllContributor.ts b/src/setup/settings/addOwnerAsAllContributor.ts
index ccb902a..850c68b 100644
--- a/src/setup/settings/addOwnerAsAllContributor.ts
+++ b/src/setup/settings/addOwnerAsAllContributor.ts
@@ -22,7 +22,7 @@ export async function addOwnerAsAllContributor(owner: string) {
 		user = owner;
 	}
 
-	await $`npx -y all-contributors-cli add ${user} ${[
+	await $`npx -y all-contributors-cli@6.25 add ${user} ${[
 		"code",
 		"content",
 		"doc",
diff --git a/src/setup/steps/labels/getExistingEquivalentLabel.ts b/src/setup/steps/labels/getExistingEquivalentLabel.ts
index e22336b..75bb699 100644
--- a/src/setup/steps/labels/getExistingEquivalentLabel.ts
+++ b/src/setup/steps/labels/getExistingEquivalentLabel.ts
@@ -9,8 +9,11 @@ export function getExistingEquivalentLabel(
 ) {
 	const outcomeTrimmed = outcomeLabel.replace(/\w+: (\w+)/, "$1");
 
-	return existingLabels.find(
-		(existingLabel) =>
-			aliases.has(existingLabel) || existingLabel === outcomeTrimmed
-	);
+	return existingLabels.find((existingLabel) => {
+		return (
+			existingLabel === outcomeLabel ||
+			existingLabel === outcomeTrimmed ||
+			aliases.get(existingLabel) === outcomeLabel
+		);
+	});
 }


Test patch:
diff --git a/src/setup/steps/labels/getExistingEquivalentLabel.test.ts b/src/setup/steps/labels/getExistingEquivalentLabel.test.ts
index bb63ab0..48a23d1 100644
--- a/src/setup/steps/labels/getExistingEquivalentLabel.test.ts
+++ b/src/setup/steps/labels/getExistingEquivalentLabel.test.ts
@@ -15,12 +15,18 @@ describe("getExistingEquivalentLabel", () => {
 		expect(actual).toBe(undefined);
 	});
 
-	it("returns the existing label when it matches by name", () => {
+	it("returns an existing un-prefixed label when it matches by name", () => {
 		const actual = getExistingEquivalentLabel(["def", "abc", "ghi"], "abc");
 
 		expect(actual).toBe("abc");
 	});
 
+	it("returns an existing prefixed label when it matches by name", () => {
+		const actual = getExistingEquivalentLabel(["abc: def"], "abc: def");
+
+		expect(actual).toBe("abc: def");
+	});
+
 	it("returns the existing label when it matches excluding prefix", () => {
 		const actual = getExistingEquivalentLabel(
 			["abc: def", "abc", "ghi"],