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

Issue:
🐛 Bug: Hydration failure: Error: Could not read file from ./src/setup/labels.json
### 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

Running `npx template-typescript-node-package` to hydrate an existing repo should be able to set up labels from the installed `template-typescript-node-package`'s `labels.json`

### Actual

```plaintext

◇  ❌ Error hydrating repository labels.
│
└  Looks like there was a problem. Correct it and try again? 😕


Error: Failed hydrating repository labels
    at withSpinner (file:///Users/josh/repos/template-typescript-node-package/lib/shared/cli/spinners.js:27:15)
    at async setupWithInformation (file:///Users/josh/repos/template-typescript-node-package/lib/setup/setupWithInformation.js:31:9)
    ... 3 lines matching cause stack trace ...
    at async file:///Users/josh/repos/template-typescript-node-package/lib/hydrate/index.js:2:20 {
  [cause]: Error: Could not read file from ./src/setup/labels.json as JSON. Please ensure the file exists and is valid JSON.
      at readFileAsJson (file:///Users/josh/repos/template-typescript-node-package/lib/shared/readFileAsJson.js:7:15)
      at async hydrateRepositoryLabels (file:///Users/josh/repos/template-typescript-node-package/lib/setup/steps/labels/hydrateRepositoryLabels.js:7:28)
      at async withSpinner (file:///Users/josh/repos/template-typescript-node-package/lib/shared/cli/spinners.js:15:24)
      at async setupWithInformation (file:///Users/josh/repos/template-typescript-node-package/lib/setup/setupWithInformation.js:31:9)
      at async run (file:///Users/josh/repos/template-typescript-node-package/lib/hydrate/hydrate.js:44:17)
      at async runOrRestore (file:///Users/josh/repos/template-typescript-node-package/lib/shared/runOrRestore.js:15:9)
      at async hydrate (file:///Users/josh/repos/template-typescript-node-package/lib/hydrate/hydrate.js:22:12)
      at async file:///Users/josh/repos/template-typescript-node-package/lib/hydrate/index.js:2:20 {
    [cause]: [Error: ENOENT: no such file or directory, open './src/setup/labels.json'] {
      errno: -2,
      code: 'ENOENT',
      syscall: 'open',
      path: './src/setup/labels.json'
    }
  }
}
```

### Additional Info

_No response_

Pull request description:
fix: import labels.json in setup
## PR Checklist

