Skip to content

Commit 59e6a31

Browse files
fix: remove ./ prefixes in package.json bin and main (#1871)
## PR Checklist - [x] Addresses an existing open issue: fixes #1870 - [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 There are now no `./` instances in the `package.json` file. Nice. 💖
1 parent a15277b commit 59e6a31

22 files changed

+40
-40
lines changed

.github/DEVELOPMENT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pnpm build --watch
3232

3333
This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging.
3434
To debug a `bin` app, add a breakpoint to your code, then run _Debug Program_ from the VS Code Debug panel (or press F5).
35-
VS Code will automatically run the `build` task in the background before running `./bin/index.js`.
35+
VS Code will automatically run the `build` task in the background before running `bin/index.js`.
3636

3737
## Formatting
3838

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: ./.github/actions/prepare
1616
- run: pnpm build
17-
- run: node ./lib/index.js --version
17+
- run: node lib/index.js --version
1818
lint:
1919
name: Lint
2020
runs-on: ubuntu-latest

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{
1515
"name": "Debug Program",
1616
"preLaunchTask": "build",
17-
"program": "./bin/index.js",
17+
"program": "bin/index.js",
1818
"request": "launch",
1919
"skipFiles": ["<node_internals>/**"],
2020
"type": "node"

docs/FAQs.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ Then:
116116
"exports": {
117117
".": {
118118
"types": {
119-
"import": "./lib/index.d.ts",
120-
"require": "./lib/index.d.cts"
119+
"import": "lib/index.d.ts",
120+
"require": "lib/index.d.cts"
121121
},
122-
"import": "./lib/index.js",
123-
"require": "./lib/index.cjs"
122+
"import": "lib/index.js",
123+
"require": "lib/index.cjs"
124124
}
125125
}
126126
}
@@ -222,7 +222,7 @@ If you really want spaces in your project you can always remove the `"useTabs":
222222
## How can I use `bin`?
223223

224224
The `--bin` option allows you to create a `package.json` bin value to include for npx-style running.
225-
An example of this would be `"./bin/index.js"`.
225+
An example of this would be `"bin/index.js"`.
226226
You'll need to create the folders and files that `bin` references.
227227

228228
If you'd like an example of what that looks like, take a look at the [CTA source code](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/e7fafcb8968f8f6c551ab0917c9a6a849a3cba28/bin/index.js)!

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"email": "[email protected]"
1313
},
1414
"type": "module",
15-
"main": "./lib/index.js",
16-
"bin": "./bin/index.js",
15+
"main": "lib/index.js",
16+
"bin": "bin/index.js",
1717
"files": [
1818
"LICENSE.md",
1919
"README.md",
@@ -24,7 +24,7 @@
2424
"scripts": {
2525
"build": "tsup",
2626
"format": "prettier .",
27-
"initialize": "pnpm build --no-dts && tsx ./bin/index.js --mode initialize",
27+
"initialize": "pnpm build --no-dts && tsx bin/index.js --mode initialize",
2828
"lint": "eslint . --max-warnings 0",
2929
"lint:knip": "knip",
3030
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",

script/__snapshots__/migrate-test-e2e.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ exports[`expected file changes > .github/workflows/ci.yml 1`] = `
2020
- uses: actions/checkout@v4
2121
- uses: ./.github/actions/prepare
2222
- run: pnpm build
23-
- - run: node ./lib/index.js --version
24-
+ - run: node ./lib/index.js
23+
- - run: node lib/index.js --version
24+
+ - run: node lib/index.js
2525
lint:
2626
name: Lint
2727
runs-on: ubuntu-latest

script/create-test-e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ await rimraf(["coverage*", repository]);
1515
// asserting that pnpm i passes in that repository's directory.
1616
await $({
1717
stdio: "inherit",
18-
})`c8 -o ./coverage-create -r html -r lcov --src src node ./bin/index.js --base everything --mode create --author ${author} --email ${email} --description ${description} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api`;
18+
})`c8 -o ./coverage-create -r html -r lcov --src src node bin/index.js --base everything --mode create --author ${author} --email ${email} --description ${description} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api`;
1919

2020
process.chdir(repository);
2121

