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

Issue:
🐛 Bug: Error with --mode create in a blank directory: Cannot read properties of null (reading 'description')
### 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` in new blank directory and selecting _`--initialize a repository in the current directory freshly forked from the GitHub template`_ then _`Create a new repository`_ should pass.


### Actual

```plaintext
Error: Failed initializing local files
    at withSpinner (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/cli/spinners.js:21:11)
    at async initializeWithValues (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithValues.js:18:3)
    ... 4 lines matching cause stack trace ...
    at async file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/bin/index.js:4:20 {
  [cause]: TypeError: Cannot read properties of null (reading 'description')
      at updateLocalFiles (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/steps/updateLocalFiles.js:37:23)
      at async file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithValues.js:19:5
      at async withSpinner (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/cli/spinners.js:12:20)
      at async initializeWithValues (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithValues.js:18:3)
      at async run (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/index.js:13:7)
      at async runOrRestore (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/runOrRestore.js:9:5)
      at async Object.initialize (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/index.js:11:10)
      at async bin (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/bin/index.js:47:10)
      at async file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/bin/index.js:4:20
}
```

### Additional Info

_No response_

Pull request:
fix: allow package.json to be empty in updateLocalFiles
## PR Checklist

- [x] Addresses an existing open issue: fixes #685
- [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

Yet another case where a non-existent (or empty) `package.json` caused issues.

Patch:
diff --git a/src/steps/updateLocalFiles.ts b/src/steps/updateLocalFiles.ts
index afd0d1a..a3a1c46 100644
--- a/src/steps/updateLocalFiles.ts
+++ b/src/steps/updateLocalFiles.ts
@@ -22,9 +22,8 @@ export async function updateLocalFiles({
 	repository,
 	title,
 }: UpdateLocalFilesOptions) {
-	const existingPackage = (await readFileSafeAsJson(
-		"./package.json",
-	)) as ExistingPackageData;
+	const existingPackage = ((await readFileSafeAsJson("./package.json")) ??
+		{}) as ExistingPackageData;
 
 	const replacements = [
 		[/Template TypeScript Node Package/g, title],


Test patch:
diff --git a/src/steps/updateLocalFiles.test.ts b/src/steps/updateLocalFiles.test.ts
index 7221e8a..faf4f94 100644
--- a/src/steps/updateLocalFiles.test.ts
+++ b/src/steps/updateLocalFiles.test.ts
@@ -40,7 +40,142 @@ describe("updateLocalFiles", () => {
 		);
 	});
 
-	it("replaces using the common replacements when the existing package data is empty", async () => {
+	it("replaces using the common replacements when the existing package data is null", async () => {
+		mockReadFileSafeAsJson.mockResolvedValue(null);
+		mockReplaceInFile.mockResolvedValue([]);
+
+		await updateLocalFiles(stubOptions);
+
+		expect(mockReplaceInFile.mock.calls).toMatchInlineSnapshot(`
+			[
+			  [
+			    {
+			      "files": [
+			        "./.github/**/*",
+			        "./*.*",
+			      ],
+			      "from": /Template TypeScript Node Package/g,
+			      "to": "Stub Title",
+			    },
+			  ],
+			  [
+			    {
+			      "files": [
+			        "./.github/**/*",
+			        "./*.*",
+			      ],
+			      "from": /JoshuaKGoldberg/g,
+			      "to": "StubOwner",
+			    },
+			  ],
+			  [
+			    {
+			      "files": [
+			        "./.github/**/*",
+			        "./*.*",
+			      ],
+			      "from": /template-typescript-node-package/g,
+			      "to": "stub-repository",
+			    },
+			  ],
+			  [
+			    {
+			      "files": ".eslintrc.cjs",
+			      "from": /\\\\/\\\\\\*\\\\n\\.\\+\\\\\\*\\\\/\\\\n\\\\n/gs,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"author": "\\.\\+"/g,
+			      "to": "\\"author\\": \\"stub-npm-author\\"",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"bin": "\\.\\+\\\\n/g,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"create:test": "\\.\\+\\\\n/g,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"initialize:test": "\\.\\*/g,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"initialize": "\\.\\*/g,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./package.json",
+			      "from": /"migrate:test": "\\.\\+\\\\n/g,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./README.md",
+			      "from": /## Getting Started\\.\\*## Development/gs,
+			      "to": "## Development",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./.github/DEVELOPMENT.md",
+			      "from": /\\\\n## Setup Scripts\\.\\*\\$/gs,
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./knip.jsonc",
+			      "from": "		\\"src/initialize/index.ts\\",
+			",
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./knip.jsonc",
+			      "from": "		\\"src/migrate/index.ts\\",
+			",
+			      "to": "",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./knip.jsonc",
+			      "from": "[\\"src/index.ts!\\", \\"script/initialize*.js\\"]",
+			      "to": "\\"src/index.ts!\\"",
+			    },
+			  ],
+			  [
+			    {
+			      "files": "./knip.jsonc",
+			      "from": "[\\"src/**/*.ts!\\", \\"script/**/*.js\\"]",
+			      "to": "\\"src/**/*.ts!\\"",
+			    },
+			  ],
+			]
+		`);
+	});
+
+	it("replaces using the common replacements when the existing package data is an empty object", async () => {
 		mockReadFileSafeAsJson.mockResolvedValue({});
 		mockReplaceInFile.mockResolvedValue([]);