diff --git a/.github/DEVELOPMENT.md b/.github/DEVELOPMENT.md index 307d39f4e..d403f3860 100644 --- a/.github/DEVELOPMENT.md +++ b/.github/DEVELOPMENT.md @@ -32,7 +32,7 @@ pnpm build --watch This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging. To debug a `bin` app, add a breakpoint to your code, then run _Debug Program_ from the VS Code Debug panel (or press F5). -VS Code will automatically run the `build` task in the background before running `./bin/index.js`. +VS Code will automatically run the `build` task in the background before running `bin/index.js`. ## Formatting diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39a417b1e..475d7007c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare - run: pnpm build - - run: node ./lib/index.js --version + - run: node lib/index.js --version lint: name: Lint runs-on: ubuntu-latest diff --git a/.vscode/launch.json b/.vscode/launch.json index 1d2f28d89..db136e5fa 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,7 +14,7 @@ { "name": "Debug Program", "preLaunchTask": "build", - "program": "./bin/index.js", + "program": "bin/index.js", "request": "launch", "skipFiles": ["/**"], "type": "node" diff --git a/docs/FAQs.md b/docs/FAQs.md index 71eb53746..22014acc3 100644 --- a/docs/FAQs.md +++ b/docs/FAQs.md @@ -116,11 +116,11 @@ Then: "exports": { ".": { "types": { - "import": "./lib/index.d.ts", - "require": "./lib/index.d.cts" + "import": "lib/index.d.ts", + "require": "lib/index.d.cts" }, - "import": "./lib/index.js", - "require": "./lib/index.cjs" + "import": "lib/index.js", + "require": "lib/index.cjs" } } } @@ -222,7 +222,7 @@ If you really want spaces in your project you can always remove the `"useTabs": ## How can I use `bin`? The `--bin` option allows you to create a `package.json` bin value to include for npx-style running. -An example of this would be `"./bin/index.js"`. +An example of this would be `"bin/index.js"`. You'll need to create the folders and files that `bin` references. 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)! diff --git a/package.json b/package.json index ad89707bc..5214fc2f0 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "email": "npm@joshuakgoldberg.com" }, "type": "module", - "main": "./lib/index.js", - "bin": "./bin/index.js", + "main": "lib/index.js", + "bin": "bin/index.js", "files": [ "LICENSE.md", "README.md", @@ -24,7 +24,7 @@ "scripts": { "build": "tsup", "format": "prettier .", - "initialize": "pnpm build --no-dts && 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", diff --git a/script/__snapshots__/migrate-test-e2e.ts.snap b/script/__snapshots__/migrate-test-e2e.ts.snap index a4452a042..b337a44a5 100644 --- a/script/__snapshots__/migrate-test-e2e.ts.snap +++ b/script/__snapshots__/migrate-test-e2e.ts.snap @@ -20,8 +20,8 @@ exports[`expected file changes > .github/workflows/ci.yml 1`] = ` - uses: actions/checkout@v4 - uses: ./.github/actions/prepare - run: pnpm build -- - run: node ./lib/index.js --version -+ - run: node ./lib/index.js +- - run: node lib/index.js --version ++ - run: node lib/index.js lint: name: Lint runs-on: ubuntu-latest diff --git a/script/create-test-e2e.ts b/script/create-test-e2e.ts index 2419e8b9a..28548f2fc 100644 --- a/script/create-test-e2e.ts +++ b/script/create-test-e2e.ts @@ -15,7 +15,7 @@ await rimraf(["coverage*", repository]); // asserting that pnpm i passes in that repository's directory. await $({ stdio: "inherit", -})`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`; +})`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`; process.chdir(repository); diff --git a/script/initialize-test-e2e.ts b/script/initialize-test-e2e.ts index a64be02ec..441e5f60a 100644 --- a/script/initialize-test-e2e.ts +++ b/script/initialize-test-e2e.ts @@ -58,4 +58,4 @@ await $`pnpm i`; await $`pnpm run build`; await $({ stdio: "inherit", -})`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`; +})`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`; diff --git a/script/migrate-test-e2e.ts b/script/migrate-test-e2e.ts index d47a4161b..0b0b66fc1 100644 --- a/script/migrate-test-e2e.ts +++ b/script/migrate-test-e2e.ts @@ -33,7 +33,7 @@ const originalSnapshots = ( await $({ stdio: "inherit", -})`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`; +})`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`; // All Contributors seems to not be using Prettier to format files... await fs.writeFile( diff --git a/src/next/blocks/blockPackageJson.test.ts b/src/next/blocks/blockPackageJson.test.ts index 1908b08d8..a0b34e481 100644 --- a/src/next/blocks/blockPackageJson.test.ts +++ b/src/next/blocks/blockPackageJson.test.ts @@ -13,7 +13,7 @@ describe("blockPackageJson", () => { expect(creation).toMatchInlineSnapshot(` { "files": { - "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":"npm@email.com"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}", + "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":"npm@email.com"},"type":"module","main":"lib/index.js","files":["README.md","package.json"]}", }, "scripts": [ { @@ -36,7 +36,7 @@ describe("blockPackageJson", () => { expect(creation).toMatchInlineSnapshot(` { "files": { - "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":"npm@email.com"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}", + "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":"npm@email.com"},"type":"module","main":"lib/index.js","files":["README.md","package.json"]}", }, "scripts": [ { @@ -73,7 +73,7 @@ describe("blockPackageJson", () => { expect(creation).toMatchInlineSnapshot(` { "files": { - "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":"npm@email.com"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}", + "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":"npm@email.com"},"type":"module","main":"lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}", }, "scripts": [ { @@ -108,7 +108,7 @@ describe("blockPackageJson", () => { expect(creation).toMatchInlineSnapshot(` { "files": { - "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":"npm@email.com"},"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}", + "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":"npm@email.com"},"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}", }, "scripts": [ { diff --git a/src/next/blocks/blockPackageJson.ts b/src/next/blocks/blockPackageJson.ts index 5995c2017..42e74a115 100644 --- a/src/next/blocks/blockPackageJson.ts +++ b/src/next/blocks/blockPackageJson.ts @@ -79,7 +79,7 @@ export const blockPackageJson = base.createBlock({ keyword.split(/ /), ), license: "MIT", - main: "./lib/index.js", + main: "lib/index.js", name: options.repository, repository: { type: "git", diff --git a/src/next/blocks/blockTSup.test.ts b/src/next/blocks/blockTSup.test.ts index 0619a5762..1cfbe508b 100644 --- a/src/next/blocks/blockTSup.test.ts +++ b/src/next/blocks/blockTSup.test.ts @@ -51,7 +51,7 @@ describe("blockTSup", () => { "run": "pnpm build", }, { - "run": "node ./lib/index.js", + "run": "node lib/index.js", }, ], }, @@ -139,7 +139,7 @@ describe("blockTSup", () => { "run": "pnpm build", }, { - "run": "node ./lib/index.js", + "run": "node lib/index.js", }, ], }, @@ -236,7 +236,7 @@ describe("blockTSup", () => { "run": "pnpm build", }, { - "run": "node ./lib/index.js", + "run": "node lib/index.js", }, ], }, diff --git a/src/next/blocks/blockTSup.ts b/src/next/blocks/blockTSup.ts index e2bfd297f..7d6d8a381 100644 --- a/src/next/blocks/blockTSup.ts +++ b/src/next/blocks/blockTSup.ts @@ -60,7 +60,7 @@ pnpm build --watch steps: [ { run: "pnpm build" }, { - run: `node ./lib/index.js${addons.runArgs.map((arg) => ` ${arg}`).join("")}`, + run: `node lib/index.js${addons.runArgs.map((arg) => ` ${arg}`).join("")}`, }, ], }, diff --git a/src/next/blocks/blockTypeScript.test.ts b/src/next/blocks/blockTypeScript.test.ts index 094620293..51238b42e 100644 --- a/src/next/blocks/blockTypeScript.test.ts +++ b/src/next/blocks/blockTypeScript.test.ts @@ -107,7 +107,7 @@ describe("blockTypeScript", () => { "files": [ "lib/", ], - "main": "./lib/index.js", + "main": "lib/index.js", "scripts": { "tsc": "tsc", }, @@ -258,7 +258,7 @@ describe("blockTypeScript", () => { "files": [ "lib/", ], - "main": "./lib/index.js", + "main": "lib/index.js", "scripts": { "tsc": "tsc", }, diff --git a/src/next/blocks/blockTypeScript.ts b/src/next/blocks/blockTypeScript.ts index 9da798617..f89304170 100644 --- a/src/next/blocks/blockTypeScript.ts +++ b/src/next/blocks/blockTypeScript.ts @@ -77,7 +77,7 @@ export * from "./types.js"; properties: { devDependencies: getPackageDependencies("typescript"), files: ["lib/"], - main: "./lib/index.js", + main: "lib/index.js", scripts: { tsc: "tsc", }, diff --git a/src/shared/options/createOptionDefaults/index.test.ts b/src/shared/options/createOptionDefaults/index.test.ts index 54189becd..efb36a8fc 100644 --- a/src/shared/options/createOptionDefaults/index.test.ts +++ b/src/shared/options/createOptionDefaults/index.test.ts @@ -53,7 +53,7 @@ describe("createOptionDefaults", () => { }); it("returns the bin when package data has a bin", async () => { - const bin = "./lib/index.js"; + const bin = "lib/index.js"; mockReadPackageData.mockResolvedValue({ bin }); diff --git a/src/steps/writing/creation/dotGitHub/createDotGitHubFiles.test.ts b/src/steps/writing/creation/dotGitHub/createDotGitHubFiles.test.ts index aab930544..14ebd59fc 100644 --- a/src/steps/writing/creation/dotGitHub/createDotGitHubFiles.test.ts +++ b/src/steps/writing/creation/dotGitHub/createDotGitHubFiles.test.ts @@ -11,7 +11,7 @@ const createOptions = (exclude: boolean) => ({ access: "public", base: "everything", - bin: exclude ? undefined : "./bin/index.js", + bin: exclude ? undefined : "bin/index.js", description: "Test description.", directory: ".", email: { diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts index 88c0811d8..cb6db0a26 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts @@ -7,7 +7,7 @@ const createOptions = (exclude: boolean) => ({ access: "public", base: "everything", - bin: exclude ? undefined : "./bin/index.js", + bin: exclude ? undefined : "bin/index.js", description: "Test description.", directory: ".", email: { @@ -75,7 +75,7 @@ describe("createWorkflows", () => { - uses: actions/checkout@v4 - uses: ./.github/actions/prepare - run: pnpm build - - run: node ./lib/index.js + - run: node lib/index.js lint: name: Lint runs-on: ubuntu-latest @@ -320,7 +320,7 @@ describe("createWorkflows", () => { - uses: actions/checkout@v4 - uses: ./.github/actions/prepare - run: pnpm build - - run: node ./lib/index.js + - run: node lib/index.js lint: name: Lint runs-on: ubuntu-latest diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.ts index c6c4f8a82..46556c633 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.ts @@ -32,7 +32,7 @@ export function createWorkflows(options: Options) { jobs: [ { name: "Build", - steps: [{ run: "pnpm build" }, { run: "node ./lib/index.js" }], + steps: [{ run: "pnpm build" }, { run: "node lib/index.js" }], }, { name: "Prettier", diff --git a/src/steps/writing/creation/index.test.ts b/src/steps/writing/creation/index.test.ts index 14e824629..a0b4292bc 100644 --- a/src/steps/writing/creation/index.test.ts +++ b/src/steps/writing/creation/index.test.ts @@ -256,7 +256,7 @@ describe("createStructure", () => { ), scripts: { initialize: - "pnpm build --no-dts && tsx ./bin/index.js --mode 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/", diff --git a/src/steps/writing/creation/writePackageJson.test.ts b/src/steps/writing/creation/writePackageJson.test.ts index 69c197c9c..704e055d5 100644 --- a/src/steps/writing/creation/writePackageJson.test.ts +++ b/src/steps/writing/creation/writePackageJson.test.ts @@ -89,7 +89,7 @@ describe("writePackageJson", () => { "lint-staged": { "*": "prettier --ignore-unknown --write", }, - "main": "./lib/index.js", + "main": "lib/index.js", "name": "test-repository", "publishConfig": { "provenance": true, @@ -121,7 +121,7 @@ describe("writePackageJson", () => { const packageJson = await writePackageJson({ ...options, - bin: "./bin/index.js", + bin: "bin/index.js", excludeAllContributors: true, excludeBuild: true, excludeCompliance: true, @@ -144,7 +144,7 @@ describe("writePackageJson", () => { "email": "npm@email.com", "name": "test-author", }, - "bin": "./bin/index.js", + "bin": "bin/index.js", "description": "Test description.", "devDependencies": {}, "engines": { @@ -161,7 +161,7 @@ describe("writePackageJson", () => { "lint-staged": { "*": "prettier --ignore-unknown --write", }, - "main": "./lib/index.js", + "main": "lib/index.js", "name": "test-repository", "publishConfig": { "provenance": true, diff --git a/src/steps/writing/creation/writePackageJson.ts b/src/steps/writing/creation/writePackageJson.ts index 742acc391..525c3933f 100644 --- a/src/steps/writing/creation/writePackageJson.ts +++ b/src/steps/writing/creation/writePackageJson.ts @@ -84,7 +84,7 @@ export async function writePackageJson(options: Options) { "lint-staged": { "*": "prettier --ignore-unknown --write", }, - main: "./lib/index.js", + main: "lib/index.js", name: options.repository, publishConfig: { provenance: true,