script/initialize-test-e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ await $`pnpm i`;
5858
await $`pnpm run build`;
5959
await $({
6060
stdio: "inherit",
61-
})`c8 -o ./coverage -r html -r lcov --src src node ./bin/index.js --base everything --mode initialize --description ${description} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api --skip-removal --skip-restore`;
61+
})`c8 -o ./coverage -r html -r lcov --src src node bin/index.js --base everything --mode initialize --description ${description} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api --skip-removal --skip-restore`;

script/migrate-test-e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const originalSnapshots = (
3333

3434
await $({
3535
stdio: "inherit",
36-
})`c8 -o ./coverage -r html -r lcov --src src node ./bin/index.js --auto --mode migrate --skip-all-contributors-api --skip-github-api --skip-install`;
36+
})`c8 -o ./coverage -r html -r lcov --src src node bin/index.js --auto --mode migrate --skip-all-contributors-api --skip-github-api --skip-install`;
3737

3838
// All Contributors seems to not be using Prettier to format files...
3939
await fs.writeFile(

src/next/blocks/blockPackageJson.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("blockPackageJson", () => {
1313
expect(creation).toMatchInlineSnapshot(`
1414
{
1515
"files": {
16-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
16+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"lib/index.js","files":["README.md","package.json"]}",
1717
},
1818
"scripts": [
1919
{
@@ -36,7 +36,7 @@ describe("blockPackageJson", () => {
3636
expect(creation).toMatchInlineSnapshot(`
3737
{
3838
"files": {
39-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
39+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"lib/index.js","files":["README.md","package.json"]}",
4040
},
4141
"scripts": [
4242
{
@@ -73,7 +73,7 @@ describe("blockPackageJson", () => {
7373
expect(creation).toMatchInlineSnapshot(`
7474
{
7575
"files": {
76-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}",
76+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}",
7777
},
7878
"scripts": [
7979
{
@@ -108,7 +108,7 @@ describe("blockPackageJson", () => {
108108
expect(creation).toMatchInlineSnapshot(`
109109
{
110110
"files": {
111-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"devDependencies":{"is-even":"4.5.6"},"other":true}",
111+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"devDependencies":{"is-even":"4.5.6"},"other":true}",
112112
},
113113
"scripts": [
114114
{

src/next/blocks/blockPackageJson.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const blockPackageJson = base.createBlock({
7979
keyword.split(/ /),
8080
),
8181
license: "MIT",
82-
main: "./lib/index.js",
82+
main: "lib/index.js",
8383
name: options.repository,
8484
repository: {
8585
type: "git",

src/next/blocks/blockTSup.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("blockTSup", () => {
5151
"run": "pnpm build",
5252
},
5353
{
54-
"run": "node ./lib/index.js",
54+
"run": "node lib/index.js",
5555
},
5656
],
5757
},
@@ -139,7 +139,7 @@ describe("blockTSup", () => {
139139
"run": "pnpm build",
140140
},
141141
{
142-
"run": "node ./lib/index.js",
142+
"run": "node lib/index.js",
143143
},
144144
],
145145
},
@@ -236,7 +236,7 @@ describe("blockTSup", () => {
236236
"run": "pnpm build",
237237
},
238238
{
239-
"run": "node ./lib/index.js",
239+
"run": "node lib/index.js",
240240
},
241241
],
242242
},

src/next/blocks/blockTSup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pnpm build --watch
6060
steps: [
6161
{ run: "pnpm build" },
6262
{
63-
run: `node ./lib/index.js${addons.runArgs.map((arg) => ` ${arg}`).join("")}`,
63+
run: `node lib/index.js${addons.runArgs.map((arg) => ` ${arg}`).join("")}`,
6464
},
6565
],
6666
},

src/next/blocks/blockTypeScript.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe("blockTypeScript", () => {
107107
"files": [
108108
"lib/",
109109
],
110-
"main": "./lib/index.js",
110+
"main": "lib/index.js",
111111
"scripts": {
112112
"tsc": "tsc",
113113
},
@@ -258,7 +258,7 @@ describe("blockTypeScript", () => {
258258
"files": [
259259
"lib/",
260260
],
261-
"main": "./lib/index.js",
261+
"main": "lib/index.js",
262262
"scripts": {
263263
"tsc": "tsc",
264264
},

src/next/blocks/blockTypeScript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export * from "./types.js";
7777
properties: {
7878
devDependencies: getPackageDependencies("typescript"),
7979
files: ["lib/"],
80-
main: "./lib/index.js",
80+
main: "lib/index.js",
8181
scripts: {
8282
tsc: "tsc",
8383
},

src/shared/options/createOptionDefaults/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("createOptionDefaults", () => {
5353
});
5454

5555
it("returns the bin when package data has a bin", async () => {
56-
const bin = "./lib/index.js";
56+
const bin = "lib/index.js";
5757

5858
mockReadPackageData.mockResolvedValue({ bin });
5959

src/steps/writing/creation/dotGitHub/createDotGitHubFiles.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const createOptions = (exclude: boolean) =>
1111
({
1212
access: "public",
1313
base: "everything",
14-
bin: exclude ? undefined : "./bin/index.js",
14+
bin: exclude ? undefined : "bin/index.js",
1515
description: "Test description.",
1616
directory: ".",
1717
email: {

src/steps/writing/creation/dotGitHub/createWorkflows.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const createOptions = (exclude: boolean) =>
77
({
88
access: "public",
99
base: "everything",
10-
bin: exclude ? undefined : "./bin/index.js",
10+
bin: exclude ? undefined : "bin/index.js",
1111
description: "Test description.",
1212
directory: ".",
1313
email: {
@@ -75,7 +75,7 @@ describe("createWorkflows", () => {
7575
- uses: actions/checkout@v4
7676
- uses: ./.github/actions/prepare
7777
- run: pnpm build
78-
- run: node ./lib/index.js
78+
- run: node lib/index.js
7979
lint:
8080
name: Lint
8181
runs-on: ubuntu-latest
@@ -320,7 +320,7 @@ describe("createWorkflows", () => {
320320
- uses: actions/checkout@v4
321321
- uses: ./.github/actions/prepare
322322
- run: pnpm build
323-
- run: node ./lib/index.js
323+
- run: node lib/index.js
324324
lint:
325325
name: Lint
326326
runs-on: ubuntu-latest

src/steps/writing/creation/dotGitHub/createWorkflows.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function createWorkflows(options: Options) {
3232
jobs: [
3333
{
3434
name: "Build",
35-
steps: [{ run: "pnpm build" }, { run: "node ./lib/index.js" }],
35+
steps: [{ run: "pnpm build" }, { run: "node lib/index.js" }],
3636
},
3737
{
3838
name: "Prettier",

src/steps/writing/creation/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("createStructure", () => {
256256
),
257257
scripts: {
258258
initialize:
259-
"pnpm build --no-dts && tsx ./bin/index.js --mode initialize",
259+
"pnpm build --no-dts && tsx bin/index.js --mode initialize",
260260
"test:create": "npx tsx script/create-test-e2e.ts",
261261
"test:initialize": "npx tsx script/initialize-test-e2e.ts",
262262
"test:migrate": "vitest run -r script/",

src/steps/writing/creation/writePackageJson.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("writePackageJson", () => {
8989
"lint-staged": {
9090
"*": "prettier --ignore-unknown --write",
9191
},
92-
"main": "./lib/index.js",
92+
"main": "lib/index.js",
9393
"name": "test-repository",
9494
"publishConfig": {
9595
"provenance": true,
@@ -121,7 +121,7 @@ describe("writePackageJson", () => {
121121

122122
const packageJson = await writePackageJson({
123123
...options,
124-
bin: "./bin/index.js",
124+
bin: "bin/index.js",
125125
excludeAllContributors: true,
126126
excludeBuild: true,
127127
excludeCompliance: true,
@@ -144,7 +144,7 @@ describe("writePackageJson", () => {
144144
"email": "[email protected]",
145145
"name": "test-author",
146146
},
147-
"bin": "./bin/index.js",
147+
"bin": "bin/index.js",
148148
"description": "Test description.",
149149
"devDependencies": {},
150150
"engines": {
@@ -161,7 +161,7 @@ describe("writePackageJson", () => {
161161
"lint-staged": {
162162
"*": "prettier --ignore-unknown --write",
163163
},
164-
"main": "./lib/index.js",
164+
"main": "lib/index.js",
165165
"name": "test-repository",
166166
"publishConfig": {
167167
"provenance": true,

src/steps/writing/creation/writePackageJson.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function writePackageJson(options: Options) {
8484
"lint-staged": {
8585
"*": "prettier --ignore-unknown --write",
8686
},
87-
main: "./lib/index.js",
87+
main: "lib/index.js",
8888
name: options.repository,
8989
publishConfig: {
9090
provenance: true,

0 commit comments

Comments
 (0)