- [x] Addresses an existing open issue: fixes #547
- [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

Imports from the local `./labels.json` instead of reading the file as JSON. This is actually a bit simpler as an approach!

Patch:
diff --git a/cspell.json b/cspell.json
index a404903..58a4bbc 100644
--- a/cspell.json
+++ b/cspell.json
@@ -6,8 +6,7 @@
 		"CHANGELOG.md",
 		"lib",
 		"node_modules",
-		"pnpm-lock.yaml",
-		"src/setup/*.json"
+		"pnpm-lock.yaml"
 	],
 	"words": [
 		"Codecov",
diff --git a/src/hydrate/steps/writing/creation/rootFiles.ts b/src/hydrate/steps/writing/creation/rootFiles.ts
index ebf701d..1450234 100644
--- a/src/hydrate/steps/writing/creation/rootFiles.ts
+++ b/src/hydrate/steps/writing/creation/rootFiles.ts
@@ -299,6 +299,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 				module: "esnext",
 				moduleResolution: "node",
 				outDir: "lib",
+				resolveJsonModule: true,
 				skipLibCheck: true,
 				sourceMap: true,
 				strict: true,
diff --git a/src/setup/labels.json b/src/setup/labels.json
deleted file mode 100644
index afea2b3..0000000
--- a/src/setup/labels.json
+++ /dev/null
@@ -1,77 +0,0 @@
-[
-	{
-		"color": "0075ca",
-		"description": "Improvements or additions to docs",
-		"name": "area: documentation"
-	},
-	{
-		"color": "6009D7",
-		"description": "Improving how the repository's tests are run and/or code is tested",
-		"name": "area: testing"
-	},
-	{
-		"color": "f9d0c4",
-		"description": "Managing the repository's maintenance",
-		"name": "area: tooling"
-	},
-	{
-		"color": "5319E7",
-		"description": "Good for newcomers, please hop on!",
-		"name": "good first issue"
-	},
-	{
-		"color": "7a5901",
-		"description": "This doesn't seem right",
-		"name": "invalid"
-	},
-	{
-		"color": "0E8A16",
-		"description": "Please, send a pull request to resolve this!",
-		"name": "status: accepting prs"
-	},
-	{
-		"color": "#ddcccc",
-		"description": "Waiting for something else to be resolved",
-		"name": "status: blocked"
-	},
-	{
-		"color": "cfd3d7",
-		"description": "This issue or pull request already exists",
-		"name": "status: duplicate"
-	},
-	{
-		"color": "#05104F",
-		"description": "Not yet ready for implementation or a pull request",
-		"name": "status: in discussion"
-	},
-	{
-		"color": "D3F82D",
-		"description": "Further research required...?",
-		"name": "status: needs investigation"
-	},
-	{
-		"color": "E4BC82",
-		"description": "Needs an action taken by the original poster",
-		"name": "status: waiting for author"
-	},
-	{
-		"color": "ffffff",
-		"description": "This will not be worked on",
-		"name": "status: wontfix"
-	},
-	{
-		"color": "d73a4a",
-		"description": "Something isn't working :(",
-		"name": "type: bug"
-	},
-	{
-		"color": "a2eeef",
-		"description": "New enhancement or request",
-		"name": "type: feature"
-	},
-	{
-		"color": "d876e3",
-		"description": "Further information is requested",
-		"name": "type: question"
-	}
-]
diff --git a/src/setup/steps/labels/hydrateRepositoryLabels.ts b/src/setup/steps/labels/hydrateRepositoryLabels.ts
index 8e9cbc7..adf3491 100644
--- a/src/setup/steps/labels/hydrateRepositoryLabels.ts
+++ b/src/setup/steps/labels/hydrateRepositoryLabels.ts
@@ -1,18 +1,12 @@
 import { $ } from "execa";
 
-import { readFileAsJson } from "../../../shared/readFileAsJson.js";
 import { getExistingEquivalentLabel } from "./getExistingEquivalentLabel.js";
+import { outcomeLabels } from "./outcomeLabels.js";
 
 interface GhLabelData {
 	name: string;
 }
 
-interface FileLabelData {
-	color: string;
-	description: string;
-	name: string;
-}
-
 export async function hydrateRepositoryLabels() {
 	const getLabelName = (label: { name: string }) => label.name;
 
@@ -22,10 +16,6 @@ export async function hydrateRepositoryLabels() {
 		) as GhLabelData[]
 	).map(getLabelName);
 
-	const outcomeLabels = (await readFileAsJson(
-		"./src/setup/labels.json"
-	)) as FileLabelData[];
-
 	for (const outcome of outcomeLabels) {
 		const existingEquivalent = getExistingEquivalentLabel(
 			existingLabels,
diff --git a/src/setup/steps/labels/outcomeLabels.ts b/src/setup/steps/labels/outcomeLabels.ts
new file mode 100644
index 0000000..f86544b
--- /dev/null
+++ b/src/setup/steps/labels/outcomeLabels.ts
@@ -0,0 +1,79 @@
+/* spellchecker: disable */
+export const outcomeLabels = [
+	{
+		color: "0075ca",
+		description: "Improvements or additions to docs",
+		name: "area: documentation",
+	},
+	{
+		color: "6009D7",
+		description:
+			"Improving how the repository's tests are run and/or code is tested",
+		name: "area: testing",
+	},
+	{
+		color: "f9d0c4",
+		description: "Managing the repository's maintenance",
+		name: "area: tooling",
+	},
+	{
+		color: "5319E7",
+		description: "Good for newcomers, please hop on!",
+		name: "good first issue",
+	},
+	{
+		color: "7a5901",
+		description: "This doesn't seem right",
+		name: "invalid",
+	},
+	{
+		color: "0E8A16",
+		description: "Please, send a pull request to resolve this!",
+		name: "status: accepting prs",
+	},
+	{
+		color: "#ddcccc",
+		description: "Waiting for something else to be resolved",
+		name: "status: blocked",
+	},
+	{
+		color: "cfd3d7",
+		description: "This issue or pull request already exists",
+		name: "status: duplicate",
+	},
+	{
+		color: "#05104F",
+		description: "Not yet ready for implementation or a pull request",
+		name: "status: in discussion",
+	},
+	{
+		color: "D3F82D",
+		description: "Further research required...?",
+		name: "status: needs investigation",
+	},
+	{
+		color: "E4BC82",
+		description: "Needs an action taken by the original poster",
+		name: "status: waiting for author",
+	},
+	{
+		color: "ffffff",
+		description: "This will not be worked on",
+		name: "status: wontfix",
+	},
+	{
+		color: "d73a4a",
+		description: "Something isn't working :(",
+		name: "type: bug",
+	},
+	{
+		color: "a2eeef",
+		description: "New enhancement or request",
+		name: "type: feature",
+	},
+	{
+		color: "d876e3",
+		description: "Further information is requested",
+		name: "type: question",
+	},
+];
diff --git a/tsconfig.json b/tsconfig.json
index 5f9b139..a1e8c17 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,6 +6,7 @@
 		"module": "esnext",
 		"moduleResolution": "node",
 		"outDir": "lib",
+		"resolveJsonModule": true,
 		"skipLibCheck": true,
 		"sourceMap": true,
 		"strict": true,


Test patch:
diff --git a/src/setup/steps/labels/hydrateRepositoryLabels.test.ts b/src/setup/steps/labels/hydrateRepositoryLabels.test.ts
index a0d12d7..8bc3f55 100644
--- a/src/setup/steps/labels/hydrateRepositoryLabels.test.ts
+++ b/src/setup/steps/labels/hydrateRepositoryLabels.test.ts
@@ -10,18 +10,14 @@ vi.mock("execa", () => ({
 	},
 }));
 
-const mockReadFileAsJson = vi.fn().mockResolvedValue([
-	{
-		color: "000000",
-		description: "def ghi",
-		name: "abc",
-	},
-]);
-
-vi.mock("../../../shared/readFileAsJson.js", () => ({
-	get readFileAsJson() {
-		return mockReadFileAsJson;
-	},
+vi.mock("./outcomeLabels.js", () => ({
+	outcomeLabels: [
+		{
+			color: "000000",
+			description: "def ghi",
+			name: "abc",
+		},
+	],
 }));
 
 describe("hydrateRepositoryLabels", () => {