Repository: JoshuaKGoldberg/create-typescript-app (ts)

Issue:
🐛 Bug: pnpm initialize error in a template-created repository: Cannot find module lib/bin/index.js
### 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/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

Running `pnpm i` then `pnpm initialize` in a repository newly created & cloned from the template should work.

### Actual

```plaintext
joshgoldberg ~/repos/github-notifications-prune $ pnpm initialize

> create-typescript-app@1.57.8 initialize /Users/josh/repos/github-notifications-prune
> tsx ./bin/index.js --mode initialize


node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/josh/repos/github-notifications-prune/lib/bin/index.js' imported from /Users/josh/repos/github-notifications-prune/bin/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:264:11)
    at moduleResolve (node:internal/modules/esm/resolve:917:10)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at d (file:///Users/josh/repos/github-notifications-prune/node_modules/.pnpm/tsx@4.7.1/node_modules/tsx/dist/esm/index.mjs:5:34)
    at O (file:///Users/josh/repos/github-notifications-prune/node_modules/.pnpm/tsx@4.7.1/node_modules/tsx/dist/esm/index.mjs:5:1162)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:303:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///Users/josh/repos/github-notifications-prune/lib/bin/index.js'
}

Node.js v20.11.0
 ELIFECYCLE  Command failed with exit code 1.
```

### Additional Info

_No response_

Pull request description:
fix: build in initialize script
## PR Checklist

- [x] Addresses an existing open issue: fixes #1362
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

The fact that this wasn't reported by anybody else or fixed yet is an amusing indicator of how rarely _Use this template_ button is used.

💖 

Patch:
diff --git a/package.json b/package.json
index e690069..9548db9 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
 	"scripts": {
 		"build": "tsup",
 		"format": "prettier .",
-		"initialize": "tsx ./bin/index.js --mode initialize",
+		"initialize": "pnpm build --no-dts && tsx ./bin/index.js --mode initialize",
 		"lint": "eslint . --max-warnings 0",
 		"lint:knip": "knip",
 		"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",


Test patch:
diff --git a/src/steps/writing/creation/index.test.ts b/src/steps/writing/creation/index.test.ts
index 027bff8..06b4db9 100644
--- a/src/steps/writing/creation/index.test.ts
+++ b/src/steps/writing/creation/index.test.ts
@@ -251,7 +251,8 @@ describe("createStructure", () => {
 						"tsx",
 					),
 					scripts: {
-						initialize: "tsx ./bin/index.js --mode initialize",
+						initialize:
+							"pnpm build --no-dts && tsx ./bin/index.js --mode initialize",
 						"test:create": "npx tsx script/create-test-e2e.ts",
 						"test:initialize": "npx tsx script/initialize-test-e2e.ts",
 						"test:migrate": "vitest run -r script/",