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

Issue:
🚀 Feature: Remove sourcemap: true from tsup.config.ts
### Bug Report Checklist

- [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.

### Overview

For many years now, I've tried to publish sourcemaps in all projects I publish to npm. The idea was that it would be nice for folks debugging through the code to see the source, including pre-transpiled syntax sugar and TypeScript types.

More recently I've seen packages move away from sourcemaps:

* https://github.com/typescript-eslint/typescript-eslint/issues/9352: noting that sourcemaps add a lot to the typescript-eslint published output size, and aren't always useful or even correct
* https://github.com/JoshuaKGoldberg/ts-api-utils/issues/573 -> https://github.com/JoshuaKGoldberg/ts-api-utils/pull/576: similarly, removing them from `ts-api-utils` dropped the built size a good bit

I'm personally now in favor of removing sourcemaps from the default `tsup.config.ts` in CTA and its templates. But just to be safe, I'll leave this issue with `status: in discussion` for a while. If anybody knows of reasons to do this or not to do this, please post! 🙂 

### Additional Info

🎁 

Pull request description:
feat: remove sourcemaps
## PR Checklist

- [x] Addresses an existing open issue: fixes #1909
- [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

Per discussions linked in the issue, removes sourcemaps to significantly reduce the size of output files.

| Target              | Package Size | Unpacked Size | Total Files |
| ------------------- | ------------ | ------------- | ----------- |
| `main`              | 106.7 kB     | 609.9 kB      | 277         |
| `remove-sourcemaps` | 54.1 kB      | 369.9 kB      | 186         |
| Comparison          | 49% smaller  | 39% smaller   | 32% smaller |

Raw `npm pack` output on `main`:

```plaintext
npm notice Tarball Details
npm notice name: create-typescript-app
npm notice version: 2.2.0
npm notice filename: create-typescript-app-2.2.0.tgz
npm notice package size: 106.7 kB
npm notice unpacked size: 609.9 kB
npm notice shasum: dd0439e3a977c55bbfaa8449f73799314b925368
npm notice integrity: sha512-Z0nBEgLroJY5p[...]yi9LJdG28f9DA==
npm notice total files: 277
```

Raw `npm pack` output with this change:

```plaintext
npm notice Tarball Details
npm notice name: create-typescript-app
npm notice version: 2.2.0
npm notice filename: create-typescript-app-2.2.0.tgz
npm notice package size: 54.1 kB
npm notice unpacked size: 369.9 kB
npm notice shasum: 8f92517ecbd9dbffdba72b5dd11aeceaf7d61b9b
npm notice integrity: sha512-OaNzBaDi41IH5[...]HospZHaW1trEQ==
npm notice total files: 186
```

Patch:
diff --git a/docs/Blocks.md b/docs/Blocks.md
index 30d4d95..f2f2fe7 100644
--- a/docs/Blocks.md
+++ b/docs/Blocks.md
@@ -72,7 +72,7 @@ We strongly recommend using at least the [_"common"_ base level](#common-base-le
 ### Building
 
 [**tsup**](https://tsup.egoist.dev): Builds output definitions and JavaScript files using [esbuild](https://esbuild.github.io).
-Each `*.ts` source file within `src/` is built into `.d.ts`, `.js`, and `.js.map` output files in `lib/`.
+Each `*.ts` source file within `src/` is built into `.d.ts` and `.js` output files in `lib/`.
 
 Building once:
 
diff --git a/src/blocks/blockTSup.ts b/src/blocks/blockTSup.ts
index 0dc5e9b..25d4fd5 100644
--- a/src/blocks/blockTSup.ts
+++ b/src/blocks/blockTSup.ts
@@ -76,7 +76,6 @@ export default defineConfig({
 	entry: ${JSON.stringify(["src/**/*.ts", ...entry])},
 	format: "esm",
 	outDir: "lib",
-	sourcemap: true,
 });
 `,
 			},
diff --git a/src/blocks/blockTypeScript.ts b/src/blocks/blockTypeScript.ts
index ee6bffe..8762adf 100644
--- a/src/blocks/blockTypeScript.ts
+++ b/src/blocks/blockTypeScript.ts
@@ -121,7 +121,6 @@ export * from "./types.js";
 						noEmit: true,
 						resolveJsonModule: true,
 						skipLibCheck: true,
-						sourceMap: true,
 						strict: true,
 						target: "ES2022",
 					},
diff --git a/tsconfig.json b/tsconfig.json
index 223cce1..33428be 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,7 +8,6 @@
 		"noEmit": true,
 		"resolveJsonModule": true,
 		"skipLibCheck": true,
-		"sourceMap": true,
 		"strict": true,
 		"target": "ES2022"
 	},
diff --git a/tsup.config.ts b/tsup.config.ts
index 43c6f24..d33373a 100644
--- a/tsup.config.ts
+++ b/tsup.config.ts
@@ -7,5 +7,4 @@ export default defineConfig({
 	entry: ["src/**/*.ts", "!src/**/*.test.*"],
 	format: "esm",
 	outDir: "lib",
-	sourcemap: true,
 });


Test patch:
diff --git a/src/blocks/blockTSup.test.ts b/src/blocks/blockTSup.test.ts
index 79dcd28..85e8608 100644
--- a/src/blocks/blockTSup.test.ts
+++ b/src/blocks/blockTSup.test.ts
@@ -87,7 +87,6 @@ describe("blockTSup", () => {
 				entry: ["src/**/*.ts"],
 				format: "esm",
 				outDir: "lib",
-				sourcemap: true,
 			});
 			",
 			  },
@@ -175,7 +174,6 @@ describe("blockTSup", () => {
 				entry: ["src/**/*.ts"],
 				format: "esm",
 				outDir: "lib",
-				sourcemap: true,
 			});
 			",
 			  },
@@ -279,7 +277,6 @@ describe("blockTSup", () => {
 				entry: ["src/**/*.ts","!src/**/*.test.ts"],
 				format: "esm",
 				outDir: "lib",
-				sourcemap: true,
 			});
 			",
 			  },
diff --git a/src/blocks/blockTypeScript.test.ts b/src/blocks/blockTypeScript.test.ts
index cdd023d..6466d48 100644
--- a/src/blocks/blockTypeScript.test.ts
+++ b/src/blocks/blockTypeScript.test.ts
@@ -147,7 +147,7 @@ describe("blockTypeScript", () => {
 			    },
 			  ],
 			  "files": {
-			    "tsconfig.json": "{"compilerOptions":{"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":"NodeNext","moduleResolution":"NodeNext","noEmit":true,"resolveJsonModule":true,"skipLibCheck":true,"sourceMap":true,"strict":true,"target":"ES2022"},"include":["src"]}",
+			    "tsconfig.json": "{"compilerOptions":{"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":"NodeNext","moduleResolution":"NodeNext","noEmit":true,"resolveJsonModule":true,"skipLibCheck":true,"strict":true,"target":"ES2022"},"include":["src"]}",
 			  },
 			}
 		`);
@@ -309,7 +309,7 @@ describe("blockTypeScript", () => {
 			    },
 			  ],
 			  "files": {
-			    "tsconfig.json": "{"compilerOptions":{"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":"NodeNext","moduleResolution":"NodeNext","noEmit":true,"resolveJsonModule":true,"skipLibCheck":true,"sourceMap":true,"strict":true,"target":"ES2022"},"include":["src"]}",
+			    "tsconfig.json": "{"compilerOptions":{"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":"NodeNext","moduleResolution":"NodeNext","noEmit":true,"resolveJsonModule":true,"skipLibCheck":true,"strict":true,"target":"ES2022"},"include":["src"]}",
 			  },
 			}
 		